List of usage examples for java.awt Graphics setColor
public abstract void setColor(Color c);
From source file:Main.java
@Override public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(color); g.fillOval(x, y, w, h);/*from w ww .j a v a2 s .c om*/ }
From source file:Main.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(color); g.fillArc(x, y, getIconWidth(), getIconHeight(), 45, 270); }
From source file:Main.java
@Override public void paintComponent(Graphics g) { g.setColor(Color.getHSBColor(new Random().nextFloat(), 1, 1)); g.fillRect(0, 0, getWidth(), getHeight()); }
From source file:Main.java
@Override protected void paintComponent(Graphics g) { Rectangle clip = g.getClipBounds(); g.setColor(new Color(new Random().nextInt())); g.fillRect(clip.x, clip.y, clip.width, clip.height); }
From source file:Main.java
public void paint(Graphics g) { g.setColor(Color.BLUE); g.drawString(name, 0, 0); }
From source file:Main.java
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.red); g.drawLine(0, 0, getWidth(), getHeight()); g.drawLine(getWidth(), 0, 0, getHeight()); }
From source file:Main.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(cl); g.drawString("java2s.com", 0, 20); }
From source file:CenterTextRectangle.java
public void paint(Graphics g) { Dimension d = this.getSize(); g.setColor(Color.white); g.fillRect(0, 0, d.width, d.height); g.setColor(Color.black);/*ww w.ja v a 2 s . c o m*/ g.setFont(f); drawCenteredString("This is centered.", d.width, d.height, g); g.drawRect(0, 0, d.width - 1, d.height - 1); }
From source file:TabPanelwithImageIconCustom.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(Color.black); g.fillRect(x + 4, y + 4, getIconWidth() - 8, getIconHeight() - 8); g.setColor(Color.cyan);//from w w w. j a v a 2 s . c o m g.fillRect(x + 6, y + 6, getIconWidth() - 12, getIconHeight() - 12); }
From source file:XORPanel.java
public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.red); g.fillRect(10, 10, 80, 30);//w w w.j a va 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); }