Re: JScrollBar Repaint Question
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Thu, 28 Dec 2006 10:17:28 -0500
"mearvk" <mearvk@xxxxxxxxx> wrote in message
news:1167302019.406807.160780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
.
- References:
- JScrollBar Repaint Question
- From: mearvk
- Re: JScrollBar Repaint Question
- From: mearvk
- Re: JScrollBar Repaint Question
- From: Oliver Wong
- Re: JScrollBar Repaint Question
- From: mearvk
- Re: JScrollBar Repaint Question
- From: Oliver Wong
- Re: JScrollBar Repaint Question
- From: mearvk
- JScrollBar Repaint Question
- Prev by Date: Re: JScrollBar Repaint Question
- Next by Date: Re: Slight problem with java help
- Previous by thread: Re: JScrollBar Repaint Question
- Next by thread: JScrollBar Repaint Question
- Index(es):
Relevant Pages
|