Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.swing.*;
  3. public class OKNA {
  4.  
  5. public static void main(String[] args) {
  6. myFrame okno = new myFrame();
  7. }
  8. }
  9. class myFrame extends JFrame
  10. {
  11. public myFrame()
  12. {
  13. myPanel panel = new myPanel();
  14. Container cont = getContentPane();
  15. cont.add(panel);
  16. setBounds(10, 10, 300, 400);
  17. setVisible(true);
  18. }
  19.  
  20. }
  21.  
  22. class myPanel extends JPanel
  23. {
  24. public void paintComponent(Graphics gr)
  25. {
  26. super.paintComponent(gr);
  27. gr.setColor(Color.BLUE);
  28. gr.fillRect(10,10,200,300);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement