Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test
- {
- public static void main(String args[])
- {
- JFrame f = new JFrame("test");
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- f.add(new Circle());
- f.pack();
- f.setVisible(true);
- f.setLocationRelativeTo(null); //o מיקום החלון במרכז המסך
- }
- }
- public class Circle extends JPanel
- {
- public JPanel()
- {
- setPreferredSize(new Dimension(500,500));
- }
- @override
- public void paintComponent(Graphics g)
- {
- super.paintComponent(g);
- Graphics2D g2d = (Graphics2D) g;
- g2d.drawOval(200, 200, 100, 100);
- //If you want to call it again
- //repaint();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement