Package com.formdev.flatlaf.ui
Class FlatTitlePane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- com.formdev.flatlaf.ui.FlatTitlePane
-
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
public class FlatTitlePane extends JComponent
Provides the Flat LaF title bar.- See Also:
- Serialized Form
- UiDefault:
- TitlePane.font Font, TitlePane.background Color, TitlePane.inactiveBackground Color, TitlePane.foreground Color, TitlePane.inactiveForeground Color, TitlePane.embeddedForeground Color, TitlePane.borderColor Color optional, TitlePane.unifiedBackground boolean, TitlePane.showIcon boolean, TitlePane.showIconInDialogs boolean, TitlePane.noIconLeftGap int, TitlePane.iconSize Dimension, TitlePane.iconMargins Insets, TitlePane.titleMargins Insets, TitlePane.menuBarEmbedded boolean, TitlePane.titleMinimumWidth int, TitlePane.buttonMinimumWidth int, TitlePane.buttonMaximizedHeight int, TitlePane.centerTitle boolean, TitlePane.centerTitleIfMenuBarEmbedded boolean, TitlePane.showIconBesideTitle boolean, TitlePane.menuBarTitleGap int, TitlePane.menuBarResizeHeight int, TitlePane.closeIcon Icon, TitlePane.iconifyIcon Icon, TitlePane.maximizeIcon Icon, TitlePane.restoreIcon Icon
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
FlatTitlePane.FlatTitleLabelUI
protected class
FlatTitlePane.FlatTitlePaneBorder
protected class
FlatTitlePane.Handler
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description FlatTitlePane(JRootPane rootPane)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activeChanged(boolean active)
void
addNotify()
protected void
addSubComponents()
protected void
close()
Closes the window.protected JButton
createButton(String iconKey, String accessibleName, ActionListener action)
protected void
createButtons()
protected FlatTitlePane.Handler
createHandler()
protected FlatTitlePane.FlatTitlePaneBorder
createTitlePaneBorder()
protected Component
findHorizontalGlue(JMenuBar menuBar)
protected void
frameStateChanged()
protected Rectangle
getMenuBarBounds()
protected Rectangle
getNativeHitTestSpot(JComponent c)
protected String
getWindowTitle()
protected boolean
hasNativeCustomDecoration()
Returns whether windows uses native window border and has custom decorations enabled.protected boolean
hasVisibleEmbeddedMenuBar(JMenuBar menuBar)
Returns whether this title pane currently has a visible and embedded menubar.protected void
iconify()
Iconifies the window.protected void
installWindowListeners()
protected boolean
isMenuBarEmbedded()
Returns whether the menubar should be embedded into the title pane.protected boolean
isWindowMaximized()
protected void
maximize()
Maximizes the window.protected void
menuBarChanged()
protected void
menuBarLayouted()
void
paint(Graphics g)
protected void
paintComponent(Graphics g)
void
removeNotify()
protected void
repaintWindowBorder()
protected void
restore()
Restores the window size.protected void
titleBarColorsChanged()
protected void
uninstallWindowListeners()
protected void
updateIcon()
protected void
updateMaximizedBounds()
protected void
updateNativeTitleBarHeightAndHitTestSpots()
protected void
updateNativeTitleBarHeightAndHitTestSpotsLater()
protected void
updateVisibility()
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
titleFont
protected final Font titleFont
- Since:
- 2.5
-
activeBackground
protected final Color activeBackground
-
inactiveBackground
protected final Color inactiveBackground
-
activeForeground
protected final Color activeForeground
-
inactiveForeground
protected final Color inactiveForeground
-
embeddedForeground
protected final Color embeddedForeground
-
borderColor
protected final Color borderColor
-
showIcon
protected final boolean showIcon
- Since:
- 2
-
showIconInDialogs
protected final boolean showIconInDialogs
- Since:
- 2.5
-
noIconLeftGap
protected final int noIconLeftGap
- Since:
- 2
-
iconSize
protected final Dimension iconSize
-
titleMinimumWidth
protected final int titleMinimumWidth
- Since:
- 2.4
-
buttonMinimumWidth
protected final int buttonMinimumWidth
- Since:
- 2.4
-
buttonMaximizedHeight
protected final int buttonMaximizedHeight
-
centerTitle
protected final boolean centerTitle
-
centerTitleIfMenuBarEmbedded
protected final boolean centerTitleIfMenuBarEmbedded
-
showIconBesideTitle
protected final boolean showIconBesideTitle
- Since:
- 2.4
-
menuBarTitleGap
protected final int menuBarTitleGap
-
menuBarTitleMinimumGap
protected final int menuBarTitleMinimumGap
- Since:
- 2.4
-
menuBarResizeHeight
protected final int menuBarResizeHeight
- Since:
- 2.4
-
rootPane
protected final JRootPane rootPane
-
leftPanel
protected JPanel leftPanel
-
iconLabel
protected JLabel iconLabel
-
menuBarPlaceholder
protected JComponent menuBarPlaceholder
-
titleLabel
protected JLabel titleLabel
-
buttonPanel
protected JPanel buttonPanel
-
iconifyButton
protected JButton iconifyButton
-
maximizeButton
protected JButton maximizeButton
-
restoreButton
protected JButton restoreButton
-
closeButton
protected JButton closeButton
-
window
protected Window window
-
-
Constructor Detail
-
FlatTitlePane
public FlatTitlePane(JRootPane rootPane)
-
-
Method Detail
-
createTitlePaneBorder
protected FlatTitlePane.FlatTitlePaneBorder createTitlePaneBorder()
-
createHandler
protected FlatTitlePane.Handler createHandler()
-
addSubComponents
protected void addSubComponents()
-
createButtons
protected void createButtons()
-
createButton
protected JButton createButton(String iconKey, String accessibleName, ActionListener action)
-
activeChanged
protected void activeChanged(boolean active)
-
frameStateChanged
protected void frameStateChanged()
-
updateVisibility
protected void updateVisibility()
- Since:
- 3
-
updateIcon
protected void updateIcon()
-
addNotify
public void addNotify()
- Overrides:
addNotify
in classJComponent
-
removeNotify
public void removeNotify()
- Overrides:
removeNotify
in classJComponent
-
getWindowTitle
protected String getWindowTitle()
-
installWindowListeners
protected void installWindowListeners()
-
uninstallWindowListeners
protected void uninstallWindowListeners()
-
hasVisibleEmbeddedMenuBar
protected boolean hasVisibleEmbeddedMenuBar(JMenuBar menuBar)
Returns whether this title pane currently has a visible and embedded menubar.
-
isMenuBarEmbedded
protected boolean isMenuBarEmbedded()
Returns whether the menubar should be embedded into the title pane.
-
getMenuBarBounds
protected Rectangle getMenuBarBounds()
-
titleBarColorsChanged
protected void titleBarColorsChanged()
-
menuBarChanged
protected void menuBarChanged()
-
menuBarLayouted
protected void menuBarLayouted()
-
paint
public void paint(Graphics g)
- Overrides:
paint
in classJComponent
-
paintComponent
protected void paintComponent(Graphics g)
- Overrides:
paintComponent
in classJComponent
-
repaintWindowBorder
protected void repaintWindowBorder()
-
iconify
protected void iconify()
Iconifies the window.
-
isWindowMaximized
protected boolean isWindowMaximized()
- Since:
- 2.4
-
maximize
protected void maximize()
Maximizes the window.
-
updateMaximizedBounds
protected void updateMaximizedBounds()
-
restore
protected void restore()
Restores the window size.
-
close
protected void close()
Closes the window.
-
hasNativeCustomDecoration
protected boolean hasNativeCustomDecoration()
Returns whether windows uses native window border and has custom decorations enabled.
-
updateNativeTitleBarHeightAndHitTestSpotsLater
protected void updateNativeTitleBarHeightAndHitTestSpotsLater()
-
updateNativeTitleBarHeightAndHitTestSpots
protected void updateNativeTitleBarHeightAndHitTestSpots()
-
getNativeHitTestSpot
protected Rectangle getNativeHitTestSpot(JComponent c)
-
-