Class JComboBoxUtil

java.lang.Object
jmri.util.swing.JComboBoxUtil

public class JComboBoxUtil extends Object
Common utility methods for working with JComboBoxes.

To do vertical sizing of empty JComboBoxen, this will create a dummy object and cast it to the contents' type. This can fail.

Since:
4.9.5
  • Constructor Details

  • Method Details

    • setupComboBoxMaxRows

      public static <E, T extends JComboBox<E>> void setupComboBoxMaxRows(T inComboBox)
      Set the maximum number of rows for a JComboBox so that it always can fit on the screen

      To do vertical sizing of empty JComboBoxen, this will create a temporary String and use that to set a default height based on the current font settings.

      Type Parameters:
      E - type of JComboBox contents
      T - subclass of JComboBox being setup
      Parameters:
      inComboBox - the JComboBox to setup