this.trackPanelGraphics = this.trackPanel.getGraphics();
JPanel jpanel = new JPanel(); Graphics g = jpanel.getGraphics();
public void init(){ cgp = new CardGamePanel(); JPanel panel2 = new JPanel(); panel2.add(btnD); btnD.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ cgp.go(panel2.getGraphics()); } }); add(cgp, BorderLayout.CENTER); add(panel2, BorderLayout.SOUTH); setSize(500,500); }
private void paint() { Graphics2D g = (Graphics2D) panel.getGraphics(); if (g == null) return; GeometryPainter.paint(indicator, viewport, g, Color.RED, null); }
@Override public void run() { Graphics g = canvas.getGraphics(); painter.paintComponent(g); g.dispose(); }
JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.add(panel); frame.setVisible(true); Graphics frameContext = frame.getGraphics(); Graphics panelContext = panel.getGraphics(); if (frameContext.equals(panelContext)){ System.out.println("The contexts are the same."); } else { System.out.println("The contexts are different."); }
@Override public void run() { Graphics g = canvas.getGraphics(); painter.paintComponent(g); g.dispose(); }
@Override public void run() { Graphics g = canvas.getGraphics(); painter.paintComponent(g); g.dispose(); }
public static void drawMyStuff(JPanel panel, Color color, int startPoint, int endPoint) { // Declare and initialize a graphics object // based on the supplied JPanel. Graphics g = panel.getGraphics(); // Set the color we want to use... g.setColor(color); // here we supply our color parameter // Draw a red line horizontally through the // center of the supplied JPanel. Notice our // new startPoint and endPoint parameters are // supplied here. g.drawLine(startPoint, panel.getHeight()/2, endPoint, panel.getHeight()/2); // Close the Graphics object, we don't need it anymore. g.dispose(); // Update the supplied JPanel so as // to display what we've drawn. panel.revalidate(); }
public void onNewMessage(sensor_msgs.CompressedImage message) { if (cameraFrame.isVisible()) { cameraImage = RosTools.bufferedImageFromRosMessageJpeg(colorModel, message); cameraPanel.getGraphics().drawImage(cameraImage.getScaledInstance(cameraImage.getWidth(), cameraImage.getHeight(), 0), 0, 0, null); } }
public static void drawMyStuff(JPanel panel) { // Declare and initialize a graphics object // based on the supplied component. Graphics g = panel.getGraphics(); // Set the color we want to use... g.setColor(Color.red); // Draw a red line horizontally through the // center of the supplied component. g.drawLine(0, panel.getHeight()/2, panel.getWidth(), panel.getHeight()/2); // Close the Graphics object, we don't need it anymore. g.dispose(); // Update the supplied component so as // to display what we've drawn. panel.revalidate(); }
jp.getGraphics().drawImage(img, x, y, null); Thread.sleep(100);
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); } } } }
@Override public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { int windowID = Static.getInt32(args[0], t); int x = Static.getInt32(args[1], t); int y = Static.getInt32(args[2], t); int red = Static.getInt32(args[3], t); int green = Static.getInt32(args[4], t); int blue = Static.getInt32(args[5], t); Window w = windows.get(windowID); while(true) { try { JPanel panel = (JPanel) w.findComponentAt(x, y); panel.getGraphics().setColor(new Color(red, green, blue)); panel.getGraphics().draw3DRect(x, y, 1, 1, true); return CVoid.VOID; } catch (ClassCastException ex) { //? return CVoid.VOID; } } }
@Override public void run() { try { parentFrame.car = new CarSnapshot(url); parentFrame.panelCarContent = parentFrame.car.duplicate().getImage(); parentFrame.panelCarContent = Photo.linearResizeBi(parentFrame.panelCarContent, parentFrame.panelCar.getWidth(), parentFrame.panelCar.getHeight()); parentFrame.panelCar.paint(parentFrame.panelCar.getGraphics()); } catch (IOException e) { e.printStackTrace(); } } }
int h = jPanel1.getHeight() - i.top - i.bottom; final Graphics2D g = (Graphics2D) jPanel1.getGraphics();
this.selectedCollectionJPanel.add(this.rcCollectionJPanel); this.selectedCollectionJPanel.paintAll(selectedCollectionJPanel.getGraphics()); this.hideWaitCursor();
mainFrame.setVisible(true); setTitle(); graphics=panel.getGraphics(); graphics.setColor(default_color); mainFrame.setBackground(Color.white);
this.rcObjMdJPanel.getMetadataContentJScrollPane().getVerticalScrollBar().setValue(yScrollPos); this.selectedObjectMetadataJPanel.paintAll(selectedObjectMetadataJPanel.getGraphics());
this.rcObjMdJPanel.getMetadataContentJScrollPane().getVerticalScrollBar().setValue(yScrollPos); this.selectedObjectJPanel.paintAll(selectedObjectJPanel.getGraphics());