import javax.swing.*; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.*; public class Graphics2DTest2 extends JPanel{ public static void main(String[] args){ JFrame frame = new JFrame(); Graphics2DTest2 app = new Graphics2DTest2(); frame.getContentPane().add(app); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(10, 10, 300, 200); frame.setTitle("ƒ^ƒCƒgƒ‹"); frame.setVisible(true); } public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D)g; g2.draw(new Line2D.Double(20, 20, 160, 140)); } }