Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Frame extends JFrame
- {
- JButton copy;
- JPanel p;
- public Frame()
- {
- super("");
- setDefaultCloseOperation(EXIT_ON_CLOSE);
- setSize(500, 500);
- p = new JPanel();
- copy = new JButton("Copy");
- copy.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent arg0)
- {
- p.add(new JButton("Added"));
- revalidate();
- }
- });
- p.add(copy);
- add(p);
- setVisible(true);
- }
- public static void main(String[] args)
- {
- Frame f = new Frame();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement