本文整理汇总了Java中com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType类的典型用法代码示例。如果您正苦于以下问题:Java WidgetType类的具体用法?Java WidgetType怎么用?Java WidgetType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WidgetType类属于com.sun.java.swing.plaf.gtk.GTKEngine包,在下文中一共展示了WidgetType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GTKStyle
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType; //导入依赖的package包/类
GTKStyle(Font userFont, WidgetType widgetType) {
this.widgetType = widgetType.ordinal();
String pangoFontName;
synchronized (sun.awt.UNIXToolkit.GTK_LOCK) {
xThickness = nativeGetXThickness(this.widgetType);
yThickness = nativeGetYThickness(this.widgetType);
pangoFontName = nativeGetPangoFontName(this.widgetType);
}
Font pangoFont = null;
if (pangoFontName != null) {
pangoFont = PangoFonts.lookupFont(pangoFontName);
}
if (pangoFont != null) {
this.font = pangoFont;
} else if (userFont != null) {
this.font = userFont;
} else {
this.font = DEFAULT_FONT;
}
}
示例2: getScrollBarInsets
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType; //导入依赖的package包/类
private Insets getScrollBarInsets(SynthContext context, Insets insets) {
int troughBorder =
getClassSpecificIntValue(context, "trough-border", 1);
insets.left = insets.right = insets.top = insets.bottom = troughBorder;
JComponent c = context.getComponent();
if (c.getParent() instanceof JScrollPane) {
// This scrollbar is part of a scrollpane; use only the
// "scrollbar-spacing" style property to determine the padding
// between the scrollbar and its parent scrollpane.
int spacing =
getClassSpecificIntValue(WidgetType.SCROLL_PANE,
"scrollbar-spacing", 3);
if (((JScrollBar)c).getOrientation() == JScrollBar.HORIZONTAL) {
insets.top += spacing;
} else {
if (c.getComponentOrientation().isLeftToRight()) {
insets.left += spacing;
} else {
insets.right += spacing;
}
}
} else {
// This is a standalone scrollbar; leave enough room for the
// focus line in addition to the trough border.
if (c.isFocusable()) {
int focusSize =
getClassSpecificIntValue(context, "focus-line-width", 1);
int focusPad =
getClassSpecificIntValue(context, "focus-padding", 1);
int totalFocus = focusSize + focusPad;
insets.left += totalFocus;
insets.right += totalFocus;
insets.top += totalFocus;
insets.bottom += totalFocus;
}
}
return insets;
}
示例3: ComplexKey
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType; //导入依赖的package包/类
ComplexKey(WidgetType wt, Object... args) {
this.wt = wt;
this.args = args;
}
示例4: getClassSpecificIntValue
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType; //导入依赖的package包/类
/**
* Convenience method to get a class specific integer value for
* a particular WidgetType.
*
* @param wt WidgetType for which to fetch the value
* @param key Key identifying class specific value
* @param defaultValue Returned if there is no value for the specified
* type
* @return Value, or defaultValue if <code>key</code> is not defined
*/
private static int getClassSpecificIntValue(WidgetType wt, String key,
int defaultValue)
{
Object value = getClassSpecificValue(wt, key);
if (value instanceof Number) {
return ((Number)value).intValue();
}
return defaultValue;
}