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(); } } }
public static BufferedImage generateAndWriteToImage(String string, int x, int y) { BufferedImage image = new BufferedImage(x,y,BufferedImage.TYPE_INT_RGB); Graphics g = image.getGraphics(); g.setPaintMode(); g.setFont(g.getFont().deriveFont(30f)); g.drawString(string, 100, 100); g.dispose(); return image; }
public void paint(Graphics graph){ graph.setPaintMode(); super.paint(graph); //graph.setXORMode(Color.white); }
public void paint(Graphics g) { super.paint(g); Dimension size = this.getSize(); g.setPaintMode(); g.setColor(Color.black); Stroke old = ( (Graphics2D) g).getStroke(); BasicStroke bs = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] {5.0f} , 0.0f); ( (Graphics2D) g).setStroke(bs); g.drawLine(size.width / 2, 0, size.width / 2, size.height); ( (Graphics2D) g).setStroke(old); }
/** * Requests that the component responsible for painting the background paint * itself * * @param g * The graphics object to paint the image on. * @param component * the component to be painted onto the background image * @param clip * The clipping region to draw into */ protected void paintBackgroundComponent(Graphics g, Component component, Rectangle clip) { try { g.setPaintMode(); Dimension dim = component.getPreferredSize(); rendererPane.paintComponent(g, component, graph, 0, 0, (int) dim.getWidth(), (int) dim.getHeight(), true); } catch (Exception e) { } catch (Error e) { } }
/** * Requests that the component responsible for painting the background paint * itself * * @param g * The graphics object to paint the image on. * @param component * the component to be painted onto the background image */ protected void paintBackgroundComponent(Graphics g, Component component) { try { g.setPaintMode(); Dimension dim = component.getPreferredSize(); rendererPane.paintComponent(g, component, graph, 0, 0, (int) dim.getWidth(), (int) dim.getHeight(), true); } catch (Exception e) { } catch (Error e) { } }
private void drawSelectedNodes_() { if(selectedNode_ == null) return; Graphics graphics = getGraphicsInternal_(); graphics.setColor(Color.black); graphics.setPaintMode(); graphics.drawImage(backImage_, 0, 0, null); setWireframe(true); drawObjects_(true, graphics, 0); setWireframe(false); graphics.dispose(); }
public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) { if (dragMode == DEFAULT_DRAG_MODE) { setBoundsForFrame(f, newX, newY, newWidth, newHeight); } else { JDesktopPane desktopPane = getDesktopPane(f); if (desktopPane != null) { Graphics g = desktopPane.getGraphics(); g.setXORMode(Color.white); if (currentBounds != null) { g.drawRect(currentBounds.x, currentBounds.y, currentBounds.width - 1, currentBounds.height - 1); } g.drawRect(newX, newY, newWidth - 1, newHeight - 1); currentBounds = new Rectangle(newX, newY, newWidth, newHeight); g.setPaintMode(); 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); }
/** * generates the actual output. * * @throws Exception if something goes wrong */ public void generateOutput() throws Exception { BufferedImage bi; Graphics g; bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB); g = bi.getGraphics(); g.setPaintMode(); g.setColor(getBackground()); if (g instanceof Graphics2D) ((Graphics2D) g).scale(getXScale(), getYScale()); g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight()); getComponent().printAll(g); ImageIO.write(bi, "png", getFile()); }
/** * generates the actual output. * * @throws Exception if something goes wrong */ public void generateOutput() throws Exception { BufferedImage bi; Graphics g; bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB); g = bi.getGraphics(); g.setPaintMode(); g.setColor(getBackground()); if (g instanceof Graphics2D) ((Graphics2D) g).scale(getXScale(), getYScale()); g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight()); getComponent().printAll(g); ImageIO.write(bi, "png", getFile()); }
/** * generates the actual output. * * @throws Exception if something goes wrong */ public void generateOutput() throws Exception { BufferedImage bi; Graphics g; bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB); g = bi.getGraphics(); g.setPaintMode(); g.setColor(getBackground()); if (g instanceof Graphics2D) ((Graphics2D) g).scale(getXScale(), getYScale()); g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight()); getComponent().printAll(g); ImageIO.write(bi, "bmp", getFile()); }
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(); }
/** * generates the actual output. * * @throws Exception if something goes wrong */ public void generateOutput() throws Exception { BufferedImage bi; Graphics g; bi = new BufferedImage(getComponent().getWidth(), getComponent().getHeight(), BufferedImage.TYPE_INT_RGB); g = bi.getGraphics(); g.setPaintMode(); g.setColor(getBackground()); if (g instanceof Graphics2D) ((Graphics2D) g).scale(getXScale(), getYScale()); g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight()); getComponent().printAll(g); ImageIO.write(bi, "bmp", getFile()); }
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(); } } }
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(); }
/** * Description of the Method * *@param fg Description of Parameter *@param bg Description of Parameter *@param g Description of Parameter */ protected void paintConnector(Color fg, Color bg, Graphics g) { // Set Foreground g.setColor(fg); // Set Xor-Mode Color // // Highlight the Current Port paintPort(getGraph().getGraphics()); // If Valid First Port, Start and Current Point if (firstPort != null && start != null && current != null) { // Then Draw A Line From Start to Current Point g.setXORMode(bg); g.drawLine(start.x, start.y, current.x, current.y); g.setPaintMode(); } }
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(); } } }
public void endWorkingFor(WorkResult res) { lStatus.setText("done work for "+lastSessionName); Graphics graph=guiMandelWorkerPannel.this.pImage.getGraphics(); if(graph!=null) { MandelWorkResult r=(MandelWorkResult)res; graph.setPaintMode(); int w=guiMandelWorkerPannel.this.pImage.getWidth(); int h=guiMandelWorkerPannel.this.pImage.getHeight(); int fw=r.getIter().length; int fh=r.getIter()[0].length; for(int y=0;y<fh;y++) { for(int x=0;x<fw;x++) { graph.setColor( colorTable[((r.getIter())[x][y]) % colorTable.length]); graph.fillRect(w/2-fw/2+x,h/2-fh/2+(fh-y),1,1); } } } }
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(); } } }