Heroes Come! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !

Category: Java SE
2008-12-21 04:35:48

Sponsored Links
In a JFrame derived class ClassA inside, I created a Timer, and then every so often (eg 60 seconds) to refresh the screen (ClassA), but now the question is: ClassA screen is another screen cover when Each time the screen is refreshed Timer function inside, this screen will be automatically displayed on the front (similar to the effect of calling toFront), which did not allow me to accept, and now I want him to not automatically refreshed show how to do it before? ? I guarantee that the Timer callback function which is like calling a function similar to toFront, I suspect that is not caused by the restrictions Swing itself?

Sponsored Links

2008-12-21 04:53:08
java which is not to have a repaint () method do? Can test.
2008-12-21 05:06:57
1, by overriding public void update (graphics g) to eliminate flicker!
implementation of the animation, often used repaint () function to redraw the screen, to achieve animation loading, in fact, in java repaint () is done by two steps to achieve refresh function, first it calls public void update () to refresh the screen, followed by another call to paint (graphcis g) to redraw the screen, which is likely to cause flicker, especially some of the background of the program needs to be redrawn if the next frame image can be completely covered one frame to the image, then we can rewrite the update function as follows to eliminate flicker:
public void update (graphics g) {paint (g)}

same call repaint () to redraw the screen. Or do not call directly rewrite repaint, but with

graphics g = getgraphics ();

paint (g); to achieve redraw the screen.
2, through the double-buffering to eliminate flicker?

redraw the screen appears to prevent flicker, first create an offscreen drawing area, repainting is completed, the finished product directly to the applet screen and then draw up. Here is the webmaster to create dynamic advertising board used when double-buffering technology code:
offscreenimage = createimage (w, h) ;/ / create offscreen drawing area
offscreen = offscreenimage.getgraphics () ;/ / get the drawing environment

offscreen.setfont (new font ("serif", font.plain, 14));
offscreen.drawstring (" ; you are welcome! ", 4, getbounds (). height / 2);
else {
offscreen.setcolor (bgclr); ;
offscreen.fillrect (0,0, w, h);
offscreen.setcolor (fgclr);
for (int i = j; i <j +16 ; i + +) {
offscreen.drawstring (strs [i], 0, y + = wordvspace);
y = y-16 * wordvspace;
g.drawimage (offscreenimage, 0,0, this) ;/ / draw offscreen finished to a small program
2008-12-21 05:12:21
What other screens? Dialog try setModel (true)
2008-12-21 05:18:02
I understand the meaning of the landlord, looking forward to expert.
2008-12-21 05:23:59
Friendly up
2008-12-21 05:31:38
Brush Before the Z-axis value recorded brush then resume ....
2008-12-21 05:48:26
swing itself is no problem, You set the refresh time to refresh function only useful part of your refresh,

but not all refreshed, try
2008-12-21 05:54:38
to littleboys (Dragon):

Hello, thank you for that support!

not the kind I'm talking about a direct result refresh refresh painting, but in Timer inside a component called ClassA change the display contents of the component functions, such as call inside the Timer ClassA.someComponent.setText ();
2008-12-21 06:11:20
to rocshaw (sunbirds (boycott)):

refers to all other screens may block any window screen ClassA , such as IE, notepad, explorer, and so it
2008-12-21 06:14:02
Their top! ! ! ! ! ! ! ! !
2008-12-21 06:18:53
no master ah? ? ? ? ? Depressed. . . . . . . . . . .
2008-12-21 06:23:52
Thank up

2008-12-21 06:33:02
to wenchaohu213 (Summer I):

I said refreshes and not the kind of immediate refresh, but I call a control method that refresh their windows.
example, TextFieldArea.setText ("ff")
So, I have no way to do ---- useful part for me is just to refresh
2008-12-21 06:38:30
TextFieldArea.setText (" ff ")

set of useful things in a form and then refresh
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.