Advertisement
buzzonit

ADVANCE JAVA

Mar 22nd, 2016
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1.       SwingUtilities.invokeLater(new Runnable(){
  2.               public void run(){
  3.         }
  4.         });
  5.        
  6.         JFrame frame = new JFrame ("lalala");
  7.         frame.setSize(500, 400);
  8.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  9.         frame.setVisible(true);
  10.  
  11. //create a second jframe in defaultpackage
  12. advancejavapackage criar novo pacote java
  13. create new jframe
  14. //visual guide layout netbeans components
  15. //window builder netbeans
  16. //swing visual guide
  17.  
  18. public MainFrame(String title) {
  19.  super(title);
  20. // set layout manager
  21. setLayout(new BorderLayout());
  22.  
  23. // create swing component
  24. JtextArea textArea = new JtextArea();
  25. Jbutton button = new JButtton("click me");
  26.  
  27. // add swing component to content pane
  28. Container c = getContentPane();
  29.  
  30. c.add(textArea, BorderLayout.CENTER);
  31. c.add(button, BoderLayout.SOUTH);
  32.  
  33. //behaviour
  34. button.addActionListener(new ActionListener()  {
  35.  
  36. @Override
  37. public void actionPerformed(ActionEvent e) {
  38.       textArea.append("hello");
  39.  
  40. });
  41.  
  42.   }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement