Questions tagged [grouplayout]

GroupLayout is a Java Swing LayoutManager that hierarchically groups components in order to position them in a Container.

GroupLayout is a LayoutManager that hierarchically groups components in order to position them in a Container. GroupLayout is intended for use by builders, but may be hand-coded as well. Grouping is done by instances of the Group class. GroupLayout supports two types of groups. A sequential group positions its child elements sequentially, one after another. A parallel group aligns its child elements in one of four ways.

Relevant documentation and tutorials:

180 questions
14
votes
1 answer

GroupLayout can only be used with one container at a time

Not sure why this error is coming up. I am using GroupLayout because I want it to do the spacing for me and will be adding more panels to the frame in the future. Below is the stack trace. Exception in thread "main"…
marcopolo
  • 1,963
  • 4
  • 18
  • 31
12
votes
1 answer

Swing GroupLayout: Resizing and limiting component sizes

I'm using GroupLayout to manage components in some dynamically generated data input forms. The layout is more or less like so: *-----------------------------------------------* | label A | field A | | label B | …
vaughandroid
  • 4,315
  • 1
  • 27
  • 33
9
votes
1 answer

GroupLayout giving error with java swing

I am getting a long list of errors. Can anyone suggest to me where I am going wrong with GroupLayout. layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(new JLabel("Enter Book Name")) .addComponent(new…
John
8
votes
3 answers

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] …
zigdon
  • 14,573
  • 6
  • 35
  • 54
7
votes
5 answers

NetBeans, GUI builder (group layout) centering a component

I'm trying to design a JButton (an "Ok" button) that to look good has to be horizontally centered in the containing JFrame. I'm using the GUI Builder with the Free Form layout (GroupLayout). I've taken several GUI builder tutorials…
AgostinoX
  • 7,477
  • 20
  • 77
  • 137
7
votes
2 answers

what's the difference between DEFAULT_SIZE and PREFERRED_SIZE?

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…
cd1
  • 15,908
  • 12
  • 46
  • 47
6
votes
1 answer

How to iteratively add Components to a Swing GroupLayout ParallelGroup?

Is there a way to iterate over a List of Components and add them to a ParallelGroup in Swing GroupLayout? It seems difficult because there is no method to get hold of the ParallelGroup. Here is the code generating a List of Components (in this…
Arvanem
  • 1,043
  • 12
  • 22
5
votes
2 answers

Why does my JTextArea overflow the frame in GroupLayout?

I'm observing some strange behavior using GroupLayout. I've got a JTextArea that is contained inside of a JScrollPane that is resizing and pushing other components out of the JFrame. Oddly, if I rearrange the layout so that the JTextArea has…
jigawot
  • 653
  • 7
  • 10
5
votes
2 answers

Set only maximum height for a panel (without using setMaximumSize) with GroupLayout

I looked around at all the other answers, but they all recommend to use GroupLayout, BoxLayout, or to wrap the panel that's using GridBagLayout with another panel that uses one of the layouts mentioned above. I'm currently using GridBagLayout, and…
Vince
  • 14,470
  • 7
  • 39
  • 84
5
votes
1 answer

GroupLayout: Vertical and Horizontal Groups

I'm attempting to create a small Jpanel with a GroupLayout infront of it. Having followed the documentation as much as possible as well as looked at a number of StackOverflow questions, I'm still stuck. The error is as follows: Exception in thread…
TheMightyLlama
  • 1,243
  • 1
  • 19
  • 51
5
votes
1 answer

Building GUI using GroupLayout in Java

I need to build a GUI using GroupLayout (not other layouts). The GUI will look like the following: ---------------------------- | field 1 field 2 field 3 | | FFIEEELLLDD4 FIELDDDDDD5 | | FIEEEEEEEEEEEEEEELDDDD 6 …
newtothissite
  • 357
  • 2
  • 6
  • 10
5
votes
1 answer

Java - Mixing component size in GroupLayout

I am trying to arrange two set of buttons for a calculator GUI. Each one uses a GroupLayout to make them. One set is the numbers (and "."), the other is for operation buttons. This basically works but if one of the buttons has double length (for…
PElshen
  • 135
  • 1
  • 1
  • 10
5
votes
4 answers

How can I use GroupLayout to build a form?

What is the easiest way to build a form in Java using GroupLayout? With form, I mean something that has text fields with a label in front. Something like this:
Wim Deblauwe
  • 25,113
  • 20
  • 133
  • 211
4
votes
3 answers

With GroupLayout, how can I align separate components to each end of one longer component? Or, can one component span multiple parallel groups?

tl;dr: I want to do what's in the second picture (ignore the red lines) I understand how GroupLayout works, but I can't figure this out, or whether it's even possible. I initially had this code: #Horizontal layout is a parallel group containing 3…
Cam Jackson
  • 11,860
  • 8
  • 45
  • 78
4
votes
1 answer

Java UI Layouts Choice

Greetings all, I am relatively new to both UI designing and this community, so take it easy on me. Summary: I am currently attempting to design a GUI for a native desktop application using Java swing. Like most beginners, I am currently using…
swang
  • 55
  • 4
1
2 3
11 12