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


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

Re: JScrollBar Repaint Qu

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this>
Subject Re: JScrollBar Repaint Qu
Message-ID <VhRkh.1118$e11.20633@weber.videotron.net> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <1167302019.406807.160780@73g2000cwn.googlegroups.com>
References <1167302019.406807.160780@73g2000cwn.googlegroups.com>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 27
Date Wed, 27 Apr 2011 15:27:58 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918078 96.60.20.240 (Wed, 27 Apr 2011 10:27:58 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:27:58 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:514

Show key headers only | View raw


  To: comp.lang.java.gui
"mearvk" <mearvk@gmail.com> wrote in message 
news:1167302019.406807.160780@73g2000cwn.googlegroups.com...
>
> public void paintComponent(Graphics g)
> {
> scrollPane.setSize(getWidth()-30,getHeight()-150);
> textField.setSize(getWidth()-30,25);
> textField.setLocation(10,getHeight()-130);
> send.setLocation(getWidth()/2,textField.getY()+35);
> cancel.setLocation(getWidth()/2-110,textField.getY()+35);
> super.paintComponent(g);
> }

    It looks like you're trying to reposition and resize your widgets every 
time the JFrame (or whatever the containing component is) needs to be 
redrawn. This is generally frowned upon, and the recommended practice is to 
use a LayoutManager to position and size the components for you. See this 
tutorial for more details: 
http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

    - Oliver

---
 * 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 | NextPrevious in thread | Find similar


Thread

Re: JScrollBar Repaint Qu "mearvk" <mearvk@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: JScrollBar Repaint Qu "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: JScrollBar Repaint Qu "mearvk" <mearvk@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
      Re: JScrollBar Repaint Qu "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
        Re: JScrollBar Repaint Qu "mearvk" <mearvk@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
          Re: JScrollBar Repaint Qu "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
          Re: JScrollBar Repaint Qu "Oliver Wong" <oliver.wong@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000

csiph-web