Example usage for javax.swing JFrame setBounds

List of usage examples for javax.swing JFrame setBounds

Introduction

In this page you can find the example usage for javax.swing JFrame setBounds.

Prototype

public void setBounds(int x, int y, int width, int height) 

Source Link

Document

The width or height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

Usage

From source file:Main.java

public static void main(String[] args) {
    JLabel label = new JLabel("First Name");
    label.setForeground(Color.darkGray);

    JFrame frame = new JFrame();
    frame.add(label);/* ww w.  j  a v a 2  s. c o  m*/
    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) {
    JLabel label = new JLabel("First Name");
    label.setForeground(Color.GREEN);

    JFrame frame = new JFrame();
    frame.add(label);// w  w w.java  2 s  . c  o  m
    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(0XFFFFFFFF, true);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);/*from ww w.  j a va2  s.co 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);/*from w w w. ja va2 s.  c  o m*/
    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(0XFFFFFF);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);//from   w ww .  ja  v  a  2s .  co 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);//from  w  w w.  jav  a2 s.  co 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);//from  w  w  w  .  j av a  2s  .c o  m
    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.decode("0XFFFFFF");

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);/*from   w w  w .  ja 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 = new Color(0.1F, 0.2F, 0.3F);

    JLabel label = new JLabel("First Name");
    label.setForeground(myColor);//from   ww w .  j a  v a2 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 myBlack = new Color(0, 0, 0, 0.5F); // Color black
    //  Color myWhite = new Color(255,255,255);     // Color white
    //  Color myGreen = new Color(0,200,0);         // A shade of green

    JLabel label = new JLabel("First Name");
    label.setForeground(myBlack);//from  w  ww . j a  va  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);

}