Example usage for java.awt Color RED

List of usage examples for java.awt Color RED

Introduction

In this page you can find the example usage for java.awt Color RED.

Prototype

Color RED

To view the source code for java.awt Color RED.

Click Source Link

Document

The color red.

Usage

From source file:Main.java

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

    JFrame frame = new JFrame();
    frame.add(label);//w w w . ja  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.red);

    JFrame frame = new JFrame();
    frame.add(label);/* ww w  .  j ava2s .c  om*/
    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[] argv) {
    LineBorder border = new LineBorder(Color.red);
    TitledBorder titledBorder = BorderFactory.createTitledBorder(border, "Title");
}

From source file:Main.java

public static void main(String[] argv) {
    JColorChooser chooser = new JColorChooser();

    // Set the selected color
    chooser.setColor(Color.red);

    // Get current selected color
    Color color = chooser.getColor();

}

From source file:Main.java

public static void main(String[] argv) {
    LineBorder border = new LineBorder(Color.red);
    TitledBorder titledBorder = BorderFactory.createTitledBorder(border, "Title");

    // Or: DEFAULT_JUSTIFICATION, LEFT, RIGHT
    titledBorder.setTitleJustification(TitledBorder.CENTER);
}

From source file:Main.java

public static void main(String[] argv) {
    LineBorder border = new LineBorder(Color.red);
    TitledBorder titledBorder = BorderFactory.createTitledBorder(border, "Title");

    // Or: DEFAULT_POSITION, ABOVE_TOP, TOP, ABOVE_BOTTOM, BOTTOM, BELOW_BOTTOM
    titledBorder.setTitlePosition(TitledBorder.BELOW_TOP);
}

From source file:UIDefaultsButton.java

License:asdf

public static void main(String[] args) {

    UIManager.put("Button.background", Color.BLACK);
    UIManager.put("Button.foreground", Color.RED);

    JFrame aWindow = new JFrame("This is a Border Layout");
    aWindow.setBounds(30, 30, 300, 300); // Size
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JButton bn = new JButton("asdf");
    aWindow.add(bn);//from w  ww  . java 2  s  .c  om
    aWindow.setVisible(true); // Display the window
}

From source file:Main.java

public static void main(final String[] args) {
    JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.getContentPane().setBackground(Color.red);
    frame.setPreferredSize(new Dimension(400, 300));
    frame.pack();//from  www  .  ja  v a2 s  . com
    frame.setVisible(true);
}

From source file:Main.java

License:asdf

public static void main(String[] argv) {
    LineBorder border1 = new LineBorder(Color.red);
    TitledBorder border2 = new TitledBorder("asdf");

    Border newBorder = BorderFactory.createCompoundBorder(border1, border2);
    JButton component = new JButton("button");
    component.setBorder(newBorder);// w w  w.j a v  a  2  s. c  om
}

From source file:Main.java

public static void main(String... args) throws Exception {
    JPanel panel = new JPanel();
    panel.setOpaque(true);/* w  w w.  j a v a 2s  . c  om*/
    panel.setBackground(Color.RED);

    java.net.URL url = new java.net.URL("http://www.java2s.com/style/download.png");
    ImageIcon image = new ImageIcon(url);
    JLabel label = new JLabel("LABEL", image, JLabel.RIGHT);
    panel.add(label);

    JOptionPane.showMessageDialog(null, panel, "Modified JOptionPane : ", JOptionPane.PLAIN_MESSAGE);
}