Example usage for javax.swing JComboBox getFontMetrics

List of usage examples for javax.swing JComboBox getFontMetrics

Introduction

In this page you can find the example usage for javax.swing JComboBox getFontMetrics.

Prototype

public FontMetrics getFontMetrics(Font font) 

Source Link

Document

Gets the FontMetrics for the specified Font.

Usage

From source file:Main.java

public static JComboBox createStandardCombo(Object[] values) {
    JComboBox combo = new JComboBox(values);
    FontMetrics fm = combo.getFontMetrics(combo.getFont());
    //   combo.setPreferredSize(new Dimension(combo.getPreferredSize().width, fm.getHeight()));
    return combo;
}