Questions tagged [flowlayout]

Flow layout places components left to right and then top to bottom, allocating just enough place for each component.

Flow layout is similar to table layout but it allocates just enough width for each component. It has no "columns" because the width of the cells is most often different for every row. The difference between flow and table layout is less obvious when flow layout only has a single row (a quite common case in GUI).

345 questions
2
votes
2 answers

Custom font in JLabel is cut off

I have a JLabel that I have set the custom font, "BP Diet" to it. If I add this to a JFrame, the text appears fine, but as soon as I change the layout of the JFrame to FlowLayout, the top of the text appears cut off. This same problem occurs when…
2
votes
1 answer

How to implement custom FlowLayout in a GEF editor?

I'm implementing a GEF editor and am facing the following problem. There are two types of EditPart: 1) GraphEditPart, 2) NodeEditPart. My editor extends GraphicalEditor, as I'm not needing a palette at all. I use SimpleRootEditPart for the…
QueNuevo
  • 105
  • 12
2
votes
1 answer

Free space between components and border of containter in FlowLayout

When I put something in content pane that has flow layout manager i get free space between that component and borders of content pane. The default flow layout has hgap and wgap non-zero, but setting them to zero DOESN'T solve the problem. NOTE:…
croraf
  • 4,332
  • 2
  • 31
  • 50
2
votes
2 answers

Java - JPanel is only one small pixel in the top center of my JFrame

The JPanel called panel only shows up as one small red square up the top center, I have tried to set the size but it doesn't seem to do anything. import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import…
Aazim Abdul
  • 59
  • 2
  • 6
2
votes
1 answer

Changing FlowLayout Alignment after button click

I have a FlowLayout where default alignment of the component is CENTER. I want to change the component alignment (some Buttons) to left when the left button is clicked Like all the buttons will be skewed to left. and this is my left button…
Faysal Ahmed
  • 1,592
  • 13
  • 25
2
votes
1 answer

Java SwingWorker Flicker

Could someone tell me why in this simple demo of using a SwingWorker, the screen flickers as if the buttons are jumping constantly? (feedback on improving the multithreading portion is appreciated too). import java.awt.EventQueue; import…
Mahmoud
  • 231
  • 1
  • 4
  • 12
2
votes
2 answers

What should I use instead of FlowLayout()?

So, my JFrame is not turning out the way I want it to, because of the FlowLayout() but I don't know what else to use to fix this. It just makes my JButton fill the entire JFrame. Is there a way I can get FlowLayout() to apply my custom sizes and…
knorberg
  • 462
  • 5
  • 19
2
votes
2 answers

How to add JPanel into another JPanel with vertical scrollpane at runtime?

I'm trying to insert a new panel into another panel in runtime everytime I press a button. My problem is the original panel runs out of space and I can't see the new panels I'm adding. What I've tried so far: Using scrollpane for vertical scrolling…
user1864229
  • 53
  • 2
  • 4
  • 11
2
votes
1 answer

JTabbedPane FlowLayout throws ArrayIndexOutOfBoundsException

I'm trying to apply the flow layout to a JTabbedPane so that I can set the hgap(0) and vgap(0). The default layout for the JTabbedPane leaves gaps all around. The following code throws when I try to set the layout: import…
Brandon
  • 22,723
  • 11
  • 93
  • 186
2
votes
1 answer

FlowLayout.CENTER not centering the components

I was using FlowLayout.CENTER to center a string and some checkboxes but it is not centering them. I've used this before and it worked fine. Here is the code: import javax.swing.*; import java.awt.*; public class pizza extends JFrame { //row 1 …
Rostro
  • 148
  • 2
  • 3
  • 15
2
votes
2 answers

How to have FlowLayout reposition components upon resizing.

I want to put FlowLayout with lets say 5 labels inside BorderLayout as north panel (BorderLayout.NORTH), and when I resize my window/frame I want the labels to not disappear but instead move to new line. I have been reading about min, max values and…
user2141889
  • 2,255
  • 5
  • 23
  • 25
2
votes
2 answers

How to remove excess space at bottom

I'm creating a simple Java Swing application. The build set up is a Grid Layout of 3 rows and 1 column. Inside the top row is another Grid Layout that has two columns, and inside each of those columns another Grid Layout splitting it into 2 rows.…
RipIt
  • 205
  • 1
  • 8
2
votes
1 answer

Swing layout with miglayout and nested panels

I have a Swing program using SwingLayout. The structure of the Swing components looks like this. JFrame JPanel (Cardlayout) JPanel (Miglayout) - Main panel Jpanel (Flowlayout) - Checkbox Panel JPanel (Flowlayout)…
Jazzepi
  • 5,259
  • 11
  • 55
  • 81
2
votes
2 answers

Need to resize the window for program to work

Here is the code of my Layout class. import java.awt.event.*; import java.awt.*; import javax.swing.*; public class Layout extends JFrame { private JButton lb; private JButton cb; private JButton pb; private FlowLayout layout; …
Critsin
  • 23
  • 2
1
vote
1 answer

Java FlowLayout does paint my pictures tiny

My FlowLayout does paint the pictures very small so i nearly cant see them. Whats my mistake ? My plan later is, that it will look like this: So now iam working on the inner Flow Layout which displays one line of colorSeperations or histograms. …
Furtano
  • 375
  • 1
  • 3
  • 15