List of usage examples for java.awt Color RED
Color RED
To view the source code for java.awt Color RED.
Click Source Link
From source file:Main.java
public static void main(String args[]) { Main t = new Main(); JPanel mainPanel = new JPanel(new BorderLayout()); JLabel l = new JLabel("hello world"); l.setOpaque(true);//from ww w.j a v a 2 s . co m l.setBackground(Color.RED); JPanel extraPanel = new JPanel(new FlowLayout()); l.setPreferredSize(new Dimension(100, 100)); extraPanel.setBackground(Color.GREEN); extraPanel.add(l); mainPanel.add(extraPanel, BorderLayout.CENTER); t.setContentPane(mainPanel); t.setDefaultCloseOperation(EXIT_ON_CLOSE); t.setSize(400, 200); t.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("UIDefaults Example"); frame.setDefaultCloseOperation(3);/*from w ww .ja v a 2 s. co m*/ Container c = frame.getContentPane(); UIManager.put("Button.background", Color.red); UIManager.put("Button.foreground", Color.white); Font f = new Font("Serif", Font.ITALIC, 24); UIManager.put("Button.font", f); JButton north = new JButton("North"); JButton south = new JButton("South"); JButton east = new JButton("East"); JButton west = new JButton("West"); JButton center = new JButton("Center"); c.add(north, BorderLayout.NORTH); c.add(south, BorderLayout.SOUTH); c.add(east, BorderLayout.EAST); c.add(west, BorderLayout.WEST); c.add(center, BorderLayout.CENTER); frame.pack(); frame.show(); }
From source file:ABevelBorderLoweredBevelBorderRAISED.java
public static void main(String args[]) { JFrame frame = new JFrame("Bevel Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED); // Border myLoweredBorder = BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.PINK, // Color.RED); JButton button = new JButton("Raised"); button.setBorder(myRaisedBorder);/* w w w . ja v a2 s . co m*/ frame.add(button); frame.setSize(300, 100); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame(); Container contentPane = frame.getContentPane(); Icon normalIcon = new TriangleIcon(Color.red, TriangleIcon.State.NORMAL); Icon pressedIcon = new TriangleIcon(Color.red, TriangleIcon.State.PRESSED); Icon rolloverIcon = new TriangleIcon(Color.red, TriangleIcon.State.ROLLOVER); JButton b = new JButton("Button", normalIcon); b.setPressedIcon(pressedIcon);// w ww .j a v a 2 s .com b.setRolloverIcon(rolloverIcon); b.setRolloverEnabled(true); contentPane.add(b, BorderLayout.NORTH); frame.setSize(300, 100); frame.show(); }
From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame("Justified Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED, Color.PINK, Color.RED); JButton myRaisedButton = new JButton("My Raised"); myRaisedButton.setBorder(myRaisedBorder); Container contentPane = frame.getContentPane(); contentPane.add(myRaisedButton);// www .ja v a 2 s.c om frame.setSize(300, 200); frame.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Justified Titled Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border myRaisedBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.PINK, Color.RED); JButton myRaisedButton = new JButton("My Raised"); myRaisedButton.setBorder(myRaisedBorder); Container contentPane = frame.getContentPane(); contentPane.add(myRaisedButton);/*from ww w . j a va 2s . co m*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { SplashScreen splash = SplashScreen.getSplashScreen(); Graphics2D g = (Graphics2D) splash.createGraphics(); Dimension dim = splash.getSize(); for (int i = 0; i < 100; i++) { g.setColor(Color.RED); g.fillRect(50, 50, dim.width - 100, dim.height - 100); splash.update();/*from w ww. j av a 2 s. c o m*/ try { Thread.sleep(250); } catch (InterruptedException ignored) { } } JFrame frame = new JFrame("Splash Me2"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Hello, Splash", JLabel.CENTER); frame.add(label, BorderLayout.CENTER); frame.setSize(300, 95); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextPane editorPane = new JTextPane(); editorPane.setSelectedTextColor(Color.red); // set content as html // editorPane.setContentType("text/html"); editorPane.setText("<p color='#FF0000'>Cool!</p>"); // added <u></u> to underlone button JButton label = new JButton("button"); label.setAlignmentY(0.85f);// www. j av a2 s . co m label.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger() || e.getButton() == MouseEvent.BUTTON1) { JOptionPane.showMessageDialog(null, "Hello!"); } } }); editorPane.insertComponent(label); frame.getContentPane().add(editorPane); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { BufferedImage bi;// ww w . jav a 2 s . co m bi = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); Graphics g = bi.getGraphics(); for (int i = 0; i < NUM_ITER; i++) { g.setColor(Color.RED); g.drawLine(1, 2, i, i + 1); } g.dispose(); ImageIO.write(bi, "gif", new File("image.gif")); }
From source file:IconInterfaceDemo.java
public static void main(String[] a) { JFrame mainFrame = new JFrame(); JLabel label = new JLabel("label"); label.setIcon(new ColoredSquare(Color.green)); label.setDisabledIcon(new ColoredSquare(Color.red)); mainFrame.getContentPane().add(label); mainFrame.setSize(100, 100);//from w w w .jav a 2 s . c o m mainFrame.setVisible(true); }