import java.awt.Graphics; import javax.swing.JFrame; public class MainClass extends JFrame { public static void main(String[] a){ MainClass f = new MainClass(); f.setSize(300,300); f.setVisible(true); } public void paint(Graphics g) { g.drawRect(10, 10, 60, 50); g.fillRect(100, 10, 60, 50); g.drawRoundRect(190, 10, 60, 50, 15, 15); g.fillRoundRect(70, 90, 140, 100, 30, 40); } }
16.2.Graphics | ||||
16.2.1. | Draw rectangles | |||
16.2.2. | Fill a solid three-dimensional rectangle | |||
16.2.3. | Draw Ellipses | |||
16.2.4. | Draw 2D shape | |||
16.2.5. | Draw Arcs | |||
16.2.6. | Draw Polygon | |||
16.2.7. | Resizing output to fit the current size of a window. | |||
16.2.8. | Demonstrate XOR mode. |