Example usage for java.awt Color YELLOW

List of usage examples for java.awt Color YELLOW

Introduction

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

Prototype

Color YELLOW

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

Click Source Link

Document

The color yellow.

Usage

From source file:Main.java

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

    JFrame frame = new JFrame();
    frame.add(label);//from 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.YELLOW);

    JFrame frame = new JFrame();
    frame.add(label);/*from   ww 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[] argv) throws Exception {
    JTabbedPane pane = new JTabbedPane();
    pane.setForeground(Color.YELLOW);
    pane.setBackground(Color.MAGENTA);
    String label = "Tab Label";
    pane.addTab(label, new JButton("Button"));

    int index = pane.getTabCount() - 1;

    pane.setForegroundAt(index, Color.ORANGE);
    pane.setBackgroundAt(index, Color.GREEN);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame("Fixed size content");
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Container c = f.getContentPane();
    c.setBackground(Color.YELLOW);

    Dimension d = new Dimension(400, 40);
    c.setPreferredSize(d);/*  www  . ja va 2 s.  c o m*/
    f.pack();
    f.setResizable(false);
    f.setVisible(true);
}

From source file:Main.java

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

    JProgressBar bar = new JProgressBar(JProgressBar.VERTICAL);
    bar.setEnabled(true);//w w w.j ava2  s .  co m

    bar.setBackground(Color.YELLOW);
    bar.setForeground(Color.GREEN);

    bar.setStringPainted(true);
    bar.setString("2000 g");
    bar.setValue(65);
    frame.setLayout(new BorderLayout());
    frame.add(bar, BorderLayout.CENTER);
    frame.setSize(500, 400);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame("This is BOX LAYOUT");
    JPanel panel1 = new JPanel();
    panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));
    panel1.setBackground(Color.yellow);

    JPanel panel2 = new JPanel();
    panel2.setLayout(new FlowLayout());
    panel2.setBackground(Color.ORANGE);

    for (int i = 0; i < 5; i++)
        panel1.add(new JCheckBox("CheckBox " + (i + 1)));

    f.add(panel1, BorderLayout.WEST);
    f.add(panel2, BorderLayout.CENTER);
    f.setVisible(true);// www  . j a v a 2  s. c  o  m
    f.setSize(300, 300);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    Object elements[][] = { { new Font("Courier", Font.BOLD, 16), Color.YELLOW, "This" },
            { new Font("Helvetica", Font.ITALIC, 8), Color.DARK_GRAY, "Computer" } };

    JFrame frame = new JFrame("Complex Renderer");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JList jlist = new JList(elements);
    ListCellRenderer renderer = new ComplexCellRenderer();
    jlist.setCellRenderer(renderer);/* www.  ja  v  a  2 s  .  c om*/
    JScrollPane scrollPane = new JScrollPane(jlist);
    frame.add(scrollPane, BorderLayout.CENTER);

    frame.setSize(300, 200);
    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[] argv) {
    JTable table = new JTable() {
        public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
            Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
            if (rowIndex % 2 == 0 && !isCellSelected(rowIndex, vColIndex)) {
                c.setBackground(Color.yellow);
            } else {
                c.setBackground(getBackground());
            }/*from  www.  j av  a2s. c  o  m*/
            return c;
        }
    };
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    int size = 120;
    int pad = 10;
    BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
    Graphics g = bi.createGraphics();
    g.setColor(Color.WHITE);/*ww w .  j ava2s  .c  o m*/
    g.fillRect(0, 0, size, size);
    g.setColor(Color.YELLOW);
    g.fillOval(pad, pad, size - (2 * pad), size - (2 * pad));
    g.dispose();

    BufferedImage image2 = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_BYTE_GRAY);

    ColorConvertOp op = new ColorConvertOp(bi.getColorModel().getColorSpace(),
            image2.getColorModel().getColorSpace(), null);
    op.filter(bi, image2);
    ImageIO.write(image2, "png", new File("c:/Java_Dev/image2.png"));
}