/** * Returns the current {@link UnitConverter}. If it has not been initialized * before it will get an instance of {@link DefaultUnitConverter}. * * @return the current <code>UnitConverter</code> */ public static UnitConverter getUnitConverter() { if (unitConverter == null) { unitConverter = DefaultUnitConverter.getInstance(); } return unitConverter; }
/** * Returns the current {@link UnitConverter}. If it has not been initialized * before it will get an instance of {@link DefaultUnitConverter}. * * @return the current {@code UnitConverter} */ public static UnitConverter getUnitConverter() { if (unitConverter == null) { unitConverter = DefaultUnitConverter.getInstance(); } return unitConverter; }
/** * Returns the current {@link UnitConverter}. If it has not been * initialized before it will get an instance of * {@link DefaultUnitConverter}. * * @return the current <code>UnitConverter</code> */ public static UnitConverter getUnitConverter() { if (unitConverter == null) { unitConverter = DefaultUnitConverter.getInstance(); } return unitConverter; }
/** * Clears cached internal Forms state that is based * on the Look&Feel, for example dialog base units.<p> * * There's typically no need to call this method directly. * It'll be invoked automatically, if the L&F has been changed * via {@link UIManager#setLookAndFeel} and cached data is requested. * It's been made public to allow cache invalidation for cases * where the L&F is changed temporarily by replacing the UIDefaults, * for example in a visual editor. * * @since 1.2.1 */ public static void clearLookAndFeelBasedCaches() { cachedIsLafAqua = null; DefaultUnitConverter.getInstance().clearCache(); }
/** * Clears cached internal Forms state that is based * on the Look&Feel, for example dialog base units.<p> * * There's typically no need to call this method directly. * It'll be invoked automatically, if the L&F has been changed * via {@link UIManager#setLookAndFeel} and cached data is requested. * It's been made public to allow cache invalidation for cases * where the L&F is changed temporarily by replacing the UIDefaults, * for example in a visual editor. * * @since 1.2.1 */ public static void clearLookAndFeelBasedCaches() { cachedIsLafAqua = null; DefaultUnitConverter.getInstance().clearCache(); }
/** * Computes and returns the width of this Size's prototype in pixel. * Ignores the component list and measures. Obtains the FontMetrics * from the given layout {@code container} for the default dialog font * provided by {@link DefaultUnitConverter#getDefaultDialogFont()}.<p> * * Invoked by {@link com.jgoodies.forms.layout.FormSpec} to determine * the size of a column or row. * * @param container the layout container * @param components the list of components used to compute the size * @param minMeasure the measure that determines the minimum sizes * @param prefMeasure the measure that determines the preferred sizes * @param defaultMeasure the measure that determines the default sizes * * @return the {@code stringWidth} for this size's prototype string * computed by the {@code container}'s FontMetrics for the * {@code DefaultUnitConverter}'s default dialog font */ public int maximumSize(Container container, List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure) { Font font = DefaultUnitConverter.getInstance().getDefaultDialogFont(); FontMetrics fm = container.getFontMetrics(font); return fm.stringWidth(getPrototype()); }
/** * Computes and returns the width of this Size's prototype in pixel. * Ignores the component list and measures. Obtains the FontMetrics * from the given layout {@code container} for the default dialog font * provided by {@link DefaultUnitConverter#getDefaultDialogFont()}.<p> * * Invoked by {@link com.jgoodies.forms.layout.FormSpec} to determine * the size of a column or row. * * @param container the layout container * @param components the list of components used to compute the size * @param minMeasure the measure that determines the minimum sizes * @param prefMeasure the measure that determines the preferred sizes * @param defaultMeasure the measure that determines the default sizes * * @return the {@code stringWidth} for this size's prototype string * computed by the {@code container}'s FontMetrics for the * {@code DefaultUnitConverter}'s default dialog font */ @Override public int maximumSize(Container container, List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure) { Font font = DefaultUnitConverter.getInstance().getDefaultDialogFont(); FontMetrics fm = container.getFontMetrics(font); return fm.stringWidth(getPrototype()); }