













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














MyApp
Open WinExp, Notepad
Desktop gets repaint event
MyApp gets repaint event
Painting a Swing Component
The Swing Painting Methods
Your Painting Strategy
Example Code: Test1.java
import javax.swing.; import java.awt.; public class Test1{ JFrame f; MyPan1 p; public Test1(){ f = new JFrame(); Container c = f.getContentPane(); c.setLayout(new BorderLayout()); p = new MyPan1(); c.add(p); f.setSize(400,400); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } // end constructor**
Example Code: Test1.java
public static void main(String args[ ]){ Test1 t = new Test1(); }
} // end class
Graphics Primitives
Draw Fill
Graphics Attributes