Guest User

Untitled

a guest
Dec 10th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. public class Main {
  2. public static void main(String[]args) {
  3. Window window = new Window();
  4. window.initializeFrame();
  5. PanelPhone panelPhone = new PanelPhone();
  6. panelPhone.initializePanelPhone();
  7. window.add(panelPhone);
  8.  
  9. }
  10. }
  11.  
  12.  
  13. import javax.swing.*;
  14. import javax.swing.border.EtchedBorder;
  15. import java.awt.*;
  16.  
  17. public class PanelPhone extends JPanel {
  18.  
  19. JPanel panel;
  20.  
  21. public PanelPhone() {
  22. panel = new JPanel();
  23. panel.setVisible(true);
  24. }
  25.  
  26. void initializePanelPhone() {
  27. panel.setLayout(null);
  28. panel.setBorder(new EtchedBorder());
  29. panel.setBackground(Color.GRAY);
  30. panel.setLocation(20, 20);
  31. panel.setSize(300,200);
  32. add(panel);
  33.  
  34. }
  35. }
  36.  
  37.  
  38. import javax.swing.*;
  39. import java.awt.*;
  40.  
  41. public class Window extends Frame {
  42. private JFrame frame;
  43.  
  44. public Window(){
  45. frame = new JFrame("Phone");
  46. frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  47. frame.setVisible(true);
  48. }
  49.  
  50. public void initializeFrame() {
  51. frame.setSize(new Dimension(1000 ,900));
  52. frame.setLocationRelativeTo(null);
  53. frame.setLayout(null);
  54.  
  55. }
  56.  
  57. }
Add Comment
Please, Sign In to add comment