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
4
votes
1 answer

How to align things in GroupLayout?

I have to make this Panel using GroupLayout, I have written the following code for it GroupLayout layout = new…
Akarshit Wal
  • 631
  • 6
  • 12
4
votes
2 answers

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…
asalamon74
  • 6,120
  • 9
  • 46
  • 60
4
votes
1 answer

how to put two jpanels side by side

I try to put two jpanels side by side, but in this moment i can not do what i want I have this code, this.videoPanel= new JPanel(); this.videoPanel.setBackground(new Color(102, 102, 102)); this.videoPanel.setPreferredSize(new Dimension(320,…
FCoelho
  • 165
  • 1
  • 4
  • 11
4
votes
2 answers

Java Swing GroupLayout does not include the intended 3 buttons. How to fix this?

I need some help with the code below. What I'm trying to do is to expand the size of TextArea (named preview) to include the last three buttons: algo1, algo2 and algo3. I have tried many times to change the code but it still only shows one button,…
evarey
  • 75
  • 1
  • 6
4
votes
2 answers

Java aligning 3 panels using grouplayout

I can't get my 3 panels to align properly. I basically have 1 big panel and 2 smaller (not necesarily identical) ones. The big one is on the left and the 2 smaller ones on the right, with one above the other. The components should remain dynamically…
Sven
  • 1,133
  • 1
  • 11
  • 22
4
votes
2 answers

Java Group layout, vertical layout issues

I am trying to make a two column, 3 row layout. Something along the lines of: ---------------------- | Username |Textbox| | | Email |Textbox| | ---------------------- Yet even when I'm quite sure the groups managed correctly, it still ends up on…
Patrick S
  • 245
  • 1
  • 4
  • 11
3
votes
1 answer

Problem with GroupLayout: components suddenly "burst" when resizing window

I had a Java assignment about a month ago, which was about building a GUI. I used GroupLayout to manage the position of the components. I ran into a problem where if I put a very long string of text into a JTextField and resize the outer window, the…
Kcits970
  • 640
  • 1
  • 5
  • 23
3
votes
2 answers

Gap size after placing JSeparator in Java Swing

I have a simple problem here in Java Swing. I simplified my code to the following snippet. I am not sure how I can minimize the gap size between the horizontal JSeparator with the next JTextField, as current code generates a huge gap between the…
Qiang Li
  • 10,593
  • 21
  • 77
  • 148
3
votes
2 answers

How to center content of a GroupLayout in Java applet

I would like to center content of a GroupLayout in Java applet. After long research I still cannot figure out how to do it. Code below shows my applet. All elements are centered to layout but the layout is not center to applet. JPanel cp=new…
firstNamer
  • 33
  • 1
  • 3
3
votes
2 answers

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: …
zigdon
  • 14,573
  • 6
  • 35
  • 54
3
votes
1 answer

Aligning Vertical and Horizontal SequentialGroup in Swing

I have written this code package test; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import javax.swing.*; import javax.swing.GroupLayout.Alignment; public class MainFrame extends JFrame { private int…
3
votes
1 answer

GroupLayout autogenerated code in NetBeans

After almost 4 years in java programming I decided to learn how to write GUI classes by myself since until now I've always used NetBeans GUI Editor (I'm not particularly proud of it but it has worked pretty well avoiding me worry about the…
dic19
  • 17,821
  • 6
  • 40
  • 69
3
votes
2 answers

GroupLayout layout=new GroupLayout(getContentPane())

I am learning Swings and i am confused with this one line GroupLayout layout=new GroupLayout(getContentPane()); now i have 2 questions what does getContentPane() return . [i saw the docs and got more confused ] why are we passing it to GroupLayout…
Mukesh Kumar Singh
  • 623
  • 1
  • 10
  • 18
3
votes
2 answers

JScrollPane vertical scrollbar too wide

I'm using Netbeans GUI Builder to create a GUI app (so all the code generated is by Netbeans). Everything looks fine in the Preview Design, but when I run the app, the JScrollPane displays badly... ...as you can see, only half of the scrollbar is…
ban-geoengineering
  • 18,324
  • 27
  • 171
  • 253
2
votes
1 answer

Baseline broken with GroupLayout and nested Panels

I am using GroupLayout for my main layout, and baseline alignment works fine, until I add internal panels. It seems the baseline is not propagated through these panels: While all buttons, labels, etc. directly added to the panel with GroupLayout are…
0__
  • 66,707
  • 21
  • 171
  • 266
1
2
3
11 12