Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SwingUtilities.invokeLater(new Runnable(){
- public void run(){
- }
- });
- JFrame frame = new JFrame ("lalala");
- frame.setSize(500, 400);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setVisible(true);
- //create a second jframe in defaultpackage
- advancejavapackage criar novo pacote java
- create new jframe
- //visual guide layout netbeans components
- //window builder netbeans
- //swing visual guide
- public MainFrame(String title) {
- super(title);
- // set layout manager
- setLayout(new BorderLayout());
- // create swing component
- JtextArea textArea = new JtextArea();
- Jbutton button = new JButtton("click me");
- // add swing component to content pane
- Container c = getContentPane();
- c.add(textArea, BorderLayout.CENTER);
- c.add(button, BoderLayout.SOUTH);
- //behaviour
- button.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- textArea.append("hello");
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement