JavaSwingLookAndFeel: Fonts


Fonts

LAF fonts

strange/incorrect policies marked

Class

UIResource fonts

(only irregular named)

Used

Internally used fonts

Additional remarks

TitledBorder

"TitledBorder.font"

X (unless given)

last fallback (shouldn't happen): hardcoded "Dialog", plain, 12pt

BasicButtonUI

Prefix+".font"

X

BasicComboBoxUI

X

r/e

transfers (dynamically) to renderer, editor component, internal JList

(also Metal, Motif)

BasicInternalFrameTitlePane

MetalInternalFrameTitlePane

MetalTitlePane(!)

"InternalFrame.titleFont"

(but whole title pane is internal)

X

MotifInternalFrameTitlePane

X

hardcoded "Sans-Serif", plain, 12pt

BasicLabelUI

X

X

BasicListUI

X

r

BasicMenuBarUI

X

BasicMenuItemUI

Prefix+".font"

X

"MenuItem.acceleratorFont"(!)

MotifGraphicsUtils.paintMenuItem uses "MenuItem.acceleratorFont"

BasicPopupMenuUI

X

MotifPopupMenuUI

(border)

"PopupMenu.font" (from LAF defaults)

MotifBorders.PopupMenuBorder is created with "PopupMenu.font"

BasicPanelUI

X

BasicProgressBarUI

X

X

rotates for vertical

BasicScrollPaneUI

X

BasicSpinnerUI

X

(e)

BasicTabbedPaneUI

X

X

BasicTableUI

X

r/e

BasicTableHeaderUI

X

r

BasicTextUI

Prefix+".font"

maybe

BasicTextPaneUI transfers to document's DEFAULT_STYLE

BasicToolBarUI

X

BasicToolTipUI

X

X

MetalToolTipUI

(X)

X

also uses smaller font (size -2, on creation)

BasicTreeUI

X

r

BasicViewportUI

X

MetalDesktopIconUI

X

also transfered (on creation) to button, only used there

MotifDesktopIconUI

n/a

hardcoded "Sans-Serif", plain, 12pt

BasicColorChooserUI

X

BasicOptionPaneUI

X

"OptionPane.messageFont"

"OptionPane.buttonFont"

MetalFileChooserUI

WindowsFileChooserUI

n/a

uses JTable.setRowHeight based on table's font

The ones without font are:

JRootPane, JInternalFrame, JScrollBar, JSlider(?), JSplitPane (why?), JDesktopPane, JFileChooser, separators, more?, all without UI (JComponent, JFrame, JDialog, JWindow, JLayeredPane)

Calculations based on font's size

Metal/WindowsFileChooserUI (table height, statically (acceptable))

BasicOptionPaneUI (space)

MetalToolTipUI smaller font

Calculations bases on FontMetrics

(also text package)

Using a toolkit's metrics is wrong (#4391936).

Class

Method(s)

from where

PlainView

WrappedPlainView

calculateLongesLine (caches metrics)

updateMetrics

container

FieldView

getFontMetrics <- getPreferredSpan

container

PasswordView

modelToView, viewToModel, getPreferredSpan

container

PasswordView

drawEchoCharacter

Graphics

LabelView

getFontMetrics (unused)

default Toolkit

GlyphPainter1

sync

container's or default Toolkit

StyleContext

getFontMetrics (unused?)

default Toolkit

Utilities

drawTabbedText

Graphics

TitledBorder

paintBorder

Graphics

TitledBorder

getBorderInsets,

getMinimumSize

Component

DefaultPreviewPanel

getPreferredSize

default Toolkit

DefaultPreviewPanel

paint text

Graphics

BasicGraphicsUtils

drawStringUnderlineCharAt: called from

Basic(Button|Label|MenuItem|TabbedPane)UI paint methods

Metal(Button|Label|RadioButton|ToggleButton)UI paint methods

Windows(Label|Menu|MenuItem)UI paint methods

MotifGraphicsUtils.paintMenuItem (see there)

WindowsGraphicsUtils.paintText (see there)

Graphics

BasicGraphicsUtils

getPreferredButtonSize <- BasicButtonUI.getPreferredSize

button's Toolkit

BasicButtonUI

BasicRadioButtonUI

BasicToggleButtonUI

MetalButtonUI

MetalRadioButtonUI

MetalToggleButtonUI

paint and/or paintText

Graphics

BasicRadioButtonUI

getPreferredSize

button's Toolkit

BasicMenuItemUI

WindowsMenuItemUI

WindowsMenuUI

paintMenuItem and/or paintText

Graphics

BasicMenuItemUI

getPreferredMenuItemSize

item's Toolkit

BasicLabelUI

paint

Graphics

BasicLabelUI

getPreferredSize

label's Toolkit

BasicProgressBarUI

getStringPlacement (called from paint, given Graphics!)

getPreferredSize

bar

BasicTabbedPaneUI

paintTab

Graphics

BasicTabbedPaneUI

getFontMetrics (called all over the place, also from Metal)

default Toolkit

BasicToolTipUI

MetalToolTipUI

paint

getPreferredSize

default Toolkit

BasicInternalFrameTitlePane

MetalInternalFrameTitlePane

WindowsInternalFrameTitlePane

MetalTitlePane

paintComponent

Graphics

BasicInternalFrameTitlePane. TitlePaneLayout

MetalInternalFrameTitlePane. TitlePaneLayout

minimum(+preferred)LayoutSize

title pane

MetalTitlePane.TitlePaneLayout

minimum(+preferred)LayoutSize

default Toolkit

WindowsGraphicsUtils

paintText <- Windows(Button | ToggleButton | RadioButton | Menu | MenuItem)UI.paintText

Graphics

MotifBorders.PopupMenuBorder

paintBorder

Graphics

MotifBorders.PopupMenuBorder

getBorderInsets

popup menu

MotifGraphicsUtils

drawStringInRect <- MotifInternalFrameTitlePane.Title.paint

paintMenuItem <- Motif(Menu | CheckBoxMenuItem | RadioButtonMenuItem | MenuItem)UI.paint

Graphics

MotifPopupMenuUI

getPreferredSize

popup menu

MotifDesktopIconUI.IconLabel

getPreferredSize

default Toolkit

No calculations based on LineMetrics.

TextLayout only used in text package (TextLayoutStrategy, GlyphPainter2, Utilities)


(C) 2001-2009 Christian Kaufhold (swing@chka.de)