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


Java UIResource类代码示例

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


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

示例1: addZone

import javax.swing.plaf.UIResource; //导入依赖的package包/类
/**
 * Adds a new zone in the StatusBar
 *
 * @param id
 * @param zone
 * @param constraints one of the constraint support by the
 *                    {@link com.l2fprod.common.swing.PercentLayout}
 */
public void addZone(String id, Component zone, String constraints) {
    // is there already a zone with this id?
    Component previousZone = getZone(id);
    if (previousZone != null) {
        remove(previousZone);
        idToZones.remove(id);
    }

    if (zone instanceof JComponent) {
        JComponent jc = (JComponent) zone;
        if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) {
            if (jc instanceof JLabel) {
                jc.setBorder(
                        new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2)));
                //    ((JLabel) jc).setText(" ");
            } else {
                jc.setBorder(zoneBorder);
            }
        }
    }

    add(zone, constraints);
    idToZones.put(id, zone);
}
 
开发者ID:phweda,项目名称:MFM,代码行数:33,代码来源:StatusBar.java

示例2: getDerivedColor

import javax.swing.plaf.UIResource; //导入依赖的package包/类
private DerivedColor getDerivedColor(String uin, String parentUin,
                                    float hOffset, float sOffset,
                                    float bOffset, int aOffset,
                                    boolean uiResource) {
    DerivedColor color;
    if (uiResource) {
        color = new DerivedColor.UIResource(parentUin,
                hOffset, sOffset, bOffset, aOffset);
    } else {
        color = new DerivedColor(parentUin, hOffset, sOffset,
            bOffset, aOffset);
    }

    if (derivedColors.containsKey(color)) {
        return derivedColors.get(color);
    } else {
        derivedColors.put(color, color);
        color.rederiveColor(); /// move to ARP.decodeColor() ?
        colorTree.addColor(uin, color);
        return color;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:NimbusDefaults.java

示例3: swapSelectionColors

import javax.swing.plaf.UIResource; //导入依赖的package包/类
static void swapSelectionColors(final String prefix, final JTable c, final Object value) {
    if (!isComponentValid(c)) return;

    final Color bg = c.getSelectionBackground();
    final Color fg = c.getSelectionForeground();
    if (!(bg instanceof UIResource) || !(fg instanceof UIResource)) return;

    if (Boolean.FALSE.equals(value)) {
        setSelectionColors(c, "Table.selectionInactiveForeground", "Table.selectionInactiveBackground");
        return;
    }

    if (Boolean.TRUE.equals(value)) {
        setSelectionColors(c, "Table.selectionForeground", "Table.selectionBackground");
        return;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:AquaFocusHandler.java

示例4: getIconWidth

import javax.swing.plaf.UIResource; //导入依赖的package包/类
@Override
public int getIconWidth(SynthContext context) {
    if (context == null) {
        return width;
    }
    JComponent c = context.getComponent();
    if (c instanceof JToolBar && ((JToolBar)c).getOrientation() == JToolBar.VERTICAL) {
        //we only do the -1 hack for UIResource borders, assuming
        //that the border is probably going to be our border
        if (c.getBorder() instanceof UIResource) {
            return c.getWidth() - 1;
        } else {
            return c.getWidth();
        }
    } else {
        return scale(context, width);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:NimbusIcon.java

示例5: getIconHeight

import javax.swing.plaf.UIResource; //导入依赖的package包/类
@Override
public int getIconHeight(SynthContext context) {
    if (context == null) {
        return height;
    }
    JComponent c = context.getComponent();
    if (c instanceof JToolBar){
        JToolBar toolbar = (JToolBar)c;
        if (toolbar.getOrientation() == JToolBar.HORIZONTAL) {
            //we only do the -1 hack for UIResource borders, assuming
            //that the border is probably going to be our border
            if (toolbar.getBorder() instanceof UIResource) {
                return c.getHeight() - 1;
            } else {
                return c.getHeight();
            }
        } else {
            return scale(context, width);
        }
    } else {
        return scale(context, height);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:NimbusIcon.java

示例6: fillRect

import javax.swing.plaf.UIResource; //导入依赖的package包/类
static void fillRect(final Graphics g, final Component c, final Color color,
                     final int x, final int y, final int w, final int h) {
    if (!(g instanceof Graphics2D)) {
        return;
    }
    final Graphics2D cg = (Graphics2D) g.create();
    try {
        if (color instanceof UIResource && isWindowTextured(c)
                && color.equals(SystemColor.window)) {
            cg.setComposite(AlphaComposite.Src);
            cg.setColor(resetAlpha(color));
        } else {
            cg.setColor(color);
        }
        cg.fillRect(x, y, w, h);
    } finally {
        cg.dispose();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AquaUtils.java

示例7: uninstallUI

import javax.swing.plaf.UIResource; //导入依赖的package包/类
/**
 * Deinstalls the UI for a component.  This removes the listeners,
 * uninstalls the highlighter, removes views, and nulls out the keymap.
 *
 * @param c the editor component
 * @see ComponentUI#uninstallUI
 */
public void uninstallUI(JComponent c) {
    // detach from the model
    editor.removePropertyChangeListener(updateHandler);
    editor.getDocument().removeDocumentListener(updateHandler);

    // view part
    painted = false;
    uninstallDefaults();
    rootView.setView(null);
    c.removeAll();
    LayoutManager lm = c.getLayout();
    if (lm instanceof UIResource) {
        c.setLayout(null);
    }

    // controller part
    uninstallKeyboardActions();
    uninstallListeners();

    editor = null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:BasicTextUI.java

示例8: installDefaults

import javax.swing.plaf.UIResource; //导入依赖的package包/类
/**
 * Installs the necessary state from this Style on the
 * <code>JComponent</code> from <code>context</code>.
 *
 * @param context SynthContext identifying component to install properties
 *        to.
 */
public void installDefaults(SynthContext context) {
    if (!context.isSubregion()) {
        JComponent c = context.getComponent();
        Region region = context.getRegion();
        Font font = c.getFont();

        if (font == null || (font instanceof UIResource)) {
            c.setFont(getFontForState(context));
        }
        Color background = c.getBackground();
        if (background == null || (background instanceof UIResource)) {
            c.setBackground(getColorForState(context,
                                             ColorType.BACKGROUND));
        }
        Color foreground = c.getForeground();
        if (foreground == null || (foreground instanceof UIResource)) {
            c.setForeground(getColorForState(context,
                     ColorType.FOREGROUND));
        }
        LookAndFeel.installProperty(c, "opaque", Boolean.valueOf(isOpaque(context)));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:SynthStyle.java

示例9: paintTitle

import javax.swing.plaf.UIResource; //导入依赖的package包/类
protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetrics metrics, final Rectangle textRect, final int tabIndex, final String title) {
    final View v = getTextViewForTab(tabIndex);
    if (v != null) {
        v.paint(g2d, textRect);
        return;
    }

    if (title == null) return;

    final Color color = tabPane.getForegroundAt(tabIndex);
    if (color instanceof UIResource) {
        g2d.setColor(getNonSelectedTabTitleColor());
        if (tabPane.getSelectedIndex() == tabIndex) {
            boolean pressed = isPressedAt(tabIndex);
            boolean enabled = tabPane.isEnabled() && tabPane.isEnabledAt(tabIndex);
            Color textColor = getSelectedTabTitleColor(enabled, pressed);
            Color shadowColor = getSelectedTabTitleShadowColor(enabled);
            AquaUtils.paintDropShadowText(g2d, tabPane, font, metrics, textRect.x, textRect.y, 0, 1, textColor, shadowColor, title);
            return;
        }
    } else {
        g2d.setColor(color);
    }
    g2d.setFont(font);
    SwingUtilities2.drawString(tabPane, g2d, title, textRect.x, textRect.y + metrics.getAscent());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:AquaTabbedPaneContrastUI.java

示例10: uninstallDefaults

import javax.swing.plaf.UIResource; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void uninstallDefaults() {
    SynthContext 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:SynthTreeUI.java

示例11: uninstallDefaults

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

    style.uninstallDefaults(context);
    style = null;

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


    if (tree.getTransferHandler() instanceof UIResource) {
        tree.setTransferHandler(null);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:SynthTreeUI.java

示例12: uninstallDefaults

import javax.swing.plaf.UIResource; //导入依赖的package包/类
/**
 * Uninstalls any state that this style installed on
 * the <code>JComponent</code> from <code>context</code>.
 * <p>
 * Styles should NOT depend upon this being called, in certain cases
 * it may never be called.
 *
 * @param context SynthContext identifying component to install properties
 *        to.
 */
public void uninstallDefaults(SynthContext context) {
    if (!context.isSubregion()) {
        // NOTE: because getForeground, getBackground and getFont will look
        // at the parent Container, if we set them to null it may
        // mean we they return a non-null and non-UIResource value
        // preventing install from correctly settings its colors/font. For
        // this reason we do not uninstall the fg/bg/font.

        JComponent c = context.getComponent();
        Border border = c.getBorder();

        if (border instanceof UIResource) {
            c.setBorder(null);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:SynthStyle.java

示例13: configureScrollBarColors

import javax.swing.plaf.UIResource; //导入依赖的package包/类
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:XTextAreaPeer.java

示例14: adjustBackground

import javax.swing.plaf.UIResource; //导入依赖的package包/类
/**
 * Change background of given component to light gray on Mac look and feel
 * when the component is in a tabbed container and its background hasn't been
 * already changed (is instance of UIResource).
 * @param c
 */
static void adjustBackground( JComponent c ) {
    if( !isAquaLaF || useDefaultBackground )
        return;

    if( !isInTabbedContainer(c) )
        return;

    Color currentBackground = c.getBackground();
    if( currentBackground instanceof UIResource ) {
        c.setBackground(UIManager.getColor("NbExplorerView.background"));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ViewUtil.java

示例15: paintComponent

import javax.swing.plaf.UIResource; //导入依赖的package包/类
@Override
protected void paintComponent(Graphics g) {
    Color c = getBackground();
    if (c instanceof UIResource) {
        // Nimbus LaF: if the color is a UIResource, it will paint
        // the leftover area with default JPanel color which is gray, which looks ugly
        super.setBackground(new Color(c.getRGB()));
    }
    super.paintComponent(g);
    super.setBackground(c);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ShortcutCellPanel.java


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