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 void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getPoint2()); g2d.setPaint(gp1);//from w w w .j a v a 2s .com g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.getPoint1()); g2d.setPaint(gp1);//from ww w. ja v a 2 s . c o m g2d.fillRect(20, 20, 300, 40); }
From source file:Main.java
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; GradientPaint gp1 = new GradientPaint(5, 5, Color.red, 20, 20, Color.yellow, true); System.out.println(gp1.isCyclic()); g2d.setPaint(gp1);/*from www . j av a 2 s. co m*/ g2d.fillRect(20, 20, 300, 40); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Ellipse2D e1 = new Ellipse2D.Double(20.0, 20.0, 80.0, 70.0); g2.setColor(Color.red); g2.fill(e1);// w w w. j ava2 s . c o m }
From source file:Points.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.red); for (int i = 0; i <= 100000; i++) { Dimension size = getSize(); int w = size.width; int h = size.height; Random r = new Random(); int x = Math.abs(r.nextInt()) % w; int y = Math.abs(r.nextInt()) % h; g2d.drawLine(x, y, x, y);//w w w. ja v a 2s .co m } }
From source file:MainClass.java
public void paint(Graphics g) { Dimension d = this.getPreferredSize(); int fontSize = 20; g.setFont(new Font("TimesRoman", Font.PLAIN, fontSize)); g.setColor(Color.red); g.drawString("www.java2s.com", 10, 20); }
From source file:Main.java
public void paint(Graphics g) { int w = getSize().width; int h = getSize().height; Ellipse2D e = new Ellipse2D.Float(w / 4.0f, h / 4.0f, w / 2.0f, h / 2.0f); g.setClip(e);//w ww . ja va 2s .c o m g.setColor(Color.red); g.fillRect(0, 0, w, h); }
From source file:MainClass.java
public static void pictureBackdrop(float x, float y, PdfContentByte cb, PdfWriter writer) { PdfShading axial = PdfShading.simpleAxial(writer, x, y, x + 200, y, Color.yellow, Color.red); PdfShadingPattern axialPattern = new PdfShadingPattern(axial); cb.setShadingFill(axialPattern);/*from ww w .j a v a 2s . co m*/ cb.setColorStroke(Color.black); cb.setLineWidth(2); cb.rectangle(x, y, 200, 200); cb.fillStroke(); }
From source file:Main.java
public Main() { childPanel1.setBackground(Color.red); childPanel1.setPreferredSize(new Dimension(300, 40)); childPanel2.setBackground(Color.blue); childPanel2.setPreferredSize(new Dimension(300, 40)); childPanel3.setBackground(Color.yellow); childPanel3.setPreferredSize(new Dimension(300, 40)); JButton myButton = new JButton("Add Component "); myButton.addActionListener(e -> { add(childPanel2, BorderLayout.CENTER); pack();/*from w w w. j ava2s. c o m*/ }); setLocation(10, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(childPanel3, BorderLayout.CENTER); add(myButton, BorderLayout.SOUTH); pack(); setVisible(true); }
From source file:XORPanel.java
public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.red); g.fillRect(10, 10, 80, 30);/*from ww w . ja v a 2 s . c om*/ g.setColor(Color.green); g.fillRect(50, 20, 80, 30); g.setColor(Color.blue); g.fillRect(130, 40, 80, 30); g.setXORMode(Color.green); g.fillRect(90, 30, 80, 30); }