Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2918

Re: Refresh screen by rep

From liang.spark@gmail.com.remove-dii-this
Subject Re: Refresh screen by rep
Message-ID <b0dbc2e6-cb1e-480f-a0eb-d5aa68946ecf@e25g2000prg.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <NOednfNdOvTTkO3anZ2dnUVZ_hCdnZ2d@comcast.co
Date 2011-04-27 15:41 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On Dec 25, 3:49 am, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:
> liang.sp...@gmail.com wrote:
> > Hi here,
>
> > In my cast.
> > class MyFrame extends JFrame{
> >   public void paint(Graphics g){
> >     g.drawText("some word");
> >   }
> > }
> > Every time I call repaint() mothed. the application screen twinkled.
> > If i call repaint() frequently. the screen continuously fresh. It's
> > serious problem for user experience.
> > how can I avoid this problem?
>
> > I appreciate to any suggestion!
>
> > liang xiao
>
> Don't override paint.
> Create your own subclass of JComponent, and override paintComponent.
>
> You're flashing should go away.
>
> --
> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

I'm sorry my mistake in my original post. it should be below:

g.drawString("some word",0,0);

I try to extends JPanal. and use setContentPanel mothed of JFrame to
my customer Panel. override paintComponent() mothed. the flashing was
gone.

thank you both of above.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread


Thread

Re: Refresh screen by rep liang.spark@gmail.com.remove-dii-this - 2011-04-27 15:41 +0000

csiph-web