Problem when adding a new JTextPane to GroupLayout at run time
Joined: Dec 07, 2009
I am new to Java. I am Creating a Editor Application in Java. Initally this applcation has a JTextPane(name EditorPane) which occupies all of the sapce of JInternalFrame and My maintoolbar also has a button to add the new JTextPane(name headPane) to the JInternalFrame Form at runtime. In the Editor class which extends JInternalFrame class , I am using the following code to add the JTextPane (at initial stage):
When the user clicked on the button to add the new JTextPane, it adds the New JTextPane to the JInternal Form But change the size of the previous JTextPane and also the new JTextPane size and location not correct.
The form is appearing like it has devided into two columns and the first column displays the previous JTextPane and the second column displays the new JTextPane starting from the last of the First JTextPane.
I want to add the New JtextPane to the top of the previous JTextPane and also both JTextPane should occupy the complete horizontal area of the form. Only their vertical size should be differ and they should also resize when the form resize. Also I want to fix the vertical size of the new JTextPane not of the previous JTextPane.
Welcome to the Ranch. Please use code tags when posting codes.
You are using a GroupLayout. Have you try using other layout managers to see how it will look? For swing, choosing a proper layout manager is key.
I think fiddle around with different layout managers like flow, border, grid etc to see the effect. Also you can have several "panels" in each section and even panel can have its own layout manager. So it's endless possibilities lol.