APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.java.swing

public Class SwingUtilities3

extends Object
Class Inheritance
Imports
java.awt.Color, .Component, .Container, .Graphics, .Graphics2D, .Insets, .Rectangle, .Stroke, .Window, java.awt.geom.AffineTransform, java.util.Collections, .Map, .WeakHashMap, javax.swing.ButtonModel, .Icon, .JComponent, .JMenu, .RepaintManager, sun.awt.SunToolkit, sun.swing.MenuItemLayoutHelper, .SwingUtilities2

A collection of utility methods for Swing.

Warning

While this class is public, it should not be treated as public API and its API may change in incompatible ways between dot dot releases and even patch releases. You should not rely on this class even existing. This is a second part of sun.swing.SwingUtilities2.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
SwingUtilities3.UnscaledBorderPainter

A task which paints an unscaled border after Graphics transforms are removed.

Field Summary

Modifier and TypeField and Description
private static final Object
DELEGATE_REPAINT_MANAGER_KEY

The clientProperty key for delegate RepaintManager

private static volatile boolean
private static final Map<Container, Boolean>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
public static void
applyInsets(Rectangle rect, Insets insets, boolean leftToRight)

public static RepaintManager
getDelegateRepaintManager(Component component)

Returns delegate RepaintManager for component hierarchy.

public static boolean

Returns:

true if vsync painting is requested for rootContainer
isVsyncRequested
(Container
topmost container. Should be Window
rootContainer
)

Checks if vsync painting is requested for rootContainer

public static void
paintAccText(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color disabledForeground, Color acceleratorSelectionForeground, Color acceleratorForeground)

public static void
public static void
paintBorder(Component
the component for which this border is being painted
c
,
Graphics
the paint graphics
g
,
int
the x position of the painted border
x
,
int
the y position of the painted border
y
,
int
the width of the painted border
w
,
int
the height of the painted border
h
,
SwingUtilities3.UnscaledBorderPainter
the painter object which paints the border after the transform on the Graphics is reset
painter
)

Paints the border for a component ensuring its sides have consistent thickness at different scales.

public static void
public static void
public static void
setDelegateRepaintManager(JComponent component, RepaintManager repaintManager)

Registers delegate RepaintManager for JComponent.

public static void
setVsyncRequested(Container
topmost container. Should be Window
rootContainer
,
boolean
the value to set vsyncRequested state to
isRequested
)

Sets vsyncRequested state for the rootContainer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DELEGATE_REPAINT_MANAGER_KEYback to summary
private static final Object DELEGATE_REPAINT_MANAGER_KEY

The clientProperty key for delegate RepaintManager

repaintDelegateSetback to summary
private static volatile boolean repaintDelegateSet
vsyncedMapback to summary
private static final Map<Container, Boolean> vsyncedMap

Constructor Detail

SwingUtilities3back to summary
public SwingUtilities3()

Method Detail

applyInsetsback to summary
public static void applyInsets(Rectangle rect, Insets insets)
applyInsetsback to summary
public static void applyInsets(Rectangle rect, Insets insets, boolean leftToRight)
getDelegateRepaintManagerback to summary
public static RepaintManager getDelegateRepaintManager(Component component)

Returns delegate RepaintManager for component hierarchy.

isVsyncRequestedback to summary
public static boolean isVsyncRequested(Container rootContainer)

Checks if vsync painting is requested for rootContainer

Parameters
rootContainer:Container

topmost container. Should be Window

Returns:boolean

true if vsync painting is requested for rootContainer

paintAccTextback to summary
public static void paintAccText(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color disabledForeground, Color acceleratorSelectionForeground, Color acceleratorForeground)
paintArrowIconback to summary
public static void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color foreground)
paintBorderback to summary
public static void paintBorder(Component c, Graphics g, int x, int y, int w, int h, SwingUtilities3.UnscaledBorderPainter painter)

Paints the border for a component ensuring its sides have consistent thickness at different scales.

It performs the following steps:

  1. Reset the scale transform on the Graphics,
  2. Call painter to paint the border,
  3. Restores the transform.
Parameters
c:Component

the component for which this border is being painted

g:Graphics

the paint graphics

x:int

the x position of the painted border

y:int

the y position of the painted border

w:int

the width of the painted border

h:int

the height of the painted border

painter:SwingUtilities3.UnscaledBorderPainter

the painter object which paints the border after the transform on the Graphics is reset

paintCheckIconback to summary
public static void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color holdc, Color foreground)
paintIconback to summary
public static void paintIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color holdc)
setDelegateRepaintManagerback to summary
public static void setDelegateRepaintManager(JComponent component, RepaintManager repaintManager)

Registers delegate RepaintManager for JComponent.

setVsyncRequestedback to summary
public static void setVsyncRequested(Container rootContainer, boolean isRequested)

Sets vsyncRequested state for the rootContainer. If isRequested is true then vsynced BufferStrategy is enabled for this rootContainer.

Note

requesting vsynced painting does not guarantee one. The outcome depends on current RepaintManager's RepaintManager.PaintManager and on the capabilities of the graphics hardware/software and what not.

Parameters
rootContainer:Container

topmost container. Should be Window

isRequested:boolean

the value to set vsyncRequested state to

com.sun.java.swing back to summary

public Interface SwingUtilities3.UnscaledBorderPainter

Annotations
@FunctionalInterface

A task which paints an unscaled border after Graphics transforms are removed. It's used with the SwingUtilities3.paintBorder which manages changing the transforms and calculating the coordinates and size of the border.

Method Summary

Modifier and TypeMethod and Description
public void
paintUnscaledBorder(Component
the component for which this border is being painted
c
,
Graphics
the paint graphics
g
,
int
the width of the painted border, in physical pixels
w
,
int
the height of the painted border, in physical pixels
h
,
double
the scale that was in the Graphics
scaleFactor
)

Paints the border for the specified component after the Graphics transforms are removed.

Method Detail

paintUnscaledBorderback to summary
public void paintUnscaledBorder(Component c, Graphics g, int w, int h, double scaleFactor)

Paints the border for the specified component after the Graphics transforms are removed.

The x and y of the painted border are zero.

Parameters
c:Component

the component for which this border is being painted

g:Graphics

the paint graphics

w:int

the width of the painted border, in physical pixels

h:int

the height of the painted border, in physical pixels

scaleFactor:double

the scale that was in the Graphics

See Also
SwingUtilities3.paintBorder, Border.paintBorder