• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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));
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic