This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to specify JEditorPane initial size ??

 
sarim raza
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic