本文整理汇总了Java中javax.swing.plaf.synth.SynthLookAndFeel.getRegion方法的典型用法代码示例。如果您正苦于以下问题:Java SynthLookAndFeel.getRegion方法的具体用法?Java SynthLookAndFeel.getRegion怎么用?Java SynthLookAndFeel.getRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.plaf.synth.SynthLookAndFeel
的用法示例。
在下文中一共展示了SynthLookAndFeel.getRegion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSynthIcon
import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private static void testSynthIcon() {
if (!checkAndSetNimbusLookAndFeel()) {
return;
}
JMenuItem menu = new JMenuItem();
Icon subMenuIcon = UIManager.getIcon("Menu.arrowIcon");
if (!(subMenuIcon instanceof SynthIcon)) {
throw new RuntimeException("Icon is not a SynthIcon!");
}
Region region = SynthLookAndFeel.getRegion(menu);
SynthStyle style = SynthLookAndFeel.getStyle(menu, region);
SynthContext synthContext = new SynthContext(menu, region, style, SynthConstants.ENABLED);
int width = SynthGraphicsUtils.getIconWidth(subMenuIcon, synthContext);
int height = SynthGraphicsUtils.getIconHeight(subMenuIcon, synthContext);
paintAndCheckIcon(subMenuIcon, synthContext, width, height);
int newWidth = width * 17;
int newHeight = height * 37;
Icon centeredIcon = new CenteredSynthIcon((SynthIcon) subMenuIcon,
newWidth, newHeight);
paintAndCheckIcon(centeredIcon, synthContext, newWidth, newHeight);
}
示例2: getRegion
import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private Region getRegion(JComponent c) {
return SynthLookAndFeel.getRegion(c);
}
示例3: getRegion
import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
/**
* Get the region.
*
* @param c the component.
*
* @return the region.
*/
private Region getRegion(JComponent c) {
return SynthLookAndFeel.getRegion(c);
}