In the previous post we saw how to use JFrame . What if you want to add your own graphics on the screen?? The best way is to make a paintable widget and then we just need to add that button to our frame just like a button . The widget can have moving images or make color change every time you click a button and much more.....
EXAMPLE :
OUTPUT:
Now let's make a program that causes the figure to change its color every time it is clicked by the user !! We will be using Graphics2D class because we want the color of the figure to be decided at compile time and such things can be performed by using Graphics2D object.
OUTPUT :
You might be still confused about JPanel and JFrame. I found the following links to be quite helpful :D
No comments:
Post a Comment