This exercise is to learn to draw on panels using the paintComponent(Graphics) method of the component. This method is invoked evry time a component is displayed/redisplayed. The Graphics object is automatically created by the JVM for every visible GUI component and then passed to the paintComponent method.
Panels are invisible and are used as containers. They are used to create the required layout. Panels can also be used for drawing,
Exercise: Write a program that creates a GUI similar to the following on a Panel.
Download Code: Draw on Panel
No comments:
Post a Comment