Class JComboBoxUtil


  • public class JComboBoxUtil
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      JComboBoxUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E,​T extends javax.swing.JComboBox<E>>
      void
      setupComboBoxMaxRows​(T inComboBox)
      Set the maximum number of rows for a JComboBox so that it always can fit on the screen
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setupComboBoxMaxRows

        public static <E,​T extends javax.swing.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