Example usage for java.awt Container add

List of usage examples for java.awt Container add

Introduction

In this page you can find the example usage for java.awt Container add.

Prototype

public Component add(Component comp) 

Source Link

Document

Appends the specified component to the end of this container.

Usage

From source file:Main.java

public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container content = aWindow.getContentPane();
    content.add(new MouseMotionAdapterDemo());
    aWindow.setVisible(true);//w ww  .  j  a v  a  2s. co m
}

From source file:Main.java

public static void main(String[] args) {
    JFrame jf = new JFrame();
    Container cp = jf.getContentPane();
    MyCanvas tl = new MyCanvas();
    cp.add(tl);
    jf.setSize(300, 200);/*from  ww  w .  j  av  a2 s .co m*/
    jf.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] args) {
    JFrame jf = new JFrame("Demo");
    Container cp = jf.getContentPane();
    MyCanvas tl = new MyCanvas();
    cp.add(tl);
    jf.setSize(300, 200);//w ww .j  a v a  2s.c  o  m
    jf.setVisible(true);
}

From source file:MainClass.java

public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container content = aWindow.getContentPane();
    content.add(new SpringLayoutPanel());
    aWindow.setVisible(true);/*from  w  ww .ja v a2 s  . c o  m*/
}

From source file:Main.java

public static void main(String[] av) {

    JFrame frame = new JFrame();
    Container cp = frame.getContentPane();
    cp.add(new DriveTree(new File(".")));
    frame.pack();// w w w .  j av  a  2s.c o  m
    frame.setVisible(true);
    frame.setSize(300, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:FillPolyPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("FillPoly");
    frame.setSize(300, 200);//  www .ja va 2 s  .  co  m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new FillPolyPanel());

    frame.show();
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setSize(300, 200);//  ww w. j av a  2 s . co m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    Container contentPane = frame.getContentPane();
    contentPane.add(new Main());

    frame.setVisible(true);
}

From source file:FontPanel.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("NotHelloWorld2");
    frame.setSize(350, 200);/*from www .j av a 2 s . c o m*/
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    Container contentPane = frame.getContentPane();
    contentPane.add(new FontPanel());

    frame.show();
}

From source file:Main.java

public static void main(String[] args) {
    JFrame aWindow = new JFrame();
    aWindow.setBounds(200, 200, 200, 200);
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container content = aWindow.getContentPane();
    content.add(new GridBagLayoutPanel());
    aWindow.setVisible(true);/*w w w  .  ja  v a 2s .  c  o  m*/
}

From source file:MulticastEvent.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setTitle("MulticastTest");
    frame.setSize(300, 200);//from   w ww  .  ja v  a2 s  .  c o m
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    Container contentPane = frame.getContentPane();
    contentPane.add(new MulticastEvent());

    frame.show();
}