本文整理汇总了Java中sun.swing.plaf.synth.SynthIcon类的典型用法代码示例。如果您正苦于以下问题:Java SynthIcon类的具体用法?Java SynthIcon怎么用?Java SynthIcon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SynthIcon类属于sun.swing.plaf.synth包,在下文中一共展示了SynthIcon类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
/**
* Paints the toolbar.
*
* @param context context for the component being painted
* @param g the {@code Graphics} object used for painting
* @see #update(Graphics,JComponent)
*/
protected void paint(SynthContext context, Graphics g) {
if (handleIcon != null && toolBar.isFloatable()) {
int startX = toolBar.getComponentOrientation().isLeftToRight() ?
0 : toolBar.getWidth() -
SynthIcon.getIconWidth(handleIcon, context);
SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
SynthIcon.getIconWidth(handleIcon, context),
SynthIcon.getIconHeight(handleIcon, context));
}
SynthContext subcontext = getContext(
toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
paintContent(subcontext, g, contentRect);
subcontext.dispose();
}
示例2: paintIcon
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
static void paintIcon(Graphics g, SeaGlassMenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr) {
if (lh.getIcon() != null) {
Icon icon;
JMenuItem mi = lh.getMenuItem();
ButtonModel model = mi.getModel();
if (!model.isEnabled()) {
icon = mi.getDisabledIcon();
} else if (model.isPressed() && model.isArmed()) {
icon = mi.getPressedIcon();
if (icon == null) {
// Use default icon
icon = mi.getIcon();
}
} else {
icon = mi.getIcon();
}
if (icon != null) {
Rectangle iconRect = lr.getIconRect();
SynthIcon.paintIcon(icon, lh.getContext(), g, iconRect.x,
iconRect.y, iconRect.width, iconRect.height);
}
}
}
示例3: getDisabledIcon
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
@Override
public Icon getDisabledIcon(JComponent component, Icon icon) {
if (icon instanceof SynthIcon) {
SynthIcon si = (SynthIcon)icon;
BufferedImage img = EffectUtils.createCompatibleTranslucentImage(
si.getIconWidth(), si.getIconHeight());
Graphics2D gfx = img.createGraphics();
si.paintIcon(component, gfx, 0, 0);
gfx.dispose();
return new ImageIconUIResource(GrayFilter.createDisabledImage(img));
} else {
return super.getDisabledIcon(component, icon);
}
}
示例4: drawCentered
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon,
int x, int y) {
int w = SynthIcon.getIconWidth(icon, paintContext);
int h = SynthIcon.getIconHeight(icon, paintContext);
SynthIcon.paintIcon(icon, paintContext, graphics,
findCenteredX(x, w),
y - h/2, w, h);
}
示例5: paintIcon
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
public void paintIcon(SynthContext context, Graphics g, int x,
int y, int w, int h) {
if (context == null) {
context = getContext(tree);
SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
context.dispose();
}
else {
SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
}
}
示例6: getIconWidth
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
public int getIconWidth(SynthContext context) {
int width;
if (context == null) {
context = getContext(tree);
width = SynthIcon.getIconWidth(expandedIcon, context);
context.dispose();
}
else {
width = SynthIcon.getIconWidth(expandedIcon, context);
}
return width;
}
示例7: getIconHeight
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
public int getIconHeight(SynthContext context) {
int height;
if (context == null) {
context = getContext(tree);
height = SynthIcon.getIconHeight(expandedIcon, context);
context.dispose();
}
else {
height = SynthIcon.getIconHeight(expandedIcon, context);
}
return height;
}
示例8: drawCentered
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
/**
* @inheritDoc
*/
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon, int x, int y) {
int w = SynthIcon.getIconWidth(icon, paintContext);
int h = SynthIcon.getIconHeight(icon, paintContext);
SynthIcon.paintIcon(icon, paintContext, graphics, findCenteredX(x, w), y - h / 2, w, h);
}
示例9: paintIcon
import sun.swing.plaf.synth.SynthIcon; //导入依赖的package包/类
public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) {
if (context == null) {
context = getContext(tree);
SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
((SeaGlassContext)context).dispose();
} else {
SynthIcon.paintIcon(expandedIcon, context, g, x, y, w, h);
}
}