Results 1 to 4 of 4
Thread: JtextArea and JSpliPane
- 08-24-2009, 04:52 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 11
- Rep Power
- 0
JtextArea and JSpliPane
I have a problem.
I've put a JScrollPane with a JTextArea in the bottom part of a JSplitPane but when I use the "OneTouchExpandable button" to expand the bottom part my JTextArea don't resize.
Instead the top Panel works well and resize correctly.
here the SplitPane code:
and other usefull code I used:Java Code:splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(0.5); splitPane.setDividerLocation(0.5); splitPane.setContinuousLayout(true);
What should I do to make the bottom JTextArea to resize correctly?Java Code:displayArea = new JTextArea(); displayArea.setEditable(false); displayArea.setFont(LOG_FONT); displayArea.setLineWrap(true); JScrollPane areaScrollPane = new JScrollPane(displayArea); areaScrollPane.setPreferredSize(new Dimension(500, 150)); areaScrollPane.setMinimumSize(new Dimension(100, 50)); areaScrollPane.setBorder(BorderFactory.createCompoundBorder (BorderFactory.createTitledBorder("Log Text"), BorderFactory.createMatteBorder(2,2,2,2,Color.GREEN))); displayPanel.add(areaScrollPane);
- 08-25-2009, 01:17 PM #2
Try not setting a preferredSize for the JScrollPane.
db
- 08-25-2009, 04:03 PM #3
Member
- Join Date
- Aug 2009
- Posts
- 11
- Rep Power
- 0
I tried.. now it resize correctly but it's too small :confused:
Setting directly the size (setSize) of the Jtextarea it works partially cause at the beginning it displays only 1 row. :confused:Last edited by gancio; 08-26-2009 at 09:45 AM.
- 08-26-2009, 03:36 PM #4
Member
- Join Date
- Aug 2009
- Posts
- 11
- Rep Power
- 0
I made a stupid error
Now it's working (also with PreferredSize) and new code is;Java Code:JSplitPane splitPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, sudoPanel,[B]displayPanel[/B]);
Java Code://displayPanel.add(areaScrollPane); //useless JSplitPane splitPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, sudoPanel,[B]areaScrollPane[/B]);Last edited by gancio; 08-26-2009 at 03:50 PM.
Similar Threads
-
About JTEXTAREA
By makpandian in forum AWT / SwingReplies: 4Last Post: 03-19-2009, 06:53 AM -
How to add a shortcut key from JTextArea
By sukatoa in forum Advanced JavaReplies: 2Last Post: 01-28-2008, 08:39 AM -
JTextArea
By saytri in forum New To JavaReplies: 0Last Post: 01-13-2008, 01:07 AM -
Jtextarea and scroll
By ziniestro in forum AWT / SwingReplies: 2Last Post: 06-01-2007, 03:59 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks