aquaballoon

Java: JPanel in JFrame without main( )

Feb 25th, 2012
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. package home.aquaballoon;
  2.  
  3. // Chage from constructor to sub class
  4. class CS3_Linux_Sub extends JPanel {  
  5.  
  6.     public CS3_Linux_Sub() {
  7.         initComponents();
  8.     }
  9.                    
  10.     private void initComponents() {
  11.     }
  12. }
  13.  
  14. // Change from main( ) to constructor
  15. public class CS3_Linux {              
  16.     public CS3_Linux(){
  17.         JFrame frame = new JFrame();
  18.         frame.setContentPane(new CS3_Linux_Sub());
  19.         frame.pack();
  20.         frame.setVisible(true);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment