List of usage examples for javax.swing JComboBox getMaximumRowCount
public int getMaximumRowCount()
From source file:Main.java
public static void main(String[] argv) throws Exception { String[] items = new String[50]; for (int i = 0; i < items.length; i++) { items[i] = "" + Math.random(); }/*from w w w.j a va2 s. c o m*/ JComboBox cb = new JComboBox(items); // Retrieve the current max visible rows int maxVisibleRows = cb.getMaximumRowCount(); // Change the current max visible rows maxVisibleRows = 20; cb.setMaximumRowCount(maxVisibleRows); }
From source file:Main.java
public Main() { JComboBox jc = new JComboBox(); jc.addItem("France"); jc.addItem("Germany"); jc.addItem("Italy"); jc.addItem("Japan"); jc.addItemListener(this); add(jc);//from ww w . j a v a 2s . c o m System.out.println(jc.getMaximumRowCount()); }
From source file:org.yccheok.jstock.gui.Utils.java
private static int getScrollBarWidth(JComboBox comboBox, JScrollPane scrollPane) { int scrollBarWidth = 0; if (comboBox.getItemCount() > comboBox.getMaximumRowCount()) { JScrollBar vertical = scrollPane.getVerticalScrollBar(); scrollBarWidth = vertical.getPreferredSize().width; }//from ww w . j av a 2 s . co m return scrollBarWidth; }