示例#1
0
  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
0
 /**
  * Returns the value for a class specific property for a particular WidgetType. This method is
  * useful in those cases where we need to fetch a value for a Region that is not associated with
  * the component currently in use (e.g. we need to figure out the insets for a SCROLL_BAR, but
  * certain values can only be extracted from a SCROLL_PANE region).
  *
  * @param wt WidgetType for which to fetch the value
  * @param key Key identifying class specific value
  * @return Value, or null if one has not been defined
  */
 private static Object getClassSpecificValue(WidgetType wt, String key) {
   synchronized (UNIXToolkit.GTK_LOCK) {
     return nativeGetClassValue(wt.ordinal(), key);
   }
 }