Guest User

Window

a guest
Mar 10th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. package com.felix.pack;
  2.  
  3. import javax.swing.JFrame;
  4. import javax.swing.JPanel;
  5.  
  6. public class Window extends JFrame {
  7.  
  8. JFrame frame;
  9. int width;
  10. int height;
  11. String title;
  12.  
  13. MainPane mainpane;
  14.  
  15. public Window(int width, int height, String title){
  16.  
  17. frame = new JFrame();
  18.  
  19. this.width = width;
  20. this.height = height;
  21. this.title = title;
  22.  
  23. frame.setSize(width, height);
  24. frame.setResizable(false);
  25. frame.setLocationRelativeTo(null);
  26. frame.setTitle(title);
  27. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  28. frame.setVisible(true);
  29.  
  30. }
  31.  
  32. public Window(){
  33.  
  34. mainpane = new MainPane();
  35. }
  36.  
  37. public void setPanel(JPanel pane){
  38.  
  39. frame.add(pane);
  40. frame.setContentPane(pane);
  41. frame.pack();
  42.  
  43. }
  44.  
  45.  
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment