grouplayout

Setting maximum width using Matisse GUI builder

I'd like to create a GUI where some of the textfields are resizable horizontaly but maximum width is also specified. For instance the preferred width is 100 pixels, it can be bigger if the window is resized, but the maximum allowed width is 200 pixels. GroupLayout supports this, we can specify the max size in the addComponent method (alo...

Layout manager won't work

Hi, I have done an layout in my GUI but it did not work , all the component just appear one after another. Here is my codes : import javax.swing.*; public class main extends JFrame { public main() { try { add(new FYP_Tx.GUI()); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(800, 600); setLocat...

Java Swing - problem insert component in JTextPane

The below given program insert a new JTextArea on button click. Everytime new TextArea is inserted in new Line. The program is working fine on Linux machine but not on windows machine. On windows machine it is giving me BadLocationException . Can anyone please tell me the solution of this problem. Thanks in advance. import javax.swing.J...

what's the difference between DEFAULT_SIZE and PREFERRED_SIZE?

hi, I'm using Swing GroupLayout and I'm confused about the values GroupLayout.DEFAULT_SIZE and GroupLayout.PREFERRED_SIZE. I never know when to use each one of them in methods like GroupLayout.addComponent(Component, int, int, int). suppose I have this code: GroupLayout l = ...; l.setHorizontalGroup(l.createSequentialGroup() .add...

Mixed alignment with Java Swing's GroupLayout

I'm trying to build a GUI window in my application. What I'm trying to do is have a window, with a few buttons at the top, and a large text area. Something like this: +--------------------------------------------------+ | [button1] [button2] [button3] | | +----------------------------------------------+ | | | text a...

Java's Swing seems to be changing the layout from Card Layout

I am having some pretty strange symptoms with JPanels and CardLayout. Essentially, I have cards which act as "pages" since I can only hold 12 cells on the grid, and I display each page as a card, and clicking -> and <- buttons change pages accordingly (or that's the idea). Because this data is representing a changing model, every five se...

Stopping GroupLayout components from stretching vertically

Is there an easy way to get all (or most) of the components in a GroupLayout application NOT stretch vertically? I know I can do it by forcing each component to it's preferred size when I add it, but that makes the code so much more verbose: .addGroup(layout.createSequentialGroup() .addComponent(oDevRadio) .a...

GCJ javax.swing.GroupLayout

I am using gnu compiler for java version 4.4.4. It doesn't come with support for javax.swing.GroupLayout. Do later versions come with this support? I have build GCC many times before on my system. Should I do this? ...

Why doesn't my JPanel's preferred size change when its contained JScrollPane does in GroupLayout?

Using GroupLayout and the code below, I noticed that the leftPanel is not updating it's preferred size. I thought this was supposed to be automatic and appears to work in other layout managers. How can I get that behaviour with GroupLayout? import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ...