getGraphics « GUI « Java Swing Q&A





1. getGraphics()    coderanch.com

2. getGraphics    coderanch.com

Hi, you realy should try to keep your graphical work inside the paint or the paintComponent method. If not, you might lose graphical data when the component repaints. You should use the Graphics object, given as a parameter in the paint or paintComponent method and use the setFont(..) method in Graphics to change your font. HTH, Kris

3. getGraphics on Macintosh    coderanch.com

Hi Everybody, I try to display white noise (pixelwise flickering). Its not fast enough with repaints, so I tried to use getGraphics() and draw some new pixels directly. Following piece of code is called every 10 milliseconds: graphics = this.getGraphics(); if ((graphics==null) || (true)) { this.repaint(); } else { int l1 = myGetWidth(); int l2 = myGetHeight(); int anz = NEWPIXELPROCENT*l1*l2/100; ...