List of usage examples for java.awt Graphics setColor
public abstract void setColor(Color c);
From source file:DrawRectPanel.java
public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.blue); g.drawRect(10, 10, 80, 30);/*from w ww . ja v a2 s. c o m*/ g.drawRoundRect(100, 10, 80, 30, 15, 15); int thickness = 4; for (int i = 0; i <= thickness; i++) g.draw3DRect(200 - i, 10 - i, 80 + 2 * i, 30 + 2 * i, true); for (int i = 0; i < thickness; i++) g.draw3DRect(200 - i, 50 - i, 80 + 2 * i, 30 + 2 * i, false); g.drawOval(10, 100, 80, 30); }
From source file:DiamondIcon.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(color); g.drawRect(0, 0, 20, 20);/*ww w. ja va 2 s . c om*/ }
From source file:Main.java
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.RED); g.fillOval(x, y - radius, radius * 2, radius * 2); }
From source file:Main.java
public void paintComponent(Graphics g) { g.setColor(Color.black); g.fillRect(0, 0, getWidth(), getHeight()); }
From source file:SmoothMove.java
public void paintOffscreen(Graphics g) { int s = 100; g.setColor(Color.blue); g.fillRect(mX - s / 2, mY - s / 2, s, s); }
From source file:Main.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(Color.RED); if (c.isEnabled()) { g.fillOval(x, y, getIconWidth(), getIconHeight()); } else {/*from w w w . j ava 2 s . co m*/ g.drawOval(x, y, getIconWidth(), getIconHeight()); } }
From source file:ButtonwithImageIcon.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(Color.black); g.fillRect(x, y, getIconWidth(), getIconHeight()); g.setColor(color);// w w w . j a va2 s . co m g.fillRect(x + borderWidth, y + borderWidth, getIconWidth() - 2 * borderWidth, getIconHeight() - 2 * borderWidth); }
From source file:Main.java
public void paintComponent(Graphics g) { int width = getWidth(); int height = getHeight(); g.setColor(Color.black); g.drawOval(0, 0, width, height);//from w ww. ja va 2 s . c o m }
From source file:SmoothMove.java
public void paint(Graphics g) { // Clear the offscreen image. Dimension d = getSize();// w w w .j a va2 s. c om checkOffscreenImage(); Graphics offG = mImage.getGraphics(); offG.setColor(getBackground()); offG.fillRect(0, 0, d.width, d.height); // Draw into the offscreen image. paintOffscreen(mImage.getGraphics()); // Put the offscreen image on the screen. g.drawImage(mImage, 0, 0, null); }
From source file:Main.java
@Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.blue); g.fillRect(TILE, TILE, 3 * TILE, 3 * TILE); }