Crenox

JFrameDemo Program

Jan 22nd, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. package samkough.main;
  2.  
  3. import javax.swing.*;
  4. import java.awt.*;
  5.  
  6. public class JFrameDemo extends JFrame
  7. {
  8. public JFrameDemo()
  9. {
  10. super("JFrameDemo");
  11. setSize(400, 400);
  12. setVisible(true);
  13. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  14. }
  15.  
  16. public void paint(Graphics g)
  17. {
  18. super.paint(g);
  19. g.setColor(Color.WHITE);
  20. g.fillRect(0, 0, 400, 400);
  21. g.setColor(Color.orange);
  22. g.setFont(new Font("Arial", Font.BOLD, 18));
  23. g.drawString("Doing graphics with a JFrame!", 60, 200);
  24. }
  25.  
  26. public static void main (String args[])
  27. {
  28. new JFrameDemo();
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment