public class EmptyIcon extends JBCachingScalableIcon<EmptyIcon>
ColorIcon
Modifier and Type | Class and Description |
---|---|
static class |
EmptyIcon.EmptyIconUIResource |
Modifier and Type | Field and Description |
---|---|
protected int |
height |
static javax.swing.Icon |
ICON_0 |
static javax.swing.Icon |
ICON_13 |
static javax.swing.Icon |
ICON_16 |
static javax.swing.Icon |
ICON_18 |
static javax.swing.Icon |
ICON_8 |
protected int |
width |
Modifier | Constructor and Description |
---|---|
protected |
EmptyIcon(EmptyIcon icon) |
|
EmptyIcon(int size)
Deprecated.
use create(int) for caching.
|
|
EmptyIcon(int width,
int height)
Deprecated.
use create(int, int) for caching.
|
Modifier and Type | Method and Description |
---|---|
EmptyIcon.EmptyIconUIResource |
asUIResource() |
EmptyIcon |
copy()
Returns a copy of this icon.
|
static EmptyIcon |
create(javax.swing.Icon base)
Creates an icon of the size of the provided icon base.
|
static EmptyIcon |
create(int size)
Creates an icon of the provided size.
|
static EmptyIcon |
create(int width,
int height)
Creates an icon of the provided size.
|
boolean |
equals(java.lang.Object o) |
int |
getIconHeight() |
int |
getIconWidth() |
double |
getScale(DerivedScaleType type) |
double |
getScale(ScaleType type) |
T |
getScaleContext() |
int |
hashCode() |
void |
paintIcon(java.awt.Component component,
java.awt.Graphics g,
int i,
int j) |
boolean |
setScale(Scale scale)
Sets the new scale in the context
|
boolean |
updateScaleContext(UserScaleContext ctx)
Updates the current context with the state of the provided context.
|
EmptyIcon |
withIconPreScaled(boolean preScaled)
The pre-scaled state of the icon indicates whether the initial size of the icon
is pre-scaled (by the global user scale) or not.
|
scale
getScale, isIconPreScaled, scaleVal, scaleVal, scaleVal, setAutoUpdateScaleContext, setIconPreScaled, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
deepCopy
public static final javax.swing.Icon ICON_18
public static final javax.swing.Icon ICON_16
public static final javax.swing.Icon ICON_13
public static final javax.swing.Icon ICON_8
public static final javax.swing.Icon ICON_0
protected final int width
protected final int height
@Deprecated public EmptyIcon(int size)
@Deprecated public EmptyIcon(int width, int height)
protected EmptyIcon(EmptyIcon icon)
public static EmptyIcon create(int size)
JBUIScale.scaleIcon(JBScalableIcon)
(JBScalableIcon)} to meet HiDPI.public static EmptyIcon create(int width, int height)
JBUIScale.scaleIcon(JBScalableIcon)
(JBScalableIcon)} to meet HiDPI.public static EmptyIcon create(javax.swing.Icon base)
public EmptyIcon copy()
CopyableIcon
The copy should be a new instance, it should preserve the original size and should paint equal to the original bitmap. The subtype of the new icon is up to an implementor. It may or may not be equal the original subtype.
copy
in interface CopyableIcon
copy
in class JBCachingScalableIcon<EmptyIcon>
public EmptyIcon withIconPreScaled(boolean preScaled)
JBScalableIcon
For example, say we have an icon of 15x15 initial size, USR_SCALE is 1.5f, OBJ_SCALE is 1,5f. Math.round(Math.round(15 * USR_SCALE) * OBJ_SCALE) = 35 Math.round(15 * USR_SCALE * OBJ_SCALE) = 34
Thus, JBUI.scale(MyIcon.create(w, h)) is preferable to MyIcon.create(JBUI.scale(w), JBUI.scale(h)). Here [w, h] is "raw" unscaled size.
withIconPreScaled
in class JBScalableIcon
preScaled
- whether the icon is pre-scaled(JBScalableIcon)
public int getIconWidth()
public int getIconHeight()
public void paintIcon(java.awt.Component component, java.awt.Graphics g, int i, int j)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public EmptyIcon.EmptyIconUIResource asUIResource()
public T getScaleContext()
getScaleContext
in interface ScaleContextAware
public boolean updateScaleContext(UserScaleContext ctx)
ScaleContextAware
ctx
is null, then updates the current context via ScaleContext.update()
and returns the result.updateScaleContext
in interface ScaleContextAware
ctx
- the new scale contextpublic double getScale(ScaleType type)
getScale
in interface ScaleContextAware
public double getScale(DerivedScaleType type)
getScale
in interface ScaleContextAware
public boolean setScale(Scale scale)
ScaleContextAware
setScale
in interface ScaleContextAware