Questions tagged [springlayout]

SpringLayout is a flexible LayoutManager in the Java Programming Language. It lets you specify precise relationships between the edges of components under its control.

SpringLayout is a flexible LayoutManager designed for use by GUI builders. It lets you specify precise relationships between the edges of components under its control. For example, you might define that the left edge of one component is a certain distance (which can be dynamically calculated) from the right edge of a second component. SpringLayout lays out the children of its associated container according to a set of constraints.

Relevant Tutorials:

62 questions
0
votes
0 answers

using SpringUtilities and SpringLayout cannot add another component(JPanel) to JFrame

panel code derive from oracle docs(https://docs.oracle.com/javase/tutorial/uiswing/layout/spring.html). I want add a clear button to the same frame, So I created another panel: panel1. Now the situation is panel and panel1, the code will only show…
jian
  • 4,119
  • 1
  • 17
  • 32
0
votes
0 answers

How can I make the placement of my objects relative to the size of the window using SpringLayout

I am coding this in Kotlin using Swing but I can work with any answers in Java as well. I have a JFrame with a panel that uses the SpringLayout layout manager. var layout = SpringLayout() var frame = JFrame() var mainPanel = JPanel(layout) I want…
KNOB Personal
  • 333
  • 4
  • 15
0
votes
0 answers

Is SpringLayout a fixed-size layout manager?

I know the following Java Swing layout managers: FlowLayout, BoxLayout, BorderLayout, GridLayout, GroupLayout (which I avoid using), and GridBagLayout. I call GridBagLayout a fixed-size layout manager as it defines rows and columns with fixed size.…
Piovezan
  • 3,215
  • 1
  • 28
  • 45
0
votes
1 answer

Issue setting constraints on a JButton from a Panel Array

I am creating a calendar and I create a separate JPanels for each day. All of these panels are put into an ArrayList. However, when I try to add constraints to a JButton, using the SpringLayout, it just doesn't seem to be working from being called…
0
votes
0 answers

Swing center jpanel in another jpanel

i have an issue which i cant get pass it , the issue is that i can't center the jpanel with the content(contentPanel, it has SpringLayout) inside another jpanel(LoginPanel ,main panel) which has the GridBagLayout(to center the contentPanel). this…
0
votes
1 answer

Issue with SpringLayout

I have written some code, but when I run it, id doesn't work like I wanted: it displays only the last element in the array on the top-left corner public class AddClient extends JPanel { String title = "title"; String description = "desc"; …
user9643348
0
votes
1 answer

Why JLabel has zero height when using SpringLayout?

I new in Java UI design and I try to use SpringLayout to create form. I put JLabel in JFrame, added some constraints. I need JLabel that stratches to JPanel width. But it has zero height. And too small width. Here is code fragment: imageContainer =…
0
votes
1 answer

Java - Update size of component after resize event

I have this simple code: import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowAdapter; import…
Francesco Rizzi
  • 631
  • 6
  • 24
0
votes
1 answer

Speed of placement of nodes using Jung's SpringLayout

is there any easy method to define the placement speed of the nodes when using the SpringLayout? I am using the JUng library version 2.1.1. I even created an own SpringLayout class to have the possibility to change any parameter, but changing the…
Matzka
  • 125
  • 1
  • 13
0
votes
1 answer

JScrollPane not reacting due to JPanel not resizing

I have a cardlayout JPanel, inside of which is a JScrollPane, inside of which is a springlayout JPanel. The springlayout JPanel is being dynamically added with JPanels from top to bottom, but when the JButtons go beyond the JPanel, the JScrollPane…
0
votes
2 answers

Location of the buttons go to a strange location (SpringLayout)

I am making a java application where you can add new Accounts through a form, i am using the SpringLayout for it because it looks neat, however after adding the JTextFields with the text of it, the button stays at the left top whilst it shouldn't be…
user4117456
0
votes
1 answer

Making a new frame and decorate it using the SpringLayout using SpringUtilities

I am currently making a small application which i need the Spring Utilities class for, this class Extends 'JPanel' because it is a content pane, however i need to get the type of layout through a container, but only this class/frame is using the…
user4117456
0
votes
0 answers

JPanel with SpringLayout is not visible

I am getting insane! I am adding a JPanel to an another JPanel by a method. This method is generating a grid via SpringLayout. The problem is that after adding all JComponents to the panel the preferred size of the panel is 0, thus no content is…
0
votes
1 answer

JPanel's with SpringLayout preferredSize does not calculate the right value

I fail to see how to make a JPanel with SpringLayout properly calculate its preferred size, as currently it is always (0, 0). I tried calling panel.setPreferredSize(layout.preferredLayoutSize(panel));, however it doesn`t change anything. I also…
Coderino Javarino
  • 2,819
  • 4
  • 21
  • 43
0
votes
0 answers

Adapting GUI in a SpringLayout

I Have this code package view; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JOptionPane; import…