Class FixedWidthPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class FixedWidthPanel extends JPanel
A JPanel subclass that maintains a fixed width matching the plugin panel.

This panel overrides the preferred size calculation to always return the standard plugin panel width (PluginPanel.PANEL_WIDTH), while allowing the height to be determined by the content.

Use this panel when you need a container that maintains consistent width within the plugin sidebar, regardless of its content.

Example usage:


 FixedWidthPanel container = new FixedWidthPanel();
 container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
 container.add(new JLabel("Settings"));
 container.add(new JTextField());
 // Panel will always be PANEL_WIDTH wide
 

See Also:
  • Constructor Details

    • FixedWidthPanel

      public FixedWidthPanel()
  • Method Details

    • getPreferredSize

      public Dimension getPreferredSize()
      Returns the preferred size with fixed width.

      The width is always PluginPanel.PANEL_WIDTH, while the height is calculated based on the panel's content.

      Overrides:
      getPreferredSize in class JComponent
      Returns:
      the preferred dimension with fixed width