About 902,000 results
Open links in new tab
  1. swing - java BoxLayout panel's alignment - Stack Overflow

    Feb 9, 2012 · A lightweight container that uses a BoxLayout object as its layout manager. Box provides several class methods that are useful for containers using BoxLayout -- even non-Box containers. If you haven't seen it yet, the tutorial How to Use BoxLayout is very helpful.

  2. java.awt.AWTError: BoxLayout can't be shared - Stack Overflow

    The BoxLayout constructor must reflect this since you can't add the BoxLayout to one container and then pass in as a parameter a different container. So change this: this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));

  3. Java - How to change components height using BoxLayout?

    Jul 15, 2015 · From the docs for BoxLayout. When a BoxLayout lays out components from top to bottom, it tries to size each component at the component's preferred height. For a top-to-bottom box layout, the preferred width of the container is that …

  4. java - BoxLayout stretches component to fit parent panel - Stack …

    The trick is, as the previous answer mentioned, to use the glue, fillers, and rigid areas in the box layout. Unlike that responder, though, I'd recommend sticking with BoxLayout - you can accomplish most simple UIs easier with Box than with the Grid Bag; and the extra power doesn't buy you much in your typical dialog b

  5. Java Swing BoxLayout ignoring AlignmentX - Stack Overflow

    As of 2021 this answer is false (at least for Java 11). This can easily be shown by setting the layout in question to your container via setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) ); and then using .setAlignmentX( int ); on subcomponents.

  6. java - How to make the vertical gap in a BoxLayout smaller?

    Feb 1, 2013 · The problem is that the BoxLayout respects the maximum size of the components. Since panels don't have a maximum size each panel increases in height to take up the available space. Another solution is to determine the maximum size of each panel after you add the components to the panel:

  7. java - GUI, BoxLayout adding a panel - Stack Overflow

    Jul 19, 2014 · The layout manager (BoxLayout) is using the preferred size of the components of the container it is managing. By default, the preferred size of a empty JPanel is 0x0, adding in the border has produced a preferred size closer to 2x2

  8. java - How to set component size inside container with BoxLayout ...

    Aug 23, 2013 · BoxLayout on the contrary, respects the preferred size of a given JComponent, which is usually calculated based on the content the JComponent holds or given explicity, hence components do not tend to align well with respect to other given components.

  9. java - Nested layouts - FlowLayout inside BoxLayout - Stack …

    Jun 6, 2013 · I have a controlPanel (BoxLayout): controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.Y_AXIS)); Now I build two FlowLayout and add them to the contolPanel panel: JPanel fromDatePanel = ...

  10. java - Using boxlayout, how do I get components to fill all …

    Nov 25, 2014 · So, when using BoxLayout, it would be sufficient to set same X alignment to all components: c1.setAlignmentX(Component.CENTER_ALIGNMENT) c2.setAlignmentX(Component.CENTER_ALIGNMENT) ...

Refresh