protected void paintComponent(Graphics g2) { super.paintComponent(g2); Graphics2D g = (Graphics2D) g2; test.draw(g2, 0, 0); // Shape triangle = new Polygon(new int[] {15, 20, 10}, new int[] {0, 10, 10}, 3); Shape square = new Rectangle2D.Double(0, 0, 30, 30); g.setColor(Color.white); g.translate(20, 20); // g.rotate(theta, 10, 10); // g.fill(star); // g.setColor(new Color(0, 86, 141)); // g.fill(square); if (star2 != null) g.fill(star2); // Graphics2D g3 = (Graphics2D) g; // 3.fill(star); // g.setStroke(new BasicStroke(1)); // g.translate(x, y); // g.draw(line); // g.draw(line2); }
/** Draws the overlay with its associated graphic objects. */ @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); synchronized (mLock) { if ((mPreviewWidth != 0) && (mPreviewHeight != 0)) { mWidthScaleFactor = (float) canvas.getWidth() / (float) mPreviewWidth; mHeightScaleFactor = (float) canvas.getHeight() / (float) mPreviewHeight; } for (Graphic graphic : mGraphics) { graphic.draw(canvas); } } }
void scroll() { image.draw(); }
public void draw() { if (image == null) { image = new Image(filename); } image.draw(); }