• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Region类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: register

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * <p>Registers the given region and prefix. The prefix, if it contains
 * quoted sections, refers to certain named components. If there are not
 * quoted sections, then the prefix refers to a generic component type.</p>
 *
 * <p>If the given region/prefix combo has already been registered, then
 * it will not be registered twice. The second registration attempt will
 * fail silently.</p>
 *
 * @param region The Synth Region that is being registered. Such as Button,
 *        or ScrollBarThumb.
 * @param prefix The UIDefault prefix. For example, could be ComboBox, or if
 *        a named components, "MyComboBox", or even something like
 *        ToolBar:"MyComboBox":"ComboBox.arrowButton"
 */
void register(Region region, String prefix) {
    //validate the method arguments
    if (region == null || prefix == null) {
        throw new IllegalArgumentException(
                "Neither Region nor Prefix may be null");
    }

    //Add a LazyStyle for this region/prefix to m.
    List<LazyStyle> styles = m.get(region);
    if (styles == null) {
        styles = new LinkedList<LazyStyle>();
        styles.add(new LazyStyle(prefix));
        m.put(region, styles);
    } else {
        //iterate over all the current styles and see if this prefix has
        //already been registered. If not, then register it.
        for (LazyStyle s : styles) {
            if (prefix.equals(s.prefix)) {
                return;
            }
        }
        styles.add(new LazyStyle(prefix));
    }

    //add this region to the map of registered regions
    registeredRegions.put(region.getName(), region);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:NimbusDefaults.java


示例17: getStyle

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/**
 * <p>Locate the style associated with the given region, and component.
 * This is called from NimbusLookAndFeel in the SynthStyleFactory
 * implementation.</p>
 *
 * <p>Lookup occurs as follows:<br/>
 * Check the map of styles <code>m</code>. If the map contains no styles at
 * all, then simply return the defaultStyle. If the map contains styles,
 * then iterate over all of the styles for the Region <code>r</code> looking
 * for the best match, based on prefix. If a match was made, then return
 * that SynthStyle. Otherwise, return the defaultStyle.</p>
 *
 * @param comp The component associated with this region. For example, if
 *        the Region is Region.Button then the component will be a JButton.
 *        If the Region is a subregion, such as ScrollBarThumb, then the
 *        associated component will be the component that subregion belongs
 *        to, such as JScrollBar. The JComponent may be named. It may not be
 *        null.
 * @param r The region we are looking for a style for. May not be null.
 */
SynthStyle getStyle(JComponent comp, Region r) {
    //validate method arguments
    if (comp == null || r == null) {
        throw new IllegalArgumentException(
                "Neither comp nor r may be null");
    }

    //if there are no lazy styles registered for the region r, then return
    //the default style
    List<LazyStyle> styles = m.get(r);
    if (styles == null || styles.size() == 0) {
        return defaultStyle;
    }

    //Look for the best SynthStyle for this component/region pair.
    LazyStyle foundStyle = null;
    for (LazyStyle s : styles) {
        if (s.matches(comp)) {
            //replace the foundStyle if foundStyle is null, or
            //if the new style "s" is more specific (ie, its path was
            //longer), or if the foundStyle was "simple" and the new style
            //was not (ie: the foundStyle was for something like Button and
            //the new style was for something like "MyButton", hence, being
            //more specific.) In all cases, favor the most specific style
            //found.
            if (foundStyle == null ||
               (foundStyle.parts.length < s.parts.length) ||
               (foundStyle.parts.length == s.parts.length 
                && foundStyle.simple && !s.simple)) {
                foundStyle = s;
            }
        }
    }

    //return the style, if found, or the default style if not found
    return foundStyle == null ? defaultStyle : foundStyle.getStyle(comp, r);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:58,代码来源:NimbusDefaults.java


示例18: matches

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
private boolean matches(Component c, int partIndex) {
    if (partIndex < 0) return true;
    if (c == null) return false;
    //only get here if partIndex > 0 and c == null

    String name = c.getName();
    if (parts[partIndex].named && parts[partIndex].s.equals(name)) {
        //so far so good, recurse
        return matches(c.getParent(), partIndex - 1);
    } else if (!parts[partIndex].named) {
        //if c is not named, and parts[partIndex] has an expected class
        //type registered, then check to make sure c is of the
        //right type;
        Class clazz = parts[partIndex].c;
        if (clazz != null && clazz.isAssignableFrom(c.getClass())) {
            //so far so good, recurse
            return matches(c.getParent(), partIndex - 1);
        } else if (clazz == null &&
                   registeredRegions.containsKey(parts[partIndex].s)) {
            Region r = registeredRegions.get(parts[partIndex].s);
            Component parent = r.isSubregion() ? c : c.getParent();
            //special case the JInternalFrameTitlePane, because it
            //doesn't fit the mold. very, very funky.
            if (r == Region.INTERNAL_FRAME_TITLE_PANE && parent != null
                && parent instanceof JInternalFrame.JDesktopIcon) {
                JInternalFrame.JDesktopIcon icon =
                        (JInternalFrame.JDesktopIcon) parent;
                parent = icon.getInternalFrame();
            }
            //it was the name of a region. So far, so good. Recurse.
            return matches(parent, partIndex - 1);
        }
    }

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:NimbusDefaults.java


示例19: initialize

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
/** Called by UIManager when this look and feel is installed. */
@Override public void initialize() {
    super.initialize();
    defaults.initialize();
    // create synth style factory
    setStyleFactory(new SynthStyleFactory() {
        @Override
        public SynthStyle getStyle(JComponent c, Region r) {
            return defaults.getStyle(c, r);
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:NimbusLookAndFeel.java


示例20: Test6660049

import javax.swing.plaf.synth.Region; //导入依赖的package包/类
private Test6660049(Class<? extends JComponent>... types) {
    this.types = types;
    run();

    this.region = new Region("Button", "ButtonUI", true) {
        @Override
        public String getName() {
            throw new Error("6660049: exploit is available");
        }
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:Test6660049.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StdConverter类代码示例发布时间:2022-05-21
下一篇:
Java ApiKeyAuthDefinition类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap