List of usage examples for java.awt Graphics drawOval
public abstract void drawOval(int x, int y, int width, int height);
From source file:MainClass.java
public void paint(Graphics g) { int w = getSize().width; int midW = w / 2; g.drawString("XOR Mode", 0, 30); g.drawOval(7, 37, 50, 50); g.setXORMode(Color.white);/* www. j a v a2 s . co m*/ for (int i = 0; i < 15; i += 3) { g.drawOval(10 + i, 40 + i, 50, 50); } g.setPaintMode(); g.drawString("Paint Mode", midW, 30); g.drawOval(midW + 7, 37, 50, 50); for (int i = 0; i < 15; i += 3) { g.drawOval(midW + 10 + i, 40 + i, 50, 50); } }
From source file:Main.java
public void paint(Graphics g) { int w = getSize().width; int midW = w / 2; g.drawString("XOR Mode", 0, 30); g.drawOval(7, 37, 50, 50); g.setXORMode(Color.white);/*ww w. j a v a 2 s .c o m*/ for (int i = 0; i < 15; i += 3) { g.drawOval(10 + i, 40 + i, 50, 50); } g.setPaintMode(); g.drawString("Paint Mode", midW, 30); g.drawOval(midW + 7, 37, 50, 50); for (int i = 0; i < 15; i += 3) { g.drawOval(midW + 10 + i, 40 + i, 50, 50); } }
From source file:FillRectPanel.java
public void paintComponent(Graphics g) { super.paintComponent(g); g.drawRect(10, 10, 80, 30);// ww w. j a v a2 s. c o m g.drawRoundRect(100, 10, 80, 30, 15, 15); g.drawOval(10, 100, 80, 30); g.setColor(Color.red); g.fillRect(10, 10, 80, 30); g.fillRoundRect(100, 10, 80, 30, 15, 15); int thickness = 4; g.fill3DRect(200, 10, 80, 30, true); for (int i = 1; i <= thickness; i++) g.draw3DRect(200 - i, 10 - i, 80 + 2 * i - 1, 30 + 2 * i - 1, true); g.fill3DRect(200, 50, 80, 30, false); for (int i = 1; i <= thickness; i++) g.draw3DRect(200 - i, 50 - i, 80 + 2 * i - 1, 30 + 2 * i - 1, true); g.fillOval(10, 100, 80, 30); }
From source file:EventQueuePanel.java
public void actionPerformed(ActionEvent evt) { Graphics g = getGraphics(); displayPrompt(g, "Click to chooose the first point"); Point p = getClick();/*from w ww. ja va 2 s .c om*/ g.drawOval(p.x - 2, p.y - 2, 4, 4); displayPrompt(g, "Click to choose the second point"); Point q = getClick(); g.drawOval(q.x - 2, q.y - 2, 4, 4); g.drawLine(p.x, p.y, q.x, q.y); displayPrompt(g, "Done! Press button the start again."); g.dispose(); }
From source file:Clock.java
private void drawStructure(Graphics g) { g.setFont(new Font("TimesRoman", Font.PLAIN, 14)); g.setColor(Color.blue);//from ww w.jav a 2 s.co m g.drawOval(xcenter - 50, ycenter - 50, 100, 100); g.setColor(Color.darkGray); g.drawString("9", xcenter - 45, ycenter + 3); g.drawString("3", xcenter + 40, ycenter + 3); g.drawString("12", xcenter - 5, ycenter - 37); g.drawString("6", xcenter - 3, ycenter + 45); }
From source file:Main.java
public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(Color.RED);/* w w w . j a v a 2 s . co m*/ if (c.isEnabled()) { g.fillOval(x, y, getIconWidth(), getIconHeight()); } else { g.drawOval(x, y, getIconWidth(), getIconHeight()); } }
From source file:PrintSampleApp.java
public void paint(Graphics g) { Dimension size = getSize();/*from w w w . j a v a 2s . co m*/ int width = size.width; int height = size.height; int x1 = (int) (width * 0.1); int x2 = (int) (width * 0.9); int y1 = (int) (height * 0.1); int y2 = (int) (height * 0.9); g.drawRect(x1, y1, x2 - x1, y2 - y1); g.drawOval(x1, y1, x2 - x1, y2 - y1); g.drawLine(x1, y1, x2, y2); g.drawLine(x2, y1, x1, y2); String text = "Print Me! "; text += text; text += text; g.drawString(text, x1, (int) ((y1 + y2) / 2)); g.dispose(); }
From source file:com.cburch.logisim.circuit.appear.AppearanceAnchor.java
@Override public void paint(Graphics g, HandleGesture gesture) { Location location = getLocation(); int x = location.getX(); int y = location.getY(); g.setColor(SYMBOL_COLOR);/* ww w. j a v a 2 s.co m*/ g.drawOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS); Location e0 = location.translate(facing, RADIUS); Location e1 = location.translate(facing, RADIUS + INDICATOR_LENGTH); g.drawLine(e0.getX(), e0.getY(), e1.getX(), e1.getY()); }
From source file:MainClass.java
public void print(Graphics g) { Font oldFont = g.getFont();// w ww. j a v a 2 s .c o m if (type == TEXT) { g.setFont(font); g.drawString(text, x, y); } else if (type == GRAPHICS) { if (shape.equals("LINE")) { g.drawLine(x, y, width, height); } else if (shape.equals("OVAL")) { g.drawOval(x, y, width, height); } else if (shape.equals("RECTANGLE")) { g.drawRect(x, y, width, height); } } g.setFont(oldFont); }
From source file:CopyAreaPerformance.java
private void drawSmiley(Graphics g, Color faceColor, int x, int y) { // fill face color g.setColor(faceColor);/*w ww . j a va 2s . c om*/ g.fillOval(x, y, SMILEY_SIZE, SMILEY_SIZE); g.setColor(Color.BLACK); // draw head g.drawOval(x, y, SMILEY_SIZE, SMILEY_SIZE); // draw smile g.drawArc(x + (int) ((SMILEY_SIZE * .2)), (int) (y + (SMILEY_SIZE * .2)), (int) (SMILEY_SIZE * .6), (int) (SMILEY_SIZE * .6), 200, 140); // draw eyes int eyeSize = Math.max(2, (int) (SMILEY_SIZE * .1)); g.fillOval(x + (int) ((SMILEY_SIZE * .5) - (SMILEY_SIZE * .1) - eyeSize), y + (int) (SMILEY_SIZE * .3), eyeSize, eyeSize); g.fillOval(x + (int) ((SMILEY_SIZE * .5) + (SMILEY_SIZE * .1)), y + (int) (SMILEY_SIZE * .3), eyeSize, eyeSize); }