| Author |
How to dynamic set JTextPane height??
|
chester lin
Greenhorn
Joined: May 15, 2012
Posts: 3
|
|
|
Hello , everyone , I'm use JTextPane to put user type message , i try it , it must to set location(x,y) and size(width,height) , so i need to set dynamic height to JTextPane , i had a fixed width , so width it's ok , but height i don't know how to set , i had google about this topic , i found Short.MAX_VALUE to be JTextPane height, but it's not really height , too bad , have someone to help me?? thanks
|
 |
Ranganathan Kaliyur Mannar
Bartender
Joined: Oct 16, 2003
Posts: 915
|
|
Height of a component will usually decided by the LayoutManager - you can set a preferredSize, but this will be used only as an hint by the layout managers...
Why do you need to set the height? have you added the text pane to a JScrollPane - this will allow the user to enter as much text and scrollbar will appear automatically if the text exceeds the visible height.
|
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
|
 |
 |
|
|
subject: How to dynamic set JTextPane height??
|
|
|