Example usage for javax.swing JFrame add

List of usage examples for javax.swing JFrame add

Introduction

In this page you can find the example usage for javax.swing JFrame 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) {
    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice vc = env.getDefaultScreenDevice();
    JFrame window = new JFrame();
    JPanel comp = new JPanel();
    comp.setBackground(Color.RED);
    window.add(comp);
    window.setUndecorated(true);/*from w w w .j a v a 2  s.  c  o m*/
    window.setResizable(false);
    vc.setFullScreenWindow(window);
}

From source file:ResizeRectangle.java

public static void main(String[] args) {

    JFrame frame = new JFrame("Resize Rectangle");

    frame.add(new ResizeRectangle());
    frame.setSize(300, 300);/* w w w .  jav  a 2s . c  om*/
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:com.archivas.clienttools.arcmover.gui.panels.CopyOptionsPanel.java

public static void main(String[] args) {
    // just test this panel.
    CopyOptionsPanel p = new CopyOptionsPanel(null, new CopyJob());
    JFrame f = new JFrame();
    f.add(p);
    f.pack();/*  ww w. j  a  v a  2 s.  c  o m*/
    f.setLocation(100, 800);
    f.setSize(new Dimension(700, 500));
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Hello!!");
    frame.setAlwaysOnTop(true);//w ww.j  a  va  2s .  c  o m
    frame.setLocationByPlatform(true);
    frame.add(new JLabel("  Always visible"));
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Main");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(new Main());
    frame.setSize(200, 300);//from  w w w  .  j a  va2s  .c o m
    frame.setLocationByPlatform(true);
    frame.setVisible(true);
}

From source file:Translation.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Translation");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new Translation());
    frame.setSize(300, 200);/*from  ww w .  j av  a 2 s  .  c o  m*/
    frame.setVisible(true);
}

From source file:LinesDashes3.java

public static void main(String[] args) {
    LinesDashes3 lines = new LinesDashes3();
    JFrame frame = new JFrame("Lines");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(lines);
    frame.setSize(280, 270);//from ww  w .  j  a  va 2  s .  co  m
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

}

From source file:LinesDashes2.java

public static void main(String[] args) {
    LinesDashes2 lines = new LinesDashes2();
    JFrame frame = new JFrame("Lines");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(lines);
    frame.setSize(280, 270);//from w  ww  .j av a2 s  .c  o m
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

}

From source file:LinesDashes4.java

public static void main(String[] args) {
    LinesDashes4 lines = new LinesDashes4();
    JFrame frame = new JFrame("Lines");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(lines);
    frame.setSize(280, 270);//from  w  w  w. j av a2 s . c om
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    JComboBox<Object> combo = new JComboBox<>();
    URL url = new Main().getClass().getResource("animated.gif");
    combo.setModel(new DefaultComboBoxModel(new Object[] { makeImageIcon(url, combo, 0) }));

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(combo);
    f.setSize(320, 240);//from   www. ja  va 2  s.co m
    f.setVisible(true);
}