public void paint(Graphics g) { if (isVisible()) { try { JTextComponent component = getComponent(); Rectangle r = component.getUI().modelToView(component, getDot()); Color c = g.getColor(); g.setColor(component.getBackground()); g.setXORMode(component.getCaretColor()); r.setBounds(r.x, r.y, g.getFontMetrics().charWidth('w'), g.getFontMetrics().getHeight()); g.fillRect(r.x, r.y, r.width, r.height); g.setPaintMode(); g.setColor(c); } catch (BadLocationException e) { e.printStackTrace(); } } }
g.setXORMode(comp.getBackground());
textAreaBg = Color.white; g.setXORMode(textAreaBg); textAreaBg = Color.white; g.setXORMode(textAreaBg); int y = r.y + r.height; g.drawLine(r.x,y, r.x+r.width-1,y);
public void paint(Graphics g) { g.setXORMode(Color.white); g.drawImage(image,0, 0, this); super.paint(g); }
public void paint(Graphics g) { g.setXORMode(Color.black); // draw old rect if there is one. this will erase it // draw new rect, this will draw xored g.setDrawMode(); // restore normal draw mode }
@Override public void paintComponent(Graphics _g) { if (pointDeb_ == null|| pointFinPrec_==null) { return; } _g.setXORMode(getBackground()); _g.setColor(Color.black); _g.drawLine(pointDeb_.x, pointDeb_.y, pointFinPrec_.x, pointDeb_.y); _g.drawLine(pointFinPrec_.x, pointDeb_.y, pointFinPrec_.x, pointFinPrec_.y); _g.drawLine(pointFinPrec_.x, pointFinPrec_.y, pointDeb_.x, pointFinPrec_.y); _g.drawLine(pointDeb_.x, pointFinPrec_.y, pointDeb_.x, pointDeb_.y); }
public void paint(Graphics g) { g.setXORMode(Color.white); //Color of line varies for (DragItem elem : allItems) { elem.paint(g); } }
Graphics g = box.getGraphics(); g.clearRect(0, 0, box.getWidth(), box.getHeight()); // this should do it g.setXORMode(box.getBackground());
public synchronized void paintComponent(Graphics g) { super.paintComponent(g); // Retry to inizilize image if(bImage==null) this.initImage(); // Repaint image if(bImage!=null) g.drawImage(bImage,0,0,Color.BLACK,null); if(enableCursor) { g.setColor(Color.YELLOW); g.setXORMode(Color.BLUE); g.drawLine(cursorX-5,cursorY,cursorX+5,cursorY); g.drawLine(cursorX,cursorY-5,cursorX,cursorY+5); } }
private void drawRect(JComponent c, int x, int y, boolean bx, boolean by) { _xdraw = x; _ydraw = y; int xmin = bx?min(_xbegin,_xdraw):-1; int xmax = bx?max(_xbegin,_xdraw):c.getWidth(); int ymin = by?min(_ybegin,_ydraw):-1; int ymax = by?max(_ybegin,_ydraw):c.getHeight(); Graphics g = c.getGraphics(); g.setColor(Color.RED); g.setXORMode(c.getBackground()); g.drawRect(xmin,ymin,xmax-xmin,ymax-ymin); g.dispose(); } }
private Graphics getBandGraphics() { Graphics g = panel().getGraphics(); g.setColor(AppConstants.BAND_CLR); g.setXORMode(Color.white); return g; }
public void dragFrame(JComponent f, int newX, int newY) { if (dragMode == OUTLINE_DRAG_MODE) { JDesktopPane desktopPane = getDesktopPane(f); if (desktopPane != null) { Graphics g = desktopPane.getGraphics(); g.setXORMode(Color.white); if (currentLoc != null) { g.drawRect(currentLoc.x, currentLoc.y, f.getWidth() - 1, f.getHeight() - 1); } g.drawRect(newX, newY, f.getWidth() - 1, f.getHeight() - 1); currentLoc = new Point(newX, newY); g.dispose(); } } else { setBoundsForFrame(f, newX, newY, f.getWidth(), f.getHeight()); } }
public void mouseReleased(final MouseEvent _evt) { if ((coordContext_ != null) && (coordContext_.cs_ != null) && (coordContext_.vs_ != null)) { final Graphics gr = bgraphe_.getGraphics(); gr.setXORMode(bgraphe_.getBackground()); gr.setColor(new Color(255, 0, 0)); dessinePointCoord(coordContext_, gr); } coordContext_ = null; }
private void paintTrack(int x, int y) { int w = this.getWidth(); int h = this.getHeight(); Graphics g = this.getGraphics(); g.setColor(Color.BLUE); g.setXORMode(this.getBackground()); if (this.isHorizontal()) { g.drawLine(x,-1,x,h); } else { g.drawLine(-1,y,w,y); } g.dispose(); }
private void paintMark(Graphics g) { int x = getXCoordinate(value); int h = getHeight(); g.setColor(markColor); g.setXORMode(Color.WHITE); g.fillPolygon(new int[] { x - 4, x + 4, x }, new int[] { 1, 1, 5 }, 3); g.fillPolygon(new int[] { x - 5, x + 5, x }, new int[] { h - 1, h - 1, h - 6 }, 3); g.setPaintMode(); g.drawLine(x, 5, x, h - 6); }
private void drawPixelBorder(int currentPixelX, int currentPixelY, int currentLevel, boolean showBorder) { final Graphics g = getGraphics(); g.setXORMode(Color.white); if (pixelBorderDrawn) { drawPixelBorder(g, currentLevelPixelX, currentLevelPixelY, this.currentLevel); pixelBorderDrawn = false; } if (showBorder) { drawPixelBorder(g, currentPixelX, currentPixelY, currentLevel); pixelBorderDrawn = true; } g.setPaintMode(); g.dispose(); }
/** * Called after the component was repainted (after autoscroll). This is used * to indicate that the graphics is no more dirty. */ public void paint(JGraph graph, Graphics g) { if (marqueeBounds != null) { if (graph.isXorEnabled()) { Color bg = graph.getBackground(); Color fg = graph.getMarqueeColor(); g.setColor(fg); g.setXORMode(bg); } overlay(graph, g, false); } }
private void drawPixelBorder(int currentPixelX, int currentPixelY, int currentLevel, boolean showBorder) { final Graphics g = getGraphics(); g.setXORMode(Color.white); if (pixelBorderDrawn) { drawPixelBorder(g, currentLevelPixelX, currentLevelPixelY, this.currentLevel); pixelBorderDrawn = false; } if (showBorder) { drawPixelBorder(g, currentPixelX, currentPixelY, currentLevel); pixelBorderDrawn = true; } g.setPaintMode(); g.dispose(); }
void drawLine(double x1, double y1, double x2, double y2, ImagePlus imp) { ImageCanvas ic = imp.getCanvas(); if (ic==null) return; Graphics g = ic.getGraphics(); g.setColor(Roi.getColor()); g.setXORMode(Color.black); g.drawLine(ic.screenX((int)(x1+0.5)), ic.screenY((int)(y1+0.5)), ic.screenX((int)(x2+0.5)), ic.screenY((int)(y2+0.5))); }
void effaceDessin() { if (isPaint_ && enCours()) { final Graphics g = getGraphics(); g.setXORMode(Color.white); tl_.dessineTrait((Graphics2D) g, xPivot_, yPivot_, x1_, y1_); if (isFerme_ && ligne_.getNombre() > 1) { tl_.dessineTrait((Graphics2D) g, xPivot_, yPivot_, x2_, y2_); } isPaint_ = false; } }