/** * Lazily checks and answers whether the Aqua look&feel is active. * * @return {@code true} if the current look&feel is Aqua */ public static boolean isLafAqua() { ensureValidCache(); if (cachedIsLafAqua == null) { cachedIsLafAqua = Boolean.valueOf(computeIsLafAqua()); } return cachedIsLafAqua.booleanValue(); }
/** * Lazily checks and answers whether the Aqua look&feel is active. * * @return {@code true} if the current look&feel is Aqua */ public static boolean isLafAqua() { ensureValidCache(); if (cachedIsLafAqua == null) { cachedIsLafAqua = Boolean.valueOf(computeIsLafAqua()); } return cachedIsLafAqua.booleanValue(); }
/** * Lazily creates and returns a fallback for the dialog font * that is used to compute the dialog base units. * This fallback font is cached and will be reset if the L&F changes. * * @return the cached fallback font used to compute the dialog base units */ private Font getCachedDefaultDialogFont() { FormUtils.ensureValidCache(); if (cachedDefaultDialogFont == null) { cachedDefaultDialogFont = lookupDefaultDialogFont(); } return cachedDefaultDialogFont; }
/** * Lazily creates and returns a fallback for the dialog font * that is used to compute the dialog base units. * This fallback font is cached and will be reset if the L&F changes. * * @return the cached fallback font used to compute the dialog base units */ private Font getCachedDefaultDialogFont() { FormUtils.ensureValidCache(); if (cachedDefaultDialogFont == null) { cachedDefaultDialogFont = lookupDefaultDialogFont(); } return cachedDefaultDialogFont; }
/** * Looks up and returns the dialog base units for the given component. * In case the component is <code>null</code> the global dialog base units * are answered.<p> * * Before we compute the dialog base units we check whether they * have been computed and cached before - for the same component * <code>FontMetrics</code>. * * @param c the component that provides the graphics object * @return the DialogBaseUnits object for the given component */ private DialogBaseUnits getDialogBaseUnits(Component c) { FormUtils.ensureValidCache(); if (c == null) { // || (font = c.getFont()) == null) { // logInfo("Missing font metrics: " + c); return getGlobalDialogBaseUnits(); } FontMetrics fm = c.getFontMetrics(getDefaultDialogFont()); DialogBaseUnits dialogBaseUnits = (DialogBaseUnits) cachedDialogBaseUnits.get(fm); if (dialogBaseUnits == null) { dialogBaseUnits = computeDialogBaseUnits(fm); cachedDialogBaseUnits.put(fm, dialogBaseUnits); } return dialogBaseUnits; }
/** * Looks up and returns the dialog base units for the given component. * In case the component is {@code null} the global dialog base units * are answered.<p> * * Before we compute the dialog base units we check whether they * have been computed and cached before - for the same component * {@code FontMetrics}. * * @param c the component that provides the graphics object * @return the DialogBaseUnits object for the given component */ private DialogBaseUnits getDialogBaseUnits(Component c) { FormUtils.ensureValidCache(); if (c == null) { // || (font = c.getFont()) == null) { // logInfo("Missing font metrics: " + c); return getGlobalDialogBaseUnits(); } FontMetrics fm = c.getFontMetrics(getDefaultDialogFont()); if (fm.equals(cachedFontMetrics)) { return cachedDialogBaseUnits; } DialogBaseUnits dialogBaseUnits = computeDialogBaseUnits(fm); cachedFontMetrics = fm; cachedDialogBaseUnits = dialogBaseUnits; return dialogBaseUnits; }