public final class UIUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
UIUtil.ComponentStyle |
static class |
UIUtil.FontColor |
static class |
UIUtil.FontSize |
static class |
UIUtil.GrayFilter |
static class |
UIUtil.JBWordWrapHtmlEditorKit |
static class |
UIUtil.TextPainter |
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
AQUA_SEPARATOR_BACKGROUND_COLOR |
static java.lang.String |
BORDER_LINE |
static java.lang.String |
BR |
static java.lang.String |
CENTER_TOOLTIP_DEFAULT |
static java.lang.String |
CENTER_TOOLTIP_STRICT |
static java.lang.String |
CHECKBOX_PRESSED_PROPERTY |
static java.lang.String |
CHECKBOX_ROLLOVER_PROPERTY |
static java.awt.Color |
CONTRAST_BORDER_COLOR |
static int |
DEFAULT_HGAP |
static int |
DEFAULT_VGAP |
static java.lang.String |
HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY
Prevent component DataContext from returning parent editor
Useful for components that are manually painted over the editor to prevent shortcuts from falling-through to editor
Usage:
component.putClientProperty(HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, Boolean.TRUE) |
static java.lang.String |
HTML_MIME |
static java.lang.String |
JSLIDER_ISFILLED |
static Key<java.lang.Integer> |
KEEP_BORDER_SIDES |
static Key<java.lang.Boolean> |
LAF_WITH_THEME_KEY |
static int |
LARGE_VGAP |
static int |
LIST_FIXED_CELL_HEIGHT |
static char |
MNEMONIC |
static Key<java.lang.Iterable<? extends java.awt.Component>> |
NOT_IN_HIERARCHY_COMPONENTS |
static java.awt.Insets |
PANEL_REGULAR_INSETS |
static java.awt.Insets |
PANEL_SMALL_INSETS |
static Key<java.lang.String> |
PLUGGABLE_LAF_KEY |
static java.awt.Color |
SIDE_PANEL_BACKGROUND |
static java.lang.String |
TABLE_FOCUS_CELL_BACKGROUND_PROPERTY |
static Key<java.lang.Boolean> |
TEXT_COPY_ROOT
Alt+click does copy text from tooltip or balloon to clipboard.
|
static java.awt.Color |
TRANSPARENT_COLOR |
Modifier and Type | Method and Description |
---|---|
static void |
addAwtListener(java.awt.event.AWTEventListener listener,
long mask,
Disposable parent) |
static void |
addBorder(javax.swing.JComponent component,
javax.swing.border.Border border)
Adds the specified border to the specified component.
|
static void |
addInsets(javax.swing.JComponent component,
java.awt.Insets insets)
Adds an empty border with the specified insets to the specified component.
|
static void |
addInsets(javax.swing.JComponent component,
int top,
int left,
int bottom,
int right)
Adds an empty border with the specified insets to the specified component.
|
static java.lang.String |
addPadding(java.lang.String html,
int hPadding) |
static void |
addParentChangeListener(java.awt.Component component,
java.beans.PropertyChangeListener listener) |
static void |
addUndoRedoActions(javax.swing.text.JTextComponent textComponent) |
static void |
adjustWindowToMinimumSize(java.awt.Window window) |
static void |
appendColor(java.awt.Color color,
java.lang.StringBuilder sb) |
static void |
applyRenderingHints(java.awt.Graphics g)
Deprecated.
|
static void |
applyStyle(UIUtil.ComponentStyle componentStyle,
java.awt.Component comp) |
static void |
assignMnemonic(java.lang.String text,
javax.swing.Action action) |
static boolean |
canDisplayFocusedState(java.awt.Component component) |
static void |
changeBackGround(java.awt.Component component,
java.awt.Color background)
Avoid blinking while changing background.
|
static void |
configureNumericFormattedTextField(javax.swing.JFormattedTextField textField)
It is your responsibility to set correct horizontal align (left in case of UI Designer)
|
static java.lang.String |
convertSpace2Nbsp(java.lang.String html) |
static java.awt.image.BufferedImage |
createImage(java.awt.Component comp,
int width,
int height,
int type)
Creates a HiDPI-aware BufferedImage in the component scale.
|
static java.awt.image.BufferedImage |
createImage(java.awt.GraphicsConfiguration gc,
double width,
double height,
int type,
PaintUtil.RoundingMode rm)
Creates a HiDPI-aware BufferedImage in the graphics config scale.
|
static java.awt.image.BufferedImage |
createImage(java.awt.GraphicsConfiguration gc,
int width,
int height,
int type)
Deprecated.
|
static java.awt.image.BufferedImage |
createImage(java.awt.Graphics g,
double width,
double height,
int type,
PaintUtil.RoundingMode rm)
Deprecated.
Use
ImageUtil#createImage(Graphics, double, double, int, RoundingMode) |
static java.awt.image.BufferedImage |
createImage(java.awt.Graphics g,
int width,
int height,
int type)
Deprecated.
|
static java.awt.image.BufferedImage |
createImage(int width,
int height,
int type)
Deprecated.
|
static java.awt.image.BufferedImage |
createImage(ScaleContext ctx,
double width,
double height,
int type,
PaintUtil.RoundingMode rm) |
static java.awt.image.BufferedImage |
createImageForGraphics(java.awt.Graphics2D g,
int width,
int height,
int type)
Deprecated.
|
static javax.swing.Timer |
createNamedTimer(java.lang.String name,
int delay)
Deprecated.
|
static javax.swing.Timer |
createNamedTimer(java.lang.String name,
int delay,
java.awt.event.ActionListener listener)
Deprecated.
|
static java.awt.Cursor |
cursorIfNotDefault(java.awt.Cursor cursorToSet) |
static void |
decorateWindowHeader(javax.swing.JRootPane pane) |
static void |
dispatchAllInvocationEvents()
Dispatch all pending invocation events (if any) in the
IdeEventQueue , ignores and removes all other events from the queue. |
static java.lang.String |
displayPropertiesToCSS(java.awt.Font font,
java.awt.Color fg) |
static void |
dispose(java.awt.Component c) |
static void |
disposeProgress(javax.swing.JProgressBar progress) |
static void |
doNotScrollToCaret(javax.swing.text.JTextComponent textComponent) |
static void |
drawBoldDottedLine(java.awt.Graphics2D g,
int startX,
int endX,
int lineY,
java.awt.Color bgColor,
java.awt.Color fgColor,
boolean opaque)
Should be invoked only in EDT.
|
static void |
drawCenteredString(java.awt.Graphics2D g,
java.awt.Rectangle rect,
java.lang.String str)
Draws a centered string in the passed rectangle.
|
static void |
drawCenteredString(java.awt.Graphics2D g,
java.awt.Rectangle rect,
java.lang.String str,
boolean horzCentered,
boolean vertCentered)
Draws a centered string in the passed rectangle.
|
static void |
drawDottedLine(java.awt.Graphics2D g,
int x1,
int y1,
int x2,
int y2,
java.awt.Color bgColor,
java.awt.Color fgColor) |
static void |
drawDottedRectangle(java.awt.Graphics g,
int x,
int y,
int x1,
int y1) |
static void |
drawDottedRectangle(java.awt.Graphics g,
java.awt.Rectangle r) |
static void |
drawDoubleSpaceDottedLine(java.awt.Graphics2D g,
int start,
int end,
int xOrY,
java.awt.Color fgColor,
boolean horizontal) |
static void |
drawGradientHToolbarBackground(java.awt.Graphics g,
int width,
int height) |
static void |
drawHDottedLine(java.awt.Graphics2D g,
int startX,
int endX,
int lineY,
java.awt.Color bgColor,
java.awt.Color fgColor) |
static void |
drawHeader(java.awt.Graphics g,
int x,
int width,
int height,
boolean active,
boolean drawTopLine) |
static void |
drawHeader(java.awt.Graphics g,
int x,
int width,
int height,
boolean active,
boolean toolWindow,
boolean drawTopLine,
boolean drawBottomLine) |
static void |
drawImage(java.awt.Graphics g,
java.awt.image.BufferedImage image,
java.awt.image.BufferedImageOp op,
int x,
int y) |
static void |
drawImage(java.awt.Graphics g,
java.awt.Image image,
int x,
int y,
java.awt.image.ImageObserver observer) |
static void |
drawImage(java.awt.Graphics g,
java.awt.Image image,
java.awt.Rectangle dstBounds,
java.awt.Rectangle srcBounds,
java.awt.image.ImageObserver observer) |
static void |
drawLabelDottedRectangle(javax.swing.JLabel label,
java.awt.Graphics g) |
static void |
drawLabelDottedRectangle(javax.swing.JLabel label,
java.awt.Graphics g,
java.awt.Rectangle bounds) |
static void |
drawLine(java.awt.Graphics2D g,
int x1,
int y1,
int x2,
int y2,
java.awt.Color bgColor,
java.awt.Color fgColor) |
static void |
drawLine(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
Deprecated.
|
static void |
drawLinePickedOut(java.awt.Graphics graphics,
int x,
int y,
int x1,
int y1) |
static void |
drawSearchMatch(java.awt.Graphics2D g,
float startX,
float endX,
int height) |
static void |
drawSearchMatch(java.awt.Graphics2D g,
float startXf,
float endXf,
int height,
java.awt.Color c1,
java.awt.Color c2) |
static void |
drawStringWithHighlighting(java.awt.Graphics g,
java.lang.String s,
int x,
int y,
java.awt.Color foreground,
java.awt.Color highlighting) |
static void |
drawVDottedLine(java.awt.Graphics2D g,
int lineX,
int startY,
int endY,
java.awt.Color bgColor,
java.awt.Color fgColor) |
static void |
drawWave(java.awt.Graphics2D g,
java.awt.Rectangle rectangle) |
static <T extends javax.swing.JComponent> |
findComponentOfType(javax.swing.JComponent parent,
java.lang.Class<T> cls) |
static <T extends javax.swing.JComponent> |
findComponentsOfType(javax.swing.JComponent parent,
java.lang.Class<? extends T> cls) |
static java.awt.Component |
findNearestOpaque(java.awt.Component c) |
static java.awt.Component |
findParentByCondition(java.awt.Component c,
Condition<? super java.awt.Component> condition)
|
static java.awt.Component |
findUltimateParent(java.awt.Component c) |
static int |
fixComboBoxHeight(int height)
Deprecated.
the method was used to fix Aqua Look-n-Feel problems. Now it does not make sense
|
static void |
fixFormattedField(javax.swing.JFormattedTextField field) |
static void |
fixOSXEditorBackground(javax.swing.JTable table) |
static java.awt.Color |
getActiveTextColor() |
static java.awt.Color |
getActiveTextFieldBackgroundColor()
Deprecated.
use
getTextFieldBackground() instead |
static javax.swing.Icon |
getBalloonErrorIcon() |
static javax.swing.Icon |
getBalloonInformationIcon() |
static javax.swing.Icon |
getBalloonWarningIcon() |
static java.awt.Color |
getBgFillColor(java.awt.Component c) |
static java.awt.Color |
getBorderActiveColor()
Deprecated.
use getBorderColor instead
|
static java.awt.Color |
getBorderInactiveColor()
Deprecated.
use getBorderColor instead
|
static java.awt.Color |
getBorderSeparatorColor()
Deprecated.
use getBorderColor instead
|
static java.awt.Color |
getBoundsColor() |
static java.awt.Color |
getBoundsColor(boolean focused) |
static java.awt.Font |
getButtonFont() |
static java.awt.Color |
getButtonSelectColor() |
static Couple<java.awt.Color> |
getCellColors(javax.swing.JTable table,
boolean isSel,
int row,
int column) |
static java.awt.Point |
getCenterPoint(java.awt.Dimension container,
java.awt.Dimension child) |
static java.awt.Point |
getCenterPoint(java.awt.Rectangle container,
java.awt.Dimension child) |
static int |
getCheckBoxTextHorizontalOffset(javax.swing.JCheckBox cb) |
static <T> T |
getClientProperty(java.lang.Object component,
java.lang.Class<T> type) |
static <T> T |
getClientProperty(java.lang.Object component,
Key<T> key) |
static java.lang.Object |
getClientProperty(java.lang.Object component,
java.lang.Object key) |
static java.awt.Color |
getComboBoxDisabledBackground() |
static java.awt.Color |
getComboBoxDisabledForeground() |
static javax.swing.plaf.basic.ComboPopup |
getComboBoxPopup(javax.swing.JComboBox<?> comboBox) |
static UIUtil.ComponentStyle |
getComponentStyle(java.awt.Component component)
Calculates a component style from the corresponding client property.
|
static java.awt.Color |
getContextHelpForeground() |
static java.awt.Color |
getControlColor() |
static java.lang.String |
getCssFontDeclaration(java.awt.Font font) |
static java.lang.String |
getCssFontDeclaration(java.awt.Font font,
java.awt.Color fgColor,
java.awt.Color linkColor,
java.lang.String liImg) |
static java.lang.String |
getDebugText(java.awt.Component c) |
static java.awt.Color |
getDecoratedRowColor() |
static java.awt.Component |
getDeepestComponentAt(java.awt.Component parent,
int x,
int y) |
static int |
getDisplayMnemonicIndex(java.lang.String s) |
static java.awt.Color |
getEditorPaneBackground() |
static javax.swing.Icon |
getErrorIcon() |
static java.awt.Color |
getFieldForegroundColor() |
static java.awt.Color |
getFocusedBorderColor() |
static java.awt.Color |
getFocusedBoundsColor() |
static java.awt.Color |
getFocusedFillColor() |
static java.awt.Font |
getFont(UIUtil.FontSize size,
java.awt.Font base) |
static float |
getFontSize(UIUtil.FontSize size) |
static javax.swing.plaf.FontUIResource |
getFontWithFallback(java.awt.Font font) |
static javax.swing.plaf.FontUIResource |
getFontWithFallback(java.lang.String familyName,
int style,
int size) |
static java.awt.Paint |
getGradientPaint(float x1,
float y1,
java.awt.Color c1,
float x2,
float y2,
java.awt.Color c2) |
static java.awt.image.RGBImageFilter |
getGrayFilter() |
static java.awt.Color |
getHeaderActiveColor() |
static java.awt.Color |
getHeaderInactiveColor() |
static int |
getHighestGlyphHeight(java.lang.String string,
java.awt.Font font,
java.awt.Graphics graphics) |
static java.lang.String |
getHtmlBody(Html html) |
static java.lang.String |
getHtmlBody(java.lang.String text) |
static javax.swing.text.html.HTMLEditorKit |
getHTMLEditorKit() |
static javax.swing.text.html.HTMLEditorKit |
getHTMLEditorKit(boolean noGapsBetweenParagraphs) |
static java.awt.Color |
getInactiveTextColor() |
static java.awt.Color |
getInactiveTextFieldBackgroundColor() |
static javax.swing.Icon |
getInformationIcon() |
static java.awt.Color |
getLabelBackground() |
static java.awt.Color |
getLabelDisabledForeground() |
static java.awt.Font |
getLabelFont() |
static java.awt.Font |
getLabelFont(UIUtil.FontSize size) |
static java.awt.Color |
getLabelFontColor(UIUtil.FontColor fontColor) |
static java.awt.Color |
getLabelForeground() |
static java.awt.Rectangle |
getLabelTextBounds(javax.swing.JLabel label) |
static java.awt.Color |
getLabelTextForeground() |
static int |
getLcdContrastValue() |
static int |
getLineHeight(javax.swing.text.JTextComponent textComponent) |
static java.awt.Color |
getListBackground() |
static java.awt.Color |
getListBackground(boolean selected)
Deprecated.
|
static java.awt.Color |
getListBackground(boolean selected,
boolean focused) |
static int |
getListCellHPadding() |
static java.awt.Insets |
getListCellPadding() |
static int |
getListCellVPadding() |
static java.awt.Font |
getListFont() |
static java.awt.Color |
getListForeground() |
static java.awt.Color |
getListForeground(boolean selected)
Deprecated.
|
static java.awt.Color |
getListForeground(boolean selected,
boolean focused) |
static java.awt.Color |
getListSelectionBackground()
Deprecated.
|
static java.awt.Color |
getListSelectionBackground(boolean focused) |
static java.awt.Color |
getListSelectionForeground()
Deprecated.
|
static java.awt.Color |
getListSelectionForeground(boolean focused) |
static java.awt.Color |
getListUnfocusedSelectionBackground()
Deprecated.
|
static java.awt.Insets |
getListViewportPadding() |
static java.awt.Point |
getLocationOnScreen(javax.swing.JComponent component) |
static java.awt.Font |
getMenuFont() |
static java.awt.Color |
getMenuItemDisabledForeground() |
static java.lang.Object |
getMenuItemDisabledForegroundObject() |
static int |
getMultiClickInterval() |
static java.awt.Color |
getOptionPaneBackground() |
static java.awt.Font |
getOptionPaneMessageFont() |
static java.awt.Color |
getPanelBackgound()
Deprecated.
use
getPanelBackground() instead |
static java.awt.Color |
getPanelBackground() |
static <T> T |
getParentOfType(java.lang.Class<? extends T> type,
java.awt.Component component)
Searches above in the component hierarchy starting from the specified component.
|
static javax.swing.JComponent |
getPreferredFocusedComponent(java.awt.Container container)
Returns the first focusable component in the specified container.
|
static java.lang.Integer |
getPropertyMaxGutterIconWidth(java.lang.String propertyPrefix) |
static javax.swing.Icon |
getQuestionIcon() |
static javax.swing.Icon |
getRadioButtonIcon()
Deprecated.
|
static JBInsets |
getRegularPanelInsets() |
static javax.swing.JRootPane |
getRootPane(java.awt.Component c) |
static int |
getScrollBarWidth() |
static int |
getSelectedButton(javax.swing.ButtonGroup group) |
static java.awt.Color |
getSeparatorColor()
Deprecated.
|
static java.awt.Color |
getSeparatorForeground()
Deprecated.
|
static java.awt.Color |
getSeparatorHighlight()
Deprecated.
|
static java.awt.Color |
getSeparatorShadow() |
static java.lang.String [] |
getStandardFontSizes() |
static int |
getStringY(java.lang.String string,
java.awt.Rectangle bounds,
java.awt.Graphics2D g) |
static Pair<java.lang.String,java.lang.Integer> |
getSystemFontData()
Deprecated.
|
static java.lang.Object |
getTabbedPanePaintContentBorder(javax.swing.JComponent c) |
static java.awt.Color |
getTableBackground() |
static java.awt.Color |
getTableBackground(boolean selected)
Deprecated.
|
static java.awt.Color |
getTableBackground(boolean selected,
boolean focused) |
static java.awt.Color |
getTableFocusCellBackground() |
static java.awt.Color |
getTableFocusCellForeground() |
static javax.swing.border.Border |
getTableFocusCellHighlightBorder() |
static java.awt.Color |
getTableForeground() |
static java.awt.Color |
getTableForeground(boolean selected)
Deprecated.
|
static java.awt.Color |
getTableForeground(boolean selected,
boolean focused) |
static java.awt.Color |
getTableGridColor() |
static javax.swing.border.Border |
getTableHeaderCellBorder()
Deprecated.
|
static java.awt.Color |
getTableSelectionBackground()
Deprecated.
|
static java.awt.Color |
getTableSelectionBackground(boolean focused) |
static java.awt.Color |
getTableSelectionForeground()
Deprecated.
|
static java.awt.Color |
getTableSelectionForeground(boolean focused) |
static java.awt.Color |
getTableUnfocusedSelectionBackground()
Deprecated.
|
static java.awt.Color |
getTextAreaForeground() |
static java.awt.Cursor |
getTextCursor(java.awt.Color backgroundColor) |
static java.awt.Color |
getTextFieldBackground() |
static javax.swing.border.Border |
getTextFieldBorder() |
static java.awt.Color |
getTextFieldForeground() |
static java.awt.image.RGBImageFilter |
getTextGrayFilter() |
static java.awt.Color |
getTextInactiveTextColor()
Deprecated.
use
getInactiveTextColor() instead |
static java.awt.Font |
getTitledBorderFont() |
static java.awt.Font |
getToolbarFont() |
static java.awt.Color |
getToolTipActionBackground() |
static java.awt.Color |
getToolTipBackground() |
static java.awt.Font |
getToolTipFont() |
static java.awt.Color |
getToolTipForeground() |
static java.awt.Color |
getTooltipSeparatorColor() |
static java.awt.Color |
getTreeBackground() |
static java.awt.Color |
getTreeBackground(boolean selected,
boolean focused) |
static javax.swing.Icon |
getTreeCollapsedIcon() |
static javax.swing.Icon |
getTreeExpandedIcon() |
static java.awt.Font |
getTreeFont() |
static java.awt.Color |
getTreeForeground() |
static java.awt.Color |
getTreeForeground(boolean selected,
boolean focused) |
static javax.swing.Icon |
getTreeIcon(boolean expanded)
Deprecated.
|
static int |
getTreeLeftChildIndent() |
static javax.swing.Icon |
getTreeNodeIcon(boolean expanded,
boolean selected,
boolean focused) |
static int |
getTreeRightChildIndent() |
static javax.swing.Icon |
getTreeSelectedCollapsedIcon() |
static javax.swing.Icon |
getTreeSelectedExpandedIcon() |
static java.awt.Color |
getTreeSelectionBackground()
Deprecated.
|
static java.awt.Color |
getTreeSelectionBackground(boolean focused) |
static java.awt.Color |
getTreeSelectionBorderColor() |
static java.awt.Color |
getTreeSelectionForeground()
Deprecated.
|
static java.awt.Color |
getTreeSelectionForeground(boolean focused) |
static java.awt.Color |
getTreeTextBackground()
Deprecated.
|
static java.awt.Color |
getTreeTextForeground()
Deprecated.
|
static java.awt.Color |
getTreeUnfocusedSelectionBackground()
Deprecated.
|
static javax.swing.undo.UndoManager |
getUndoManager(java.awt.Component component) |
static java.lang.String [] |
getValidFontNames(boolean familyName) |
static javax.swing.Icon |
getWarningIcon() |
static java.awt.Window |
getWindow(java.awt.Component component)
Returns the first window ancestor of the component.
|
static java.lang.Object |
getWindowClientProperty(java.awt.Window window,
java.lang.Object key) |
static java.awt.Color |
getWindowColor() |
static boolean |
hasComponentOfType(java.awt.Component component,
java.lang.Class<?>... types)
Indicates whether the specified component is instance of one of the specified types
or it contains an instance of one of the specified types.
|
static boolean |
hasScrollPane(java.awt.Component component)
Indicates whether the specified component is scrollable or it contains a scrollable content.
|
static boolean |
haveCommonOwner(java.awt.Component c1,
java.awt.Component c2) |
static <T> T |
htmlInjectionGuard(T toRender) |
static <T> T |
invokeAndWaitIfNeeded(Computable<T> computable)
Please use Application.invokeAndWait() with a modality state (or GuiUtils, or TransactionGuard methods), unless you work with Swings internals
and 'runnable' deals with Swings components only and doesn't access any PSI, VirtualFiles, project/module model or other project settings.
Invoke and wait in the event dispatch thread
or in the current thread if the current thread
is event queue thread.
|
static void |
invokeAndWaitIfNeeded(java.lang.Runnable runnable)
Please use Application.invokeAndWait() with a modality state (or GuiUtils, or TransactionGuard methods), unless you work with Swings internals
and 'runnable' deals with Swings components only and doesn't access any PSI, VirtualFiles, project/module model or other project settings.
Invoke and wait in the event dispatch thread
or in the current thread if the current thread
is event queue thread.
|
static void |
invokeAndWaitIfNeeded(ThrowableRunnable<?> runnable)
Please use Application.invokeAndWait() with a modality state (or GuiUtils, or TransactionGuard methods), unless you work with Swings internals
and 'runnable' deals with Swings components only and doesn't access any PSI, VirtualFiles, project/module model or other project settings.
Invoke and wait in the event dispatch thread
or in the current thread if the current thread
is event queue thread.
|
static void |
invokeLaterIfNeeded(java.lang.Runnable runnable)
Please use Application.invokeLater() with a modality state (or GuiUtils, or TransactionGuard methods), unless you work with Swings internals
and 'runnable' deals with Swings components only and doesn't access any PSI, VirtualFiles, project/module model or other project settings.
|
static boolean |
isActionClick(java.awt.event.MouseEvent e) |
static boolean |
isActionClick(java.awt.event.MouseEvent e,
int effectiveType) |
static boolean |
isActionClick(java.awt.event.MouseEvent e,
int effectiveType,
boolean allowShift) |
static boolean |
isAncestor(java.awt.Component ancestor,
java.awt.Component descendant) |
static boolean |
isAppleRetina()
Deprecated.
use
JBUIScale instead |
static boolean |
isClientPropertyTrue(java.lang.Object component,
java.lang.Object key) |
static boolean |
isCloseClick(java.awt.event.MouseEvent e) |
static boolean |
isCloseClick(java.awt.event.MouseEvent e,
int effectiveType) |
static boolean |
isControlKeyDown(java.awt.event.MouseEvent mouseEvent) |
static boolean |
isDescendingFrom(java.awt.Component child,
java.awt.Component parent)
The main difference from javax.swing.SwingUtilities#isDescendingFrom(Component, Component) is that this method
uses getInvoker() instead of getParent() when it meets JPopupMenu
|
static boolean |
isDialogRootPane(javax.swing.JRootPane rootPane) |
static boolean |
isFocusable(java.awt.Component component) |
static boolean |
isFocusAncestor(java.awt.Component component) |
static boolean |
isFocusProxy(java.awt.Component c) |
static boolean |
isFullRowSelectionLAF() |
static boolean |
isGraphite() |
static boolean |
isHelpButton(java.awt.Component button) |
static boolean |
isJreHiDPI() |
static boolean |
isJreHiDPI(java.awt.Graphics2D g)
Deprecated.
|
static boolean |
isJreHiDPIEnabled()
Deprecated.
|
static boolean |
isMeaninglessFocusOwner(java.awt.Component c) |
static boolean |
isPossibleOwner(java.awt.Dialog dialog) |
static boolean |
isPrinting(java.awt.Graphics g) |
static boolean |
isReallyTypedEvent(java.awt.event.KeyEvent e) |
static boolean |
isRetina() |
static boolean |
isRetina(java.awt.Graphics2D graphics) |
static boolean |
isRetina(java.awt.GraphicsDevice device) |
static boolean |
isSelectionButtonDown(java.awt.event.MouseEvent e) |
static boolean |
isToggleListSelectionEvent(java.awt.event.MouseEvent e) |
static boolean |
isToUseDottedCellBorder() |
static boolean |
isTypeAheadAware(java.awt.Window window) |
static boolean |
isUnderAquaBasedLookAndFeel() |
static boolean |
isUnderAquaLookAndFeel()
Deprecated.
Aqua Look-n-Feel is not supported anymore
|
static boolean |
isUnderDarcula() |
static boolean |
isUnderDefaultMacTheme() |
static boolean |
isUnderGTKLookAndFeel()
Deprecated.
|
static boolean |
isUnderIntelliJLaF() |
static boolean |
isUnderNativeMacLookAndFeel() |
static boolean |
isUnderNimbusLookAndFeel()
Deprecated.
Nimbus Look-n-Feel is deprecated and not supported anymore
|
static boolean |
isUnderWin10LookAndFeel() |
static boolean |
isWindowClientPropertyTrue(java.awt.Window window,
java.lang.Object key) |
static void |
layoutRecursively(java.awt.Component component) |
static javax.swing.text.html.StyleSheet |
loadStyleSheet(java.net.URL url) |
static java.awt.Color |
makeTransparent(java.awt.Color color,
java.awt.Color backgroundColor,
double transparency) |
static void |
markAsPossibleOwner(java.awt.Dialog dialog) |
static void |
markAsTypeAheadAware(java.awt.Window window) |
static void |
maybeInstall(javax.swing.InputMap map,
java.lang.String action,
javax.swing.KeyStroke stroke) |
static javax.swing.JComponent |
mergeComponentsWithAnchor(java.util.Collection<? extends PanelWithAnchor> panels) |
static javax.swing.JComponent |
mergeComponentsWithAnchor(PanelWithAnchor... panels) |
static java.awt.Color |
mix(java.awt.Color c1,
java.awt.Color c2,
double factor) |
static void |
playSoundFromResource(java.lang.String resourceName) |
static void |
playSoundFromStream(Factory<? extends java.io.InputStream> streamProducer) |
static void |
pump() |
static <T> void |
putClientProperty(javax.swing.JComponent component,
Key<T> key,
T value) |
static void |
putWindowClientProperty(java.awt.Window window,
java.lang.Object key,
java.lang.Object value) |
static java.lang.String |
removeMnemonic(java.lang.String s) |
static void |
removeParentChangeListener(java.awt.Component component,
java.beans.PropertyChangeListener listener) |
static void |
removeScrollBorder(java.awt.Component c)
Deprecated.
This method is a hack. Please avoid it and create borderless
JScrollPane manually using
ScrollPaneFactory.createScrollPane(Component, boolean) . |
static void |
repaintViewport(javax.swing.JComponent c) |
static java.lang.String |
replaceMnemonicAmpersand(java.lang.String value) |
static void |
requestFocus(javax.swing.JComponent c)
Deprecated.
use
IdeFocusManager |
static void |
resetUndoRedoActions(javax.swing.text.JTextComponent textComponent) |
static java.lang.String |
rightArrow() |
static void |
runWhenFocused(java.awt.Component component,
java.lang.Runnable runnable) |
static void |
runWhenWindowClosed(java.awt.Window window,
java.lang.Runnable runnable) |
static void |
runWhenWindowOpened(java.awt.Window window,
java.lang.Runnable runnable) |
static void |
scrollListToVisibleIfNeeded(javax.swing.JList<?> list) |
static void |
scrollToReference(javax.swing.JEditorPane editor,
java.lang.String reference)
This method (as opposed to
JEditorPane.scrollToReference(java.lang.String) ) supports also targets using id HTML attribute. |
static void |
setActionNameAndMnemonic(java.lang.String text,
javax.swing.Action action) |
static void |
setAutoRequestFocus(java.awt.Window window,
boolean value) |
static void |
setBackgroundRecursively(java.awt.Component component,
java.awt.Color bg) |
static void |
setColumns(javax.swing.text.JTextComponent textComponent,
int columns) |
static void |
setComboBoxEditorBounds(int x,
int y,
int width,
int height,
javax.swing.JComponent editor) |
static void |
setCursor(java.awt.Component component,
java.awt.Cursor cursor) |
static void |
setCustomTitleBar(java.awt.Window window,
javax.swing.JRootPane rootPane,
java.util.function.Consumer<java.lang.Runnable> onDispose) |
static void |
setEnabled(java.awt.Component component,
boolean enabled,
boolean recursively) |
static void |
setEnabled(java.awt.Component component,
boolean enabled,
boolean recursively,
boolean visibleOnly) |
static void |
setFutureRootPane(javax.swing.JComponent c,
javax.swing.JRootPane pane) |
static void |
setLineStyleAngled(javax.swing.JTree component)
Deprecated.
unsupported UI feature
|
static void |
setNotOpaqueRecursively(java.awt.Component component) |
static void |
setSelectedButton(javax.swing.ButtonGroup group,
int index) |
static void |
setSliderIsFilled(javax.swing.JSlider slider,
boolean value) |
static void |
setupComposite(java.awt.Graphics2D g)
Configures composite to use for drawing text with the given graphics container.
|
static void |
setupEnclosingDialogBounds(javax.swing.JComponent component) |
static java.awt.Color |
shade(java.awt.Color c,
double factor,
double alphaFactor) |
static java.lang.String [] |
splitText(java.lang.String text,
java.awt.FontMetrics fontMetrics,
int widthLimit,
char separator) |
static java.awt.Color |
toAlpha(java.awt.Color color,
int alpha) |
static void |
toFront(java.awt.Window window)
Places the specified window at the top of the stacking order and shows it in front of any other windows.
|
static java.lang.String |
toHtml(java.lang.String html) |
static java.lang.String |
toHtml(java.lang.String html,
int hPadding) |
static JBIterable<java.awt.Component> |
uiChildren(java.awt.Component component) |
static JBIterable<java.awt.Component> |
uiParents(java.awt.Component c,
boolean strict) |
static JBTreeTraverser<java.awt.Component> |
uiTraverser(java.awt.Component component) |
static java.lang.String |
upArrow(java.lang.String defaultValue) |
static java.awt.Dimension |
updateListRowHeight(java.awt.Dimension size) |
static void |
useSafely(java.awt.Graphics originGraphics,
Consumer<? super java.awt.Graphics2D> drawingConsumer)
Employs a common pattern to use
Graphics . |
public static final java.lang.String BORDER_LINE
public static final java.lang.String BR
public static final Key<java.lang.Boolean> LAF_WITH_THEME_KEY
public static final Key<java.lang.String> PLUGGABLE_LAF_KEY
public static final char MNEMONIC
public static final java.lang.String HTML_MIME
public static final java.lang.String JSLIDER_ISFILLED
public static final java.lang.String TABLE_FOCUS_CELL_BACKGROUND_PROPERTY
public static final java.lang.String HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY
component.putClientProperty(HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, Boolean.TRUE)
public static final java.lang.String CENTER_TOOLTIP_DEFAULT
public static final java.lang.String CENTER_TOOLTIP_STRICT
public static final Key<java.lang.Integer> KEEP_BORDER_SIDES
public static final Key<java.lang.Boolean> TEXT_COPY_ROOT
public static final java.awt.Color CONTRAST_BORDER_COLOR
public static final java.awt.Color SIDE_PANEL_BACKGROUND
public static final java.awt.Color AQUA_SEPARATOR_BACKGROUND_COLOR
public static final java.awt.Color TRANSPARENT_COLOR
public static final int DEFAULT_HGAP
public static final int DEFAULT_VGAP
public static final int LARGE_VGAP
public static final java.awt.Insets PANEL_REGULAR_INSETS
public static final java.awt.Insets PANEL_SMALL_INSETS
public static final int LIST_FIXED_CELL_HEIGHT
public static final Key<java.lang.Iterable<? extends java.awt.Component>> NOT_IN_HIERARCHY_COMPONENTS
public static final java.lang.String CHECKBOX_ROLLOVER_PROPERTY
public static final java.lang.String CHECKBOX_PRESSED_PROPERTY
public static void decorateWindowHeader(javax.swing.JRootPane pane)
public static void setCustomTitleBar(java.awt.Window window, javax.swing.JRootPane rootPane, java.util.function.Consumer<java.lang.Runnable> onDispose)
public static void markAsTypeAheadAware(java.awt.Window window)
public static boolean isTypeAheadAware(java.awt.Window window)
public static void markAsPossibleOwner(java.awt.Dialog dialog)
public static boolean isPossibleOwner(java.awt.Dialog dialog)
public static int getMultiClickInterval()
public static void applyStyle(UIUtil.ComponentStyle componentStyle, java.awt.Component comp)
public static java.awt.Cursor getTextCursor(java.awt.Color backgroundColor)
public static java.awt.Cursor cursorIfNotDefault(java.awt.Cursor cursorToSet)
public static java.awt.image.RGBImageFilter getGrayFilter()
public static java.awt.image.RGBImageFilter getTextGrayFilter()
@Deprecated public static boolean isAppleRetina()
JBUIScale
insteadpublic static Couple<java.awt.Color> getCellColors(javax.swing.JTable table, boolean isSel, int row, int column)
public static void fixOSXEditorBackground(javax.swing.JTable table)
public static boolean isRetina(java.awt.Graphics2D graphics)
public static boolean isRetina()
public static boolean isWindowClientPropertyTrue(java.awt.Window window, java.lang.Object key)
public static java.lang.Object getWindowClientProperty(java.awt.Window window, java.lang.Object key)
public static void putWindowClientProperty(java.awt.Window window, java.lang.Object key, java.lang.Object value)
public static boolean isClientPropertyTrue(java.lang.Object component, java.lang.Object key)
component
- a Swing component that may hold a client property valuekey
- the client property keytrue
if the property of the specified component is set to true
public static java.lang.Object getClientProperty(java.lang.Object component, java.lang.Object key)
component
- a Swing component that may hold a client property valuekey
- the client property key that specifies a return typenull
public static <T> T getClientProperty(java.lang.Object component, java.lang.Class<T> type)
component
- a Swing component that may hold a client property valuenull
public static <T> T getClientProperty(java.lang.Object component, Key<T> key)
component
- a Swing component that may hold a client property valuekey
- the client property key that specifies a return typenull
public static <T> void putClientProperty(javax.swing.JComponent component, Key<T> key, T value)
public static java.lang.String getHtmlBody(java.lang.String text)
public static java.lang.String getHtmlBody(Html html)
public static void drawLinePickedOut(java.awt.Graphics graphics, int x, int y, int x1, int y1)
public static boolean isReallyTypedEvent(java.awt.event.KeyEvent e)
public static int getStringY(java.lang.String string, java.awt.Rectangle bounds, java.awt.Graphics2D g)
public static void drawLabelDottedRectangle(javax.swing.JLabel label, java.awt.Graphics g)
public static void drawLabelDottedRectangle(javax.swing.JLabel label, java.awt.Graphics g, java.awt.Rectangle bounds)
public static java.awt.Rectangle getLabelTextBounds(javax.swing.JLabel label)
public static int getHighestGlyphHeight(java.lang.String string, java.awt.Font font, java.awt.Graphics graphics)
string
- String
to examinefont
- Font
that is used to render the stringgraphics
- Graphics
that should be used to render the stringpublic static void setEnabled(java.awt.Component component, boolean enabled, boolean recursively)
public static void setEnabled(java.awt.Component component, boolean enabled, boolean recursively, boolean visibleOnly)
@Deprecated public static void drawLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
LinePainter2D.paint(Graphics2D, double, double, double, double)
instead.public static void drawLine(java.awt.Graphics2D g, int x1, int y1, int x2, int y2, java.awt.Color bgColor, java.awt.Color fgColor)
public static void drawWave(java.awt.Graphics2D g, java.awt.Rectangle rectangle)
public static java.lang.String [] splitText(java.lang.String text, java.awt.FontMetrics fontMetrics, int widthLimit, char separator)
public static void setActionNameAndMnemonic(java.lang.String text, javax.swing.Action action)
public static void assignMnemonic(java.lang.String text, javax.swing.Action action)
public static java.awt.Font getLabelFont(UIUtil.FontSize size)
public static java.awt.Font getFont(UIUtil.FontSize size, java.awt.Font base)
public static float getFontSize(UIUtil.FontSize size)
public static java.awt.Color getLabelFontColor(UIUtil.FontColor fontColor)
public static int getCheckBoxTextHorizontalOffset(javax.swing.JCheckBox cb)
public static int getScrollBarWidth()
public static java.awt.Color getLabelBackground()
public static java.awt.Color getLabelForeground()
public static java.awt.Color getLabelDisabledForeground()
public static java.awt.Color getContextHelpForeground()
public static java.lang.String removeMnemonic(java.lang.String s)
public static int getDisplayMnemonicIndex(java.lang.String s)
public static java.lang.String replaceMnemonicAmpersand(java.lang.String value)
@Deprecated public static java.awt.Color getTreeTextForeground()
getTreeForeground()
@Deprecated public static java.awt.Color getTreeTextBackground()
getTreeBackground()
public static java.awt.Color getFieldForegroundColor()
public static java.awt.Color getActiveTextColor()
public static java.awt.Color getInactiveTextColor()
@Deprecated public static java.awt.Color getActiveTextFieldBackgroundColor()
getTextFieldBackground()
insteadpublic static java.awt.Color getInactiveTextFieldBackgroundColor()
@Deprecated public static java.awt.Color getTextInactiveTextColor()
getInactiveTextColor()
insteadpublic static java.awt.Color getTreeSelectionBorderColor()
public static int getTreeRightChildIndent()
public static int getTreeLeftChildIndent()
public static java.awt.Color getToolTipBackground()
public static java.awt.Color getToolTipActionBackground()
public static java.awt.Color getToolTipForeground()
public static java.awt.Color getComboBoxDisabledForeground()
public static java.awt.Color getComboBoxDisabledBackground()
public static java.awt.Color getButtonSelectColor()
public static java.lang.Integer getPropertyMaxGutterIconWidth(java.lang.String propertyPrefix)
public static java.awt.Color getMenuItemDisabledForeground()
public static java.lang.Object getMenuItemDisabledForegroundObject()
public static java.lang.Object getTabbedPanePaintContentBorder(javax.swing.JComponent c)
public static java.awt.Color getTableGridColor()
public static java.awt.Color getPanelBackground()
public static java.awt.Color getEditorPaneBackground()
public static java.awt.Color getTableFocusCellBackground()
public static java.awt.Color getTextFieldForeground()
public static java.awt.Color getTextFieldBackground()
public static java.awt.Font getButtonFont()
public static java.awt.Font getToolTipFont()
public static void setSliderIsFilled(javax.swing.JSlider slider, boolean value)
public static java.awt.Color getLabelTextForeground()
public static java.awt.Color getControlColor()
public static java.awt.Font getOptionPaneMessageFont()
public static java.awt.Font getMenuFont()
@Deprecated public static java.awt.Color getSeparatorForeground()
JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground()
public static java.awt.Color getSeparatorShadow()
@Deprecated public static java.awt.Color getSeparatorHighlight()
@Deprecated public static java.awt.Color getSeparatorColor()
JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground()
public static javax.swing.border.Border getTableFocusCellHighlightBorder()
@Deprecated public static void setLineStyleAngled(javax.swing.JTree component)
public static java.awt.Color getTableFocusCellForeground()
public static javax.swing.border.Border getTextFieldBorder()
public static javax.swing.Icon getErrorIcon()
public static javax.swing.Icon getInformationIcon()
public static javax.swing.Icon getQuestionIcon()
public static javax.swing.Icon getWarningIcon()
public static javax.swing.Icon getBalloonInformationIcon()
public static javax.swing.Icon getBalloonWarningIcon()
public static javax.swing.Icon getBalloonErrorIcon()
@Deprecated public static javax.swing.Icon getRadioButtonIcon()
public static javax.swing.Icon getTreeNodeIcon(boolean expanded, boolean selected, boolean focused)
public static javax.swing.Icon getTreeCollapsedIcon()
public static javax.swing.Icon getTreeExpandedIcon()
@Deprecated public static javax.swing.Icon getTreeIcon(boolean expanded)
getTreeExpandedIcon()
and getTreeCollapsedIcon()
public static javax.swing.Icon getTreeSelectedCollapsedIcon()
public static javax.swing.Icon getTreeSelectedExpandedIcon()
@Deprecated public static javax.swing.border.Border getTableHeaderCellBorder()
public static java.awt.Color getWindowColor()
public static java.awt.Color getTextAreaForeground()
public static java.awt.Color getOptionPaneBackground()
@Deprecated public static boolean isUnderAquaLookAndFeel()
@Deprecated public static boolean isUnderNimbusLookAndFeel()
public static boolean isUnderAquaBasedLookAndFeel()
public static boolean isUnderDefaultMacTheme()
public static boolean isUnderWin10LookAndFeel()
public static boolean isUnderDarcula()
public static boolean isUnderIntelliJLaF()
@Deprecated public static boolean isUnderGTKLookAndFeel()
public static boolean isGraphite()
public static java.awt.Font getToolbarFont()
public static java.awt.Color shade(java.awt.Color c, double factor, double alphaFactor)
public static java.awt.Color mix(java.awt.Color c1, java.awt.Color c2, double factor)
public static boolean isFullRowSelectionLAF()
public static boolean isUnderNativeMacLookAndFeel()
public static int getListCellHPadding()
public static int getListCellVPadding()
public static JBInsets getRegularPanelInsets()
public static java.awt.Insets getListCellPadding()
public static java.awt.Insets getListViewportPadding()
public static boolean isToUseDottedCellBorder()
public static boolean isControlKeyDown(java.awt.event.MouseEvent mouseEvent)
public static java.lang.String [] getValidFontNames(boolean familyName)
public static java.lang.String [] getStandardFontSizes()
public static void setupEnclosingDialogBounds(javax.swing.JComponent component)
public static java.lang.String displayPropertiesToCSS(java.awt.Font font, java.awt.Color fg)
public static void appendColor(java.awt.Color color, java.lang.StringBuilder sb)
public static void drawDottedRectangle(java.awt.Graphics g, java.awt.Rectangle r)
public static void drawDottedRectangle(java.awt.Graphics g, int x, int y, int x1, int y1)
g
- graphics.x
- top left X coordinate.y
- top left Y coordinate.x1
- right bottom X coordinate.y1
- right bottom Y coordinate.public static void drawBoldDottedLine(java.awt.Graphics2D g, int startX, int endX, int lineY, java.awt.Color bgColor, java.awt.Color fgColor, boolean opaque)
g
- Graphics surfacestartX
- Line start X coordinateendX
- Line end X coordinatelineY
- Line Y coordinatebgColor
- Background color (optional)fgColor
- Foreground color (optional)opaque
- If opaque the image will be drpublic static void drawSearchMatch(java.awt.Graphics2D g, float startX, float endX, int height)
public static void drawSearchMatch(java.awt.Graphics2D g, float startXf, float endXf, int height, java.awt.Color c1, java.awt.Color c2)
public static void drawGradientHToolbarBackground(java.awt.Graphics g, int width, int height)
public static void drawHeader(java.awt.Graphics g, int x, int width, int height, boolean active, boolean drawTopLine)
public static void drawHeader(java.awt.Graphics g, int x, int width, int height, boolean active, boolean toolWindow, boolean drawTopLine, boolean drawBottomLine)
public static void drawDoubleSpaceDottedLine(java.awt.Graphics2D g, int start, int end, int xOrY, java.awt.Color fgColor, boolean horizontal)
@Deprecated public static void applyRenderingHints(java.awt.Graphics g)
@Deprecated public static java.awt.image.BufferedImage createImage(int width, int height, int type)
ImageUtil.createImage(int, int, int)
@Deprecated public static java.awt.image.BufferedImage createImage(java.awt.GraphicsConfiguration gc, int width, int height, int type)
ImageUtil.createImage(GraphicsConfiguration, int, int, int)
public static java.awt.image.BufferedImage createImage(java.awt.GraphicsConfiguration gc, double width, double height, int type, PaintUtil.RoundingMode rm)
gc
- the graphics configwidth
- the width in user coordinate spaceheight
- the height in user coordinate spacetype
- the type of the imagerm
- the rounding mode to apply to width/height (for a HiDPI-aware image, the rounding is applied in the device space)java.lang.IllegalArgumentException
- if width
or height
is not greater than 0public static java.awt.image.BufferedImage createImage(ScaleContext ctx, double width, double height, int type, PaintUtil.RoundingMode rm)
java.lang.IllegalArgumentException
- if width
or height
is not greater than 0#createImage(GraphicsConfiguration, double, double, int, RoundingMode)
@Deprecated public static java.awt.image.BufferedImage createImage(java.awt.Graphics g, int width, int height, int type)
ImageUtil.createImage(Graphics, int, int, int)
@Deprecated public static java.awt.image.BufferedImage createImage(java.awt.Graphics g, double width, double height, int type, PaintUtil.RoundingMode rm)
ImageUtil#createImage(Graphics, double, double, int, RoundingMode)
public static java.awt.image.BufferedImage createImage(java.awt.Component comp, int width, int height, int type)
comp
- the component associated with the target graphics devicewidth
- the width in user coordinate spaceheight
- the height in user coordinate spacetype
- the type of the imagejava.lang.IllegalArgumentException
- if width
or height
is not greater than 0@Deprecated public static java.awt.image.BufferedImage createImageForGraphics(java.awt.Graphics2D g, int width, int height, int type)
createImage(Graphics, int, int, int)
public static void setupComposite(java.awt.Graphics2D g)
AlphaComposite.SRC
and we should use AlphaComposite.SRC_OVER
instead.g
- target graphics containerpublic static void dispatchAllInvocationEvents()
IdeEventQueue
, ignores and removes all other events from the queue.
In tests, consider using com.intellij.testFramework.PlatformTestUtil#dispatchAllInvocationEventsInIdeEventQueue()
pump()
public static void addAwtListener(java.awt.event.AWTEventListener listener, long mask, Disposable parent)
public static void addParentChangeListener(java.awt.Component component, java.beans.PropertyChangeListener listener)
public static void removeParentChangeListener(java.awt.Component component, java.beans.PropertyChangeListener listener)
public static void drawVDottedLine(java.awt.Graphics2D g, int lineX, int startY, int endY, java.awt.Color bgColor, java.awt.Color fgColor)
public static void drawHDottedLine(java.awt.Graphics2D g, int startX, int endX, int lineY, java.awt.Color bgColor, java.awt.Color fgColor)
public static void drawDottedLine(java.awt.Graphics2D g, int x1, int y1, int x2, int y2, java.awt.Color bgColor, java.awt.Color fgColor)
public static void drawStringWithHighlighting(java.awt.Graphics g, java.lang.String s, int x, int y, java.awt.Color foreground, java.awt.Color highlighting)
public static void drawCenteredString(java.awt.Graphics2D g, java.awt.Rectangle rect, java.lang.String str, boolean horzCentered, boolean vertCentered)
g
- the Graphics
instance to draw torect
- the Rectangle
to use as bounding boxstr
- the string to drawhorzCentered
- if true, the string will be centered horizontallyvertCentered
- if true, the string will be centered verticallypublic static void drawCenteredString(java.awt.Graphics2D g, java.awt.Rectangle rect, java.lang.String str)
g
- the Graphics
instance to draw torect
- the Rectangle
to use as bounding boxstr
- the string to drawpublic static boolean isFocusAncestor(java.awt.Component component)
component
- to check whether it has focus within its component hierarchytrue
if component or one of its children has focusComponent.isFocusOwner()
public static boolean isCloseClick(java.awt.event.MouseEvent e)
public static boolean isCloseClick(java.awt.event.MouseEvent e, int effectiveType)
public static boolean isActionClick(java.awt.event.MouseEvent e)
public static boolean isActionClick(java.awt.event.MouseEvent e, int effectiveType)
public static boolean isActionClick(java.awt.event.MouseEvent e, int effectiveType, boolean allowShift)
public static java.awt.Color getBgFillColor(java.awt.Component c)
public static java.awt.Component findNearestOpaque(java.awt.Component c)
@Deprecated public static java.awt.Component findParentByCondition(java.awt.Component c, Condition<? super java.awt.Component> condition)
public static java.awt.Component getDeepestComponentAt(java.awt.Component parent, int x, int y)
public static void layoutRecursively(java.awt.Component component)
public static java.lang.String getCssFontDeclaration(java.awt.Font font)
public static java.lang.String getCssFontDeclaration(java.awt.Font font, java.awt.Color fgColor, java.awt.Color linkColor, java.lang.String liImg)
public static java.awt.Color getFocusedFillColor()
public static java.awt.Color getFocusedBoundsColor()
public static java.awt.Color getBoundsColor()
public static java.awt.Color getBoundsColor(boolean focused)
public static java.awt.Color toAlpha(java.awt.Color color, int alpha)
public static boolean isFocusable(java.awt.Component component)
component
- to check whether it can be focused or nottrue
if component is not null
and can be focusedComponent#isRequestFocusAccepted(boolean, boolean, sun.awt.CausedFocusEvent.Cause)
@Deprecated public static void requestFocus(javax.swing.JComponent c)
IdeFocusManager
public static boolean canDisplayFocusedState(java.awt.Component component)
public static void dispose(java.awt.Component c)
public static void disposeProgress(javax.swing.JProgressBar progress)
public static java.awt.Component findUltimateParent(java.awt.Component c)
public static java.awt.Color getHeaderActiveColor()
public static java.awt.Color getFocusedBorderColor()
public static java.awt.Color getHeaderInactiveColor()
public static java.awt.Font getTitledBorderFont()
@Deprecated public static java.awt.Color getBorderInactiveColor()
@Deprecated public static java.awt.Color getBorderActiveColor()
@Deprecated public static java.awt.Color getBorderSeparatorColor()
public static javax.swing.text.html.StyleSheet loadStyleSheet(java.net.URL url)
public static javax.swing.text.html.HTMLEditorKit getHTMLEditorKit()
public static javax.swing.text.html.HTMLEditorKit getHTMLEditorKit(boolean noGapsBetweenParagraphs)
public static javax.swing.plaf.FontUIResource getFontWithFallback(java.awt.Font font)
public static javax.swing.plaf.FontUIResource getFontWithFallback(java.lang.String familyName, int style, int size)
public static <T> T htmlInjectionGuard(T toRender)
@Deprecated public static void removeScrollBorder(java.awt.Component c)
JScrollPane
manually using
ScrollPaneFactory.createScrollPane(Component, boolean)
.public static java.lang.String toHtml(java.lang.String html)
public static java.lang.String toHtml(java.lang.String html, int hPadding)
public static java.lang.String addPadding(java.lang.String html, int hPadding)
public static java.lang.String convertSpace2Nbsp(java.lang.String html)
public static void invokeLaterIfNeeded(java.lang.Runnable runnable)
SwingUtilities.invokeLater(Runnable)
on it.public static void invokeAndWaitIfNeeded(java.lang.Runnable runnable)
runnable
- a runnable to invokeinvokeAndWaitIfNeeded(ThrowableRunnable)
public static <T> T invokeAndWaitIfNeeded(Computable<T> computable)
computable
- a runnable to invokeinvokeAndWaitIfNeeded(ThrowableRunnable)
public static void invokeAndWaitIfNeeded(ThrowableRunnable<?> runnable) throws java.lang.Throwable
runnable
- a runnable to invokejava.lang.Throwable
public static boolean isFocusProxy(java.awt.Component c)
public static void maybeInstall(javax.swing.InputMap map, java.lang.String action, javax.swing.KeyStroke stroke)
public static void changeBackGround(java.awt.Component component, java.awt.Color background)
component
- component.background
- new background.public static javax.swing.plaf.basic.ComboPopup getComboBoxPopup(javax.swing.JComboBox<?> comboBox)
public static void fixFormattedField(javax.swing.JFormattedTextField field)
public static boolean isPrinting(java.awt.Graphics g)
public static int getSelectedButton(javax.swing.ButtonGroup group)
public static void setSelectedButton(javax.swing.ButtonGroup group, int index)
public static boolean isSelectionButtonDown(java.awt.event.MouseEvent e)
public static boolean isToggleListSelectionEvent(java.awt.event.MouseEvent e)
public static void setComboBoxEditorBounds(int x, int y, int width, int height, javax.swing.JComponent editor)
@Deprecated public static int fixComboBoxHeight(int height)
public static boolean isDescendingFrom(java.awt.Component child, java.awt.Component parent)
child
- child componentparent
- parent componentSwingUtilities.isDescendingFrom(Component, Component)
public static <T> T getParentOfType(java.lang.Class<? extends T> type, java.awt.Component component)
type
- expected classcomponent
- initial componentnull
if the search is failedSwingUtilities.getAncestorOfClass(java.lang.Class<?>, java.awt.Component)
public static JBIterable<java.awt.Component> uiParents(java.awt.Component c, boolean strict)
public static JBIterable<java.awt.Component> uiChildren(java.awt.Component component)
public static JBTreeTraverser<java.awt.Component> uiTraverser(java.awt.Component component)
public static void scrollListToVisibleIfNeeded(javax.swing.JList<?> list)
public static <T extends javax.swing.JComponent> T findComponentOfType(javax.swing.JComponent parent, java.lang.Class<T> cls)
public static <T extends javax.swing.JComponent> java.util.List<T> findComponentsOfType(javax.swing.JComponent parent, java.lang.Class<? extends T> cls)
public static javax.swing.JRootPane getRootPane(java.awt.Component c)
public static void setFutureRootPane(javax.swing.JComponent c, javax.swing.JRootPane pane)
public static boolean isMeaninglessFocusOwner(java.awt.Component c)
@Deprecated public static javax.swing.Timer createNamedTimer(java.lang.String name, int delay, java.awt.event.ActionListener listener)
TimerUtil.createNamedTimer(String, int, ActionListener)
@Deprecated public static javax.swing.Timer createNamedTimer(java.lang.String name, int delay)
TimerUtil.createNamedTimer(String, int)
public static boolean isDialogRootPane(javax.swing.JRootPane rootPane)
public static javax.swing.JComponent mergeComponentsWithAnchor(PanelWithAnchor... panels)
public static javax.swing.JComponent mergeComponentsWithAnchor(java.util.Collection<? extends PanelWithAnchor> panels)
public static void setNotOpaqueRecursively(java.awt.Component component)
public static void setBackgroundRecursively(java.awt.Component component, java.awt.Color bg)
public static void addInsets(javax.swing.JComponent component, int top, int left, int bottom, int right)
component
- the component to which border addedtop
- the inset from the topleft
- the inset from the leftbottom
- the inset from the bottomright
- the inset from the rightpublic static void addInsets(javax.swing.JComponent component, java.awt.Insets insets)
component
- the component to which border addedinsets
- the top, left, bottom, and right insetspublic static void adjustWindowToMinimumSize(java.awt.Window window)
public static int getLcdContrastValue()
public static void addBorder(javax.swing.JComponent component, javax.swing.border.Border border)
component
- the component to which border addedborder
- the border to add to the componentpublic static java.awt.Color getDecoratedRowColor()
public static java.awt.Paint getGradientPaint(float x1, float y1, java.awt.Color c1, float x2, float y2, java.awt.Color c2)
public static java.awt.Point getLocationOnScreen(javax.swing.JComponent component)
public static void setAutoRequestFocus(java.awt.Window window, boolean value)
public static void runWhenWindowOpened(java.awt.Window window, java.lang.Runnable runnable)
public static void runWhenWindowClosed(java.awt.Window window, java.lang.Runnable runnable)
public static java.lang.String getDebugText(java.awt.Component c)
public static boolean isAncestor(java.awt.Component ancestor, java.awt.Component descendant)
public static void resetUndoRedoActions(javax.swing.text.JTextComponent textComponent)
public static void addUndoRedoActions(javax.swing.text.JTextComponent textComponent)
public static javax.swing.undo.UndoManager getUndoManager(java.awt.Component component)
public static void playSoundFromResource(java.lang.String resourceName)
public static void playSoundFromStream(Factory<? extends java.io.InputStream> streamProducer)
public static java.lang.String rightArrow()
public static java.lang.String upArrow(java.lang.String defaultValue)
public static void configureNumericFormattedTextField(javax.swing.JFormattedTextField textField)
public static java.awt.Window getWindow(java.awt.Component component)
component
- the component used to find corresponding windownull
if the component is not a window and is not contained inside a windowpublic static void toFront(java.awt.Window window)
window
- the window to activatepublic static boolean hasScrollPane(java.awt.Component component)
public static boolean hasComponentOfType(java.awt.Component component, java.lang.Class<?>... types)
public static void setColumns(javax.swing.text.JTextComponent textComponent, int columns)
public static int getLineHeight(javax.swing.text.JTextComponent textComponent)
public static javax.swing.JComponent getPreferredFocusedComponent(java.awt.Container container)
null
if container is null
,
or if focus traversal policy cannot be determined,
or if found focusable component is not a JComponent
.container
- a container whose first focusable component is to be returnednull
if it cannot be foundpublic static UIUtil.ComponentStyle getComponentStyle(java.awt.Component component)
component
- a component to processpublic static void repaintViewport(javax.swing.JComponent c)
public static void setCursor(java.awt.Component component, java.awt.Cursor cursor)
public static boolean haveCommonOwner(java.awt.Component c1, java.awt.Component c2)
public static boolean isHelpButton(java.awt.Component button)
public static boolean isRetina(java.awt.GraphicsDevice device)
public static void useSafely(java.awt.Graphics originGraphics, Consumer<? super java.awt.Graphics2D> drawingConsumer)
Graphics
. This is a non-distractive approach
all modifications on Graphics
are metter only inside the Consumer
blockoriginGraphics
- graphics to work withdrawingConsumer
- you can use the Graphics2D object here safelypublic static java.awt.Font getListFont()
public static java.awt.Color getListBackground()
public static java.awt.Color getListSelectionBackground(boolean focused)
public static java.awt.Dimension updateListRowHeight(java.awt.Dimension size)
public static java.awt.Color getListBackground(boolean selected, boolean focused)
@Deprecated public static java.awt.Color getListBackground(boolean selected)
getListBackground(boolean, boolean)
@Deprecated public static java.awt.Color getListSelectionBackground()
getListSelectionBackground(boolean)
@Deprecated public static java.awt.Color getListUnfocusedSelectionBackground()
getListSelectionBackground(boolean)
public static java.awt.Color getListForeground()
public static java.awt.Color getListSelectionForeground(boolean focused)
public static java.awt.Color getListForeground(boolean selected, boolean focused)
@Deprecated public static java.awt.Color getListForeground(boolean selected)
getListForeground(boolean, boolean)
@Deprecated public static java.awt.Color getListSelectionForeground()
getListSelectionForeground(boolean)
public static java.awt.Font getTreeFont()
public static java.awt.Color getTreeBackground()
public static java.awt.Color getTreeSelectionBackground(boolean focused)
public static java.awt.Color getTreeBackground(boolean selected, boolean focused)
@Deprecated public static java.awt.Color getTreeSelectionBackground()
getTreeSelectionBackground(boolean)
@Deprecated public static java.awt.Color getTreeUnfocusedSelectionBackground()
getTreeSelectionBackground(boolean)
public static java.awt.Color getTreeForeground()
public static java.awt.Color getTreeSelectionForeground(boolean focused)
public static java.awt.Color getTreeForeground(boolean selected, boolean focused)
@Deprecated public static java.awt.Color getTreeSelectionForeground()
getTreeSelectionForeground(boolean)
public static java.awt.Color getTableBackground()
public static java.awt.Color getTableSelectionBackground(boolean focused)
public static java.awt.Color getTableBackground(boolean selected, boolean focused)
@Deprecated public static java.awt.Color getTableBackground(boolean selected)
getTableBackground(boolean, boolean)
@Deprecated public static java.awt.Color getTableSelectionBackground()
getTableSelectionBackground(boolean)
@Deprecated public static java.awt.Color getTableUnfocusedSelectionBackground()
getTableSelectionBackground(boolean)
public static java.awt.Color getTableForeground()
public static java.awt.Color getTableSelectionForeground(boolean focused)
public static java.awt.Color getTableForeground(boolean selected, boolean focused)
@Deprecated public static java.awt.Color getTableForeground(boolean selected)
getTableForeground(boolean, boolean)
@Deprecated public static java.awt.Color getTableSelectionForeground()
getTableSelectionForeground(boolean)
@Deprecated public static Pair<java.lang.String,java.lang.Integer> getSystemFontData()
JBUIScale.getSystemFontData()
@Deprecated public static boolean isJreHiDPIEnabled()
JreHiDpiUtil.isJreHiDPIEnabled()
@Deprecated public static boolean isJreHiDPI(java.awt.Graphics2D g)
JreHiDpiUtil.isJreHiDPI(Graphics2D)
@Deprecated public static java.awt.Color getPanelBackgound()
getPanelBackground()
insteadpublic static void doNotScrollToCaret(javax.swing.text.JTextComponent textComponent)
public static java.awt.Color getTooltipSeparatorColor()
public static void scrollToReference(javax.swing.JEditorPane editor, java.lang.String reference)
JEditorPane.scrollToReference(java.lang.String)
) supports also targets using id
HTML attribute.public static void runWhenFocused(java.awt.Component component, java.lang.Runnable runnable)
public static java.awt.Font getLabelFont()
public static void drawImage(java.awt.Graphics g, java.awt.Image image, int x, int y, java.awt.image.ImageObserver observer)
public static java.awt.Point getCenterPoint(java.awt.Dimension container, java.awt.Dimension child)
public static java.awt.Point getCenterPoint(java.awt.Rectangle container, java.awt.Dimension child)
public static void drawImage(java.awt.Graphics g, java.awt.Image image, java.awt.Rectangle dstBounds, java.awt.Rectangle srcBounds, java.awt.image.ImageObserver observer)
public static void drawImage(java.awt.Graphics g, java.awt.image.BufferedImage image, java.awt.image.BufferedImageOp op, int x, int y)
public static void pump()
dispatchAllInvocationEvents()
public static boolean isJreHiDPI()
public static java.awt.Color makeTransparent(java.awt.Color color, java.awt.Color backgroundColor, double transparency)