• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

settiing size of Jpanel

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set layout to null in container, where you add JPanel.
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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));
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic