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

settiing size of Jpanel  RSS feed

 
sarveswaran meenakshi sundaram
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I need to fix the size of a JPanel. But no matter wat size I set,the panel takes a fixed size. When I place the panel inside a JInternalFrame and set the size for JInternalFrame,the panel automatically resizes to the internalframes size. But if i fix the size of the panel with out setting the size of the InternalFrame,the panel always takes a fixed size. How can we fix a panel's size? Thanks in advance.

sincerely,
Sarveswaran M
 
Arto Pastinen
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set layout to null in container, where you add JPanel.
 
Pat Hays
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sarveswaran,

set layout to null in container, where you add JPanel.
or
you may use setPreferredSize() instead of setSize(), as the JPanel is using some particular LayoutManager.

Eg:
----------------
jPanel1.setPreferredSize(new Dimension(93, 39));
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!