List of usage examples for java.awt Color BLACK
Color BLACK
To view the source code for java.awt Color BLACK.
Click Source Link
From source file:Main.java
public Main() { super("LayeredPane"); setSize(200, 150);// w w w . ja v a2 s . c o m setDefaultCloseOperation(EXIT_ON_CLOSE); JLayeredPane lp = getLayeredPane(); // Create 3 buttons JButton top = new JButton(); top.setBackground(Color.white); top.setBounds(20, 20, 50, 50); JButton middle = new JButton(); middle.setBackground(Color.gray); middle.setBounds(40, 40, 50, 50); JButton bottom = new JButton(); bottom.setBackground(Color.black); bottom.setBounds(60, 60, 50, 50); // Place the buttons in different layers lp.add(middle, new Integer(2)); lp.add(top, new Integer(3)); lp.add(bottom, new Integer(1)); }
From source file:Main.java
Panel() {
setBackground(Color.BLACK);
setForeground(Color.WHITE);
refreshScreen();
}
From source file:ShadowText.java
public void paint(Graphics g) { String text = "Hello World"; int x = 10;/* w w w. ja va2 s .co m*/ int y = 100; Font font = new Font("Georgia", Font.ITALIC, 50); Graphics2D g1 = (Graphics2D) g; TextLayout textLayout = new TextLayout(text, font, g1.getFontRenderContext()); g1.setPaint(new Color(150, 150, 150)); textLayout.draw(g1, x + 3, y + 3); g1.setPaint(Color.BLACK); textLayout.draw(g1, x, y); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Ellipse2D e1 = new Ellipse2D.Double(20.0, 20.0, 80.0, 70.0); Ellipse2D e2 = new Ellipse2D.Double(20.0, 70.0, 40.0, 40.0); Area a1 = new Area(e1); Area a2 = new Area(e2); a1.intersects(new Rectangle(20, 20, 300, 300)); g2.setColor(Color.orange);// w w w . j ava 2 s. c o m g2.fill(a1); g2.setColor(Color.black); g2.drawString("intersect", 20, 140); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Ellipse2D e1 = new Ellipse2D.Double(20.0, 20.0, 80.0, 70.0); Ellipse2D e2 = new Ellipse2D.Double(20.0, 70.0, 40.0, 40.0); Area a1 = new Area(e1); Area a2 = new Area(e2); a1.subtract(a2);//from www. j a va 2s. c o m a1.transform(new AffineTransform()); g2.setColor(Color.orange); g2.fill(a1); g2.setColor(Color.black); g2.drawString("subtract", 20, 140); }
From source file:PaintingAndStroking.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; double x = 15, y = 50, w = 70, h = 70; Ellipse2D e = new Ellipse2D.Double(x, y, w, h); GradientPaint gp = new GradientPaint(75, 75, Color.white, 95, 95, Color.gray, true); // Fill with a gradient. g2.setPaint(gp);/*w w w. ja va2s . c o m*/ g2.fill(e); // Stroke with a solid color. e.setFrame(x + 100, y, w, h); g2.setPaint(Color.black); g2.setStroke(new BasicStroke(8)); g2.draw(e); // Stroke with a gradient. e.setFrame(x + 200, y, w, h); g2.setPaint(gp); g2.draw(e); }
From source file:MyCanvas.java
public void draw(Graphics g) { Graphics2D g2 = (Graphics2D) g; // Draw the pie chart Arc2D.Float arc = new Arc2D.Float(Arc2D.PIE); arc.setFrame(140, 200, 67, 46);/*from w ww .j a v a 2s . c om*/ arc.setAngleStart(45); arc.setAngleExtent(270); g2.setColor(Color.gray); g2.draw(arc); g2.setColor(Color.red); g2.fill(arc); g2.setColor(Color.black); g2.drawString("Arc2D.PIE", 140, 190); }
From source file:Main.java
public Main() { setSize(300, 100);//from w w w . j a v a2 s.c om UIManager.put("ProgressBar.selectionBackground", Color.black); UIManager.put("ProgressBar.selectionForeground", Color.white); UIManager.put("ProgressBar.foreground", new Color(8, 32, 128)); progressBar = new JProgressBar(); progressBar.setMinimum(minValue); progressBar.setMaximum(maxValue); progressBar.setStringPainted(true); JButton start = new JButton("Start"); start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread runner = new Thread() { public void run() { counter = minValue; while (counter <= maxValue) { Runnable runme = new Runnable() { public void run() { progressBar.setValue(counter); } }; SwingUtilities.invokeLater(runme); counter++; try { Thread.sleep(100); } catch (Exception ex) { } } } }; runner.start(); } }); getContentPane().add(progressBar, BorderLayout.CENTER); getContentPane().add(start, BorderLayout.WEST); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }
From source file:ColorComboRenderer.java
public ColorComboRenderer() { super();/* w w w . ja v a2 s . co m*/ setBorder(new CompoundBorder(new MatteBorder(2, 10, 2, 10, Color.white), new LineBorder(Color.black))); }
From source file:Main.java
public Main() { getContentPane().setLayout(new FlowLayout()); JLabel labelTwo = new JLabel("www.java2s.com"); labelTwo.setBorder(BorderFactory.createEtchedBorder()); add(labelTwo);// www . j a v a2s . c o m JLabel labelFour = new JLabel("TitledBorder"); labelFour.setBorder(BorderFactory.createTitledBorder( BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink), "Title", TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM, new Font("font name", Font.BOLD, 19), Color.BLACK)); add(labelFour); }