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


Groups > comp.lang.java.gui > #2909 > unrolled thread

Refresh screen by repaint

Started byliang.spark@gmail.com.remove-dii-this
First post2011-04-27 15:41 +0000
Last post2011-04-27 15:42 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Refresh screen by repaint liang.spark@gmail.com.remove-dii-this - 2011-04-27 15:41 +0000
    Re: Refresh screen by rep "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000
    Re: Refresh screen by rep "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000
    Re: Refresh screen by rep "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000

#2909 — Refresh screen by repaint

Fromliang.spark@gmail.com.remove-dii-this
Date2011-04-27 15:41 +0000
SubjectRefresh screen by repaint
Message-ID<ff4b308d-f1d1-40ce-9718-76cc884d2232@x29g2000prg.googlegroups.com>
  To: comp.lang.java.gui
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

---
 * 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

[toc] | [next] | [standalone]


#2910 — Re: Refresh screen by rep

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:41 +0000
SubjectRe: Refresh screen by rep
Message-ID<7d2aaca18437e@uwe>
In reply to#2909
  To: comp.lang.java.gui
liang.spark@gmail.com wrote:
..
>In my cast.

In your what? 

>class MyFrame extends JFrame{
>  public void paint(Graphics g){
>    g.drawText("some word");
>  }
>}

What is this rubbish?  It does not compile, let alone 
run.  Why would you waste our bandwidth?

>I appreciate to any suggestion!

Post only SSCCEs.  E.G.
<sscce>
import java.awt.*;
import javax.swing.*;

class MyFrame extends JFrame{
MyFrame() {
 super("My Frame");
 getContentPane().add(
 new CustomLabel("Hello World!") );
 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 pack();
}

 public static void main(String[] args) {
  MyFrame frame = new MyFrame();
  frame.setVisible(true);
 }
}

class CustomLabel extends JLabel {
 String text;
CustomLabel(String text) {
 this.text = text;
 setPreferredSize( new Dimension(200,50) );
}
 public void paintComponent(Graphics g){
  g.setColor(Color.black);
   g.drawString(text,40,40);
 }
}
</sscce>

-- 
Andrew Thompson
http://www.physci.org/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200712/1

---
 * 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

[toc] | [prev] | [next] | [standalone]


#2920 — Re: Refresh screen by rep

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:41 +0000
SubjectRe: Refresh screen by rep
Message-ID<q5e8n3d09v3ng8l9ngi04hpi5p9pl7cjl7@4ax.com>
In reply to#2909
  To: comp.lang.java.gui
On Mon, 24 Dec 2007 03:12:46 -0800 (PST), "liang.spark@gmail.com"
<liang.spark@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>}
>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?

see http://mindprod.com/jgloss/flicker.html
http://mindprod.com/jgloss/paint.html
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * 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

[toc] | [prev] | [next] | [standalone]


#2955 — Re: Refresh screen by rep

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:42 +0000
SubjectRe: Refresh screen by rep
Message-ID<rfphn35r9or3fsukf31tv7a564k20q841k@4ax.com>
In reply to#2909
  To: comp.lang.java.gui
On Mon, 24 Dec 2007 03:12:46 -0800 (PST), "liang.spark@gmail.com"
<liang.spark@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>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.

Normally you don't have to call repaint.  It happens as a side effect
of other work. 

See http://mindprod.com/jgloss/repaint.html
http://mindprod.com/jgloss/flicker.html
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web