当前位置: 首页>>代码示例>>Java>>正文


Java Region类代码示例

本文整理汇总了Java中javax.swing.plaf.synth.Region的典型用法代码示例。如果您正苦于以下问题:Java Region类的具体用法?Java Region怎么用?Java Region使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Region类属于javax.swing.plaf.synth包,在下文中一共展示了Region类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNames

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
void testNames() {
    Color defaultColor = label.getBackground();

    UIManager.put("\"BlueLabel\"[Enabled].background",
            new ColorUIResource(Color.BLUE));
    UIManager.put("\"RedLabel\"[Enabled].background",
            new ColorUIResource(Color.RED));
    nimbus.register(Region.LABEL, "\"BlueLabel\"");
    nimbus.register(Region.LABEL, "\"RedLabel\"");

    label.setName("BlueLabel");
    check(Color.BLUE);
    label.setName("RedLabel");
    check(Color.RED);

    // remove name, color goes back to default
    label.setName(null);
    check(defaultColor);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:ColorCustomizationTest.java

示例2: fixGtkPopupStyle

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
private static void fixGtkPopupStyle() {
  if (!UIUtil.isUnderGTKLookAndFeel()) return;

  final SynthStyleFactory original = SynthLookAndFeel.getStyleFactory();

  SynthLookAndFeel.setStyleFactory(new SynthStyleFactory() {
    @Override
    public SynthStyle getStyle(final JComponent c, final Region id) {
      final SynthStyle style = original.getStyle(c, id);
      if (id == Region.POPUP_MENU) {
        final Integer x = ReflectionUtil.getField(style.getClass(), style, int.class, "xThickness");
        if (x != null && x == 0) {
          // workaround for Sun bug #6636964
          ReflectionUtil.setField(style.getClass(), style, int.class, "xThickness", 1);
          ReflectionUtil.setField(style.getClass(), style, int.class, "yThickness", 3);
        }
      }
      return style;
    }
  });

  new JBPopupMenu();  // invokes updateUI() -> updateStyle()

  SynthLookAndFeel.setStyleFactory(original);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:LafManagerImpl.java

示例3: patchGtkDefaults

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
private static void patchGtkDefaults(UIDefaults defaults) {
  if (!UIUtil.isUnderGTKLookAndFeel()) return;

  Map<String, Icon> map = ContainerUtil.newHashMap(
    Arrays.asList("OptionPane.errorIcon", "OptionPane.informationIcon", "OptionPane.warningIcon", "OptionPane.questionIcon"),
    Arrays.asList(AllIcons.General.ErrorDialog, AllIcons.General.InformationDialog, AllIcons.General.WarningDialog, AllIcons.General.QuestionDialog));
  // GTK+ L&F keeps icons hidden in style
  SynthStyle style = SynthLookAndFeel.getStyle(new JOptionPane(""), Region.DESKTOP_ICON);
  for (String key : map.keySet()) {
    if (defaults.get(key) != null) continue;

    Object icon = style == null ? null : style.get(null, key);
    defaults.put(key, icon instanceof Icon ? icon : map.get(key));
  }

  Color fg = defaults.getColor("Label.foreground");
  Color bg = defaults.getColor("Label.background");
  if (fg != null && bg != null) {
    defaults.put("Label.disabledForeground", UIUtil.mix(fg, bg, 0.5));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LafManagerImpl.java

示例4: initialize

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * Called by UIManager when this look and feel is installed.
 */
@Override
public void initialize() {
    super.initialize();

    // create synth style factory
    setStyleFactory(new SynthStyleFactory() {
            @Override
            public SynthStyle getStyle(JComponent c, Region r) {
                SynthStyle style = getSeaGlassStyle(c, r);

                if (!(style instanceof SeaGlassStyle)) {
                    style = new SeaGlassStyleWrapper(style);
                }

                return style;
            }
        });
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:22,代码来源:SeaGlassLookAndFeel.java

示例5: uninstallDefaults

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
protected void uninstallDefaults() {
    SeaGlassContext context = getContext(slider, ENABLED);
    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    context = getContext(slider, Region.SLIDER_TRACK, ENABLED);
    sliderTrackStyle.uninstallDefaults(context);
    context.dispose();
    sliderTrackStyle = null;

    context = getContext(slider, Region.SLIDER_THUMB, ENABLED);
    sliderThumbStyle.uninstallDefaults(context);
    context.dispose();
    sliderThumbStyle = null;
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:17,代码来源:SeaGlassSliderUI.java

示例6: updateStyle

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
private void updateStyle(JToolBar c) {
    SeaGlassContext context = getContext(c, Region.TOOL_BAR_CONTENT, null, ENABLED);
    contentStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.getComponent().setOpaque(false);
    context.dispose();

    context = getContext(c, Region.TOOL_BAR_DRAG_WINDOW, null, ENABLED);
    context.getComponent().setOpaque(false);
    dragWindowStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(c, ENABLED);
    context.getComponent().setOpaque(false);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);
    if (oldStyle != style) {
        handleIcon = style.getIcon(context, "ToolBar.handleIcon");
        if (oldStyle != null) {
            uninstallKeyboardActions();
            installKeyboardActions();
        }
    }
    context.dispose();
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:26,代码来源:SeaGlassToolBarUI.java

示例7: uninstallDefaults

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
@Override
protected void uninstallDefaults() {
    SeaGlassContext context = getContext(toolBar, ENABLED);

    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    handleIcon = null;

    context = getContext(toolBar, Region.TOOL_BAR_CONTENT, contentStyle, ENABLED);
    contentStyle.uninstallDefaults(context);
    context.dispose();
    contentStyle = null;

    context = getContext(toolBar, Region.TOOL_BAR_DRAG_WINDOW, dragWindowStyle, ENABLED);
    dragWindowStyle.uninstallDefaults(context);
    context.dispose();
    dragWindowStyle = null;

    toolBar.setLayout(null);
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:23,代码来源:SeaGlassToolBarUI.java

示例8: paintSearchButton

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * DOCUMENT ME!
 *
 * @param g      DOCUMENT ME!
 * @param c      DOCUMENT ME!
 * @param region DOCUMENT ME!
 */
protected void paintSearchButton(Graphics g, JTextComponent c, Region region) {
    Rectangle bounds;

    if (region == SeaGlassRegion.SEARCH_FIELD_FIND_BUTTON) {
        bounds = getFindButtonBounds();
    } else {
        bounds = getCancelButtonBounds();
    }

    SeaGlassContext subcontext = getContext(c, region);

    SeaGlassLookAndFeel.updateSubregion(subcontext, g, bounds);

    SeaGlassSynthPainterImpl painter = (SeaGlassSynthPainterImpl) subcontext.getPainter();

    painter.paintSearchButtonForeground(subcontext, g, bounds.x, bounds.y, bounds.width, bounds.height);

    subcontext.dispose();
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:27,代码来源:SeaGlassTextFieldUI.java

示例9: getContext

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * Create a SynthContext for the component, subregion, and state.
 *
 * @param  c         the component.
 * @param  subregion the subregion.
 * @param  state     the state.
 *
 * @return the newly created SynthContext.
 */
private SeaGlassContext getContext(JComponent c, Region subregion, int state) {
    SynthStyle style = null;
    Class      klass = SeaGlassContext.class;

    if (subregion == Region.TABBED_PANE_TAB) {
        style = tabStyle;
    } else if (subregion == Region.TABBED_PANE_TAB_AREA) {
        style = tabAreaStyle;
    } else if (subregion == Region.TABBED_PANE_CONTENT) {
        style = tabContentStyle;
    } else if (subregion == SeaGlassRegion.TABBED_PANE_TAB_CLOSE_BUTTON) {
        style = tabCloseStyle;
    }

    return SeaGlassContext.getContext(klass, c, subregion, style, state);
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:26,代码来源:SeaGlassTabbedPaneUI.java

示例10: uninstallDefaults

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
protected void uninstallDefaults() {
    SeaGlassContext context = getContext(scrollbar, ENABLED);
    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    context = getContext(scrollbar, Region.SCROLL_BAR_TRACK, ENABLED);
    trackStyle.uninstallDefaults(context);
    context.dispose();
    trackStyle = null;

    context = getContext(scrollbar, Region.SCROLL_BAR_THUMB, ENABLED);
    thumbStyle.uninstallDefaults(context);
    context.dispose();
    thumbStyle = null;

    context = getContext(scrollbar, SeaGlassRegion.SCROLL_BAR_CAP, ENABLED);
    capStyle.uninstallDefaults(context);
    context.dispose();
    capStyle = null;

    super.uninstallDefaults();
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:24,代码来源:SeaGlassScrollBarUI.java

示例11: uninstallDefaults

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
protected void uninstallDefaults() {
    SeaGlassContext context = getContext(tree, ENABLED);

    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    context = getContext(tree, Region.TREE_CELL, ENABLED);
    cellStyle.uninstallDefaults(context);
    context.dispose();
    cellStyle = null;

    if (tree.getTransferHandler() instanceof UIResource) {
        tree.setTransferHandler(null);
    }
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:21,代码来源:SeaGlassTreeUI.java

示例12: SeaGlassContext

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * Creates a SeaGlassContext with the specified values. This is meant for
 * subclasses and custom UI implementors. You very rarely need to construct
 * a SeaGlassContext, though some methods will take one.
 *
 * @param component JComponent
 * @param region    Identifies the portion of the JComponent
 * @param style     Style associated with the component
 * @param state     State of the component as defined in SynthConstants.
 */
public SeaGlassContext(JComponent component, Region region, SynthStyle style, int state) {
    super(component, region, style, state);

    if (component == fakeComponent) {
        this.component = null;
        this.region    = null;
        this.style     = null;

        return;
    }

    if (component == null || region == null || style == null) {
        throw new NullPointerException("You must supply a non-null component, region and style");
    }

    reset(component, region, style, state);
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:28,代码来源:SeaGlassContext.java

示例13: paint

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * @see javax.swing.plaf.basic.BasicSplitPaneDivider#paint(java.awt.Graphics)
 */
public void paint(Graphics g) {
    Graphics g2 = g.create();

    SeaGlassContext context = ((SeaGlassSplitPaneUI) splitPaneUI).getContext(splitPane, Region.SPLIT_PANE_DIVIDER);
    Rectangle       bounds  = getBounds();

    bounds.x = bounds.y = 0;
    SeaGlassLookAndFeel.updateSubregion(context, g, bounds);
    context.getPainter().paintSplitPaneDividerBackground(context, g, 0, 0, bounds.width, bounds.height, splitPane.getOrientation());

    context.getPainter().paintSplitPaneDividerForeground(context, g, 0, 0, getWidth(), getHeight(), splitPane.getOrientation());
    context.dispose();

    // super.paint(g2);
    for (int counter = 0; counter < getComponentCount(); counter++) {
        Component child       = getComponent(counter);
        Rectangle childBounds = child.getBounds();
        Graphics  childG      = g.create(childBounds.x, childBounds.y, childBounds.width, childBounds.height);

        child.paint(childG);
        childG.dispose();
    }

    g2.dispose();
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:29,代码来源:SeaGlassSplitPaneDivider.java

示例14: paint

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/** Paint bumps to specific Graphics. */
@Override
public void paint (Graphics g) {
    Icon icon = UIManager.getIcon("ToolBar.handleIcon");
    Region region = Region.TOOL_BAR;
    SynthStyleFactory sf = SynthLookAndFeel.getStyleFactory();
    SynthStyle style = sf.getStyle(toolbar, region);
    SynthContext context = new SynthContext(toolbar, region, style, SynthConstants.DEFAULT);

    SynthGraphicsUtils sgu = context.getStyle().getGraphicsUtils(context);
    sgu.paintText(context, g, null, icon, SwingConstants.LEADING, SwingConstants.LEADING, 0, 0, 0, -1, 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ToolbarContainer.java

示例15: ThemeValue

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/** Creates a new instance of GTKColor */
public ThemeValue(Region region, ColorType colorType, Object fallback) {
    this.fallback = fallback;
    this.aRegion = region;
    this.aColorType = colorType;
    register(this);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ThemeValue.java


注:本文中的javax.swing.plaf.synth.Region类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。