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) {
    Color myColor = new Color(0XFFFFFFFF, true);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);/*  w  w  w  . j  a v a 2 s  .c o m*/

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    Color myColor = Color.RED;

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor.darker());

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);//from   w w  w  .java  2  s.  c o  m
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    Color myColor = new Color(0XFFFFFF);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);/*from   w w  w  .j av a2s .  c o  m*/

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    Color myBlack = new Color(0, 0, 0, 120); // Color black

    JLabel label = new JLabel("First Name");
    label.setForeground(myBlack);//  w  ww .j av a2s  . c o  m

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    Color myColor = Color.RED;

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor.brighter());

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);/* w  w w .ja v a 2 s .  c om*/
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    Color myColor = Color.decode("0XFFFFFF");

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);/*from ww  w  .ja  va 2 s .  c  om*/

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    Color myColor = new Color(0.1F, 0.2F, 0.3F);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);/*from   w w w  .ja v  a  2  s.  c  om*/

    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);
    frame.setVisible(true);

}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.add(new Main());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20, 20, 500, 500);/*w  w  w . j  a  v  a  2  s  .c  o m*/
    frame.setVisible(true);
}

From source file:BasicDraw.java

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.add(new MyComponent());
    frame.setSize(300, 300);//  w ww . j  a  v a 2 s  . com
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JButton component = new JButton("a");
    component.addFocusListener(new MyFocusListener());

    JFrame f = new JFrame();
    f.add(component);
    f.pack();/*ww w  . j a  v  a 2s.co m*/
    f.setVisible(true);

}