Example usage for java.awt Color BLACK

List of usage examples for java.awt Color BLACK

Introduction

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

Prototype

Color BLACK

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

Click Source Link

Document

The color black.

Usage

From source file:Main.java

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

    JFrame frame = new JFrame();
    frame.add(label);/*from w w w.  j  a  v  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) {
    JLabel label = new JLabel("First Name");
    label.setForeground(Color.BLACK);

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

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  w  w. j av  a 2 s. c o m
    aWindow.setVisible(true); // Display the window
}

From source file:Main.java

public static void main(String[] argv) {
    LineBorder lineBorder = (LineBorder) BorderFactory.createLineBorder(Color.black);
    JLabel component = new JLabel("label");
    component.setBorder(lineBorder);//from   w ww  . jav  a  2 s. c  o m

}

From source file:Main.java

public static void main(String[] args) {

    JLabel label = new JLabel("java2s.com", JLabel.LEFT);
    Border border = BorderFactory.createLineBorder(Color.BLACK);
    label.setBorder(border);//from  ww w.java  2 s.c  o  m

    JOptionPane.showMessageDialog(null, label);

}

From source file:MainClass.java

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

    Border roundedBorder = new LineBorder(Color.BLACK, 12, true);

    JButton roundedButton = new JButton("Rounded 12 Pixel");
    roundedButton.setBorder(roundedBorder);

    Container contentPane = frame.getContentPane();
    contentPane.add(roundedButton, BorderLayout.SOUTH);
    frame.pack();/*from  w ww . j  ava  2 s. c o  m*/
    frame.setSize(300, frame.getHeight());
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    Integer[][] data = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
    String[] cols = { "A", "B", "C" };

    JTable table = new JTable(data, cols);

    JTableHeader header = table.getTableHeader();
    header.setBackground(Color.black);
    header.setForeground(Color.yellow);

    JOptionPane.showMessageDialog(null, new JScrollPane(table));
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    BufferedImage img = new BufferedImage(20, 20, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = img.createGraphics();
    g.setColor(Color.white);//  ww  w .ja  va  2 s. c  om
    g.fillRect(0, 0, 20, 20);
    g.setColor(Color.black);
    g.fillRect(5, 5, 10, 10);

    Color[] mapping = new Color[] { Color.black, Color.white, // replace black with white 
            Color.white, Color.green // and white with green
    };

    ImageIO.write(img, "png", new File("original.png"));
    swapColors(img, mapping);
    ImageIO.write(img, "png", new File("swapped.png"));
}

From source file:Main.java

public static void main(String args[]) {
    JFrame f = new JFrame("Label Demo");
    f.setLayout(new FlowLayout());
    f.setSize(200, 360);/*from w w w  .j  a v  a  2 s.c o  m*/
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLabel label = new JLabel("A default label");
    Border border = BorderFactory.createLineBorder(Color.BLACK);
    label.setBorder(border);
    f.add(label);

    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    final int width = 512;
    final int height = 512;
    BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
    Graphics g = img.getGraphics();
    g.setColor(Color.black);
    g.fillRect(0, 0, width, height);/*w  w w .ja v  a  2  s. co  m*/
    g.setColor(Color.white);
    final double A = 8;
    final double B = 0.5;
    final double N = 4;
    final double scale = 128;
    final double zoom = 50;
    final double step = 1 / scale;
    Point last = null;
    final Point origin = new Point(width / 2, height / 2);

    for (double t = 0; t <= 2 * Math.PI; t += step) {
        final double r = zoom * polarFunction(t, A, B, N);
        final int x = (int) Math.round(r * Math.cos(t));
        final int y = (int) Math.round(r * Math.sin(t));
        Point next = new Point(x, y);
        if (last != null) {
            g.drawLine(origin.x + last.x, origin.y + last.y, origin.x + next.x, origin.y + next.y);
        }
        last = next;
    }

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new JLabel(new ImageIcon(img)));
    frame.pack();
    frame.setVisible(true);
}