• 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

How to specify JEditorPane initial size ??

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know for JTextArea i can give rows and columns
but the JEditorPane, just is big enough initialluy
to accomodate the displayed text and not more
this is inconvenient when there is no text to begin with.
how can i set a particular initial preferred size ?
thanks
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the layout manager sets the size of the components.
if the JEditorPane is inside a JScrollPane, you can specify the preferred size of its viewport. for the frame that contains the scrollpane, you should call pack() (instead of setSize()). the layout manager will then take the preferred sizes of the components to lay them out.
example:
scrollPane.getViewport().setPreferredSize(new Dimension(300,300);
regards
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic