Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Repainting issue  RSS feed

 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


What am I doing wrong?
 
Pat Hays
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony

I don't know what wrong with your code. But I think you may change

f.getContentPane().add(new JTextArea(30, 30));
to be
f.getContentPane().add(new JTextArea(30, 30), BorderLayout.CENTER);

, Then see whether you still have the problem.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have java 5, to be able to run your code, but generally when removing
items from a container, you need to call validate() before repaint().

something like this
Component c = bl.getLayoutComponent(BorderLayout.NORTH);
f.remove(c);
f.validate();//<-------
f.repaint();
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I don't have java 5, to be able to run your code, but generally when removing
items from a container, you need to call validate() before repaint().


Excellent, that did it, thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!