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


Java UIManager.get方法代码示例

本文整理汇总了Java中javax.swing.UIManager.get方法的典型用法代码示例。如果您正苦于以下问题:Java UIManager.get方法的具体用法?Java UIManager.get怎么用?Java UIManager.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.UIManager的用法示例。


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

示例1: initToolbar

import javax.swing.UIManager; //导入方法依赖的package包/类
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(GarbageCollectAction.get(GarbageCollectAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:OutlineTopComponent.java

示例2: setAttrs

import javax.swing.UIManager; //导入方法依赖的package包/类
void setAttrs(Lookup.Result<FontColorSettings> result) {
    if (Boolean.TRUE.equals(component.getClientProperty("AsTextField"))) {
        if (UIManager.get("TextField.selectionBackground") != null) {
            attribs = AttributesUtilities.createImmutable(
                    StyleConstants.Background, (Color) UIManager.get("TextField.selectionBackground"),
                    StyleConstants.Foreground, (Color) UIManager.get("TextField.selectionForeground"));
        } else {
            final JTextField referenceTextField = (JTextField) new JComboBox<String>().getEditor().getEditorComponent();
            attribs = AttributesUtilities.createImmutable(
                    StyleConstants.Background, referenceTextField.getSelectionColor(),
                    StyleConstants.Foreground, referenceTextField.getSelectedTextColor());
        }
        return;
    }
    FontColorSettings fcs = result.allInstances().iterator().next();
    attribs = fcs.getFontColors(coloringName);
    if (attribs == null) {
        attribs = SimpleAttributeSet.EMPTY;
    } else if (extendsEOL || extendsEmptyLine) {
        attribs = AttributesUtilities.createImmutable(
                attribs,
                AttributesUtilities.createImmutable(
                ATTR_EXTENDS_EOL, Boolean.valueOf(extendsEOL),
                ATTR_EXTENDS_EMPTY_LINE, Boolean.valueOf(extendsEmptyLine)));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:CaretBasedBlockHighlighting.java

示例3: playSound

import javax.swing.UIManager; //导入方法依赖的package包/类
/**
 * If necessary, invokes {@code actionPerformed} on
 * {@code audioAction} to play a sound.
 * The {@code actionPerformed} method is invoked if the value of
 * the {@code "AuditoryCues.playList"} default is a {@code
 * non-null} {@code Object[]} containing a {@code String} entry
 * equal to the name of the {@code audioAction}.
 *
 * @param audioAction an Action that knows how to render the audio
 *                    associated with the system or user activity
 *                    that is occurring; a value of {@code null}, is
 *                    ignored
 * @throws ClassCastException if {@code audioAction} is {@code non-null}
 *         and the value of the default {@code "AuditoryCues.playList"}
 *         is not an {@code Object[]}
 * @since 1.4
 */
protected void playSound(Action audioAction) {
    if (audioAction != null) {
        Object[] audioStrings = (Object[])
                                UIManager.get("AuditoryCues.playList");
        if (audioStrings != null) {
            // create a HashSet to help us decide to play or not
            HashSet<Object> audioCues = new HashSet<Object>();
            for (Object audioString : audioStrings) {
                audioCues.add(audioString);
            }
            // get the name of the Action
            String actionName = (String)audioAction.getValue(Action.NAME);
            // if the actionName is in the audioCues HashSet, play it.
            if (audioCues.contains(actionName)) {
                audioAction.actionPerformed(new
                    ActionEvent(this, ActionEvent.ACTION_PERFORMED,
                                actionName));
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:BasicLookAndFeel.java

示例4: initGlobalFont

import javax.swing.UIManager; //导入方法依赖的package包/类
/**
 * 设置全局字体
 */
public static void initGlobalFont() {

    String lowDpiKey = "lowDpiInit";
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //得到屏幕的尺寸
    if (screenSize.width <= 1366 && StringUtils.isEmpty(configer.getProps(lowDpiKey))) {
        configer.setFontSize(15);
        configer.setProps(lowDpiKey, "true");
        configer.save();
    }

    Font fnt = new Font(configer.getFont(), Font.PLAIN, configer.getFontSize());
    FontUIResource fontRes = new FontUIResource(fnt);
    for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements(); ) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof FontUIResource)
            UIManager.put(key, fontRes);
    }
}
 
开发者ID:rememberber,项目名称:WePush,代码行数:23,代码来源:Init.java

示例5: calcRowHeight

import javax.swing.UIManager; //导入方法依赖的package包/类
/** Calculate the height of rows based on the current font. */
private void calcRowHeight() {
    //Users of themes can set an explicit row height, so check for it
    Integer i = (Integer) UIManager.get("netbeans.outline.rowHeight"); //NOI18N
    
    int rHeight = 20;
    if (i != null) {
        rHeight = i.intValue();
    } else {
        //Derive a row height to accomodate the font and expando icon
        Font f = getFont();
        FontMetrics fm = getFontMetrics(f);
        int h = Math.max (fm.getHeight () + fm.getMaxDescent (),
            DefaultOutlineCellRenderer.getExpansionHandleHeight ());
        rHeight = Math.max (rHeight, h) + 2; // XXX: two pixels for cell's insets
    }
    //Set row height.  If displayable, this will generate a new call
    //to paint()
    setRowHeight(rHeight);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Outline.java

示例6: getUIClassID

import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
public String getUIClassID() {
    if( UIManager.get("Nb.Toolbar.ui") != null ) { //NOI18N
        return "Nb.Toolbar.ui"; //NOI18N
    }
    return super.getUIClassID();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DependencyGraphTopComponent.java

示例7: getDefaultFontSize

import javax.swing.UIManager; //导入方法依赖的package包/类
static int getDefaultFontSize() {
    Integer customFontSize = (Integer)UIManager.get("customFontSize"); // NOI18N
    if (customFontSize != null) {
        return customFontSize.intValue();
    } else {
        Font systemDefaultFont = UIManager.getFont("TextField.font"); // NOI18N
        return (systemDefaultFont != null)
            ? systemDefaultFont.getSize()
            : 11;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:Utils.java

示例8: testCheckIconOffset

import javax.swing.UIManager; //导入方法依赖的package包/类
private int testCheckIconOffset() {

        for (int inx = 0; inx < menuClasses.length; inx++) {
            Object checkIconOffset = UIManager.get(menuClasses[inx]
                    + CHECKICONOFFSET);
            if (checkIconOffset != null && ((Integer) checkIconOffset) == 0) {
                return inx + 1;
            }
        }
        return 0;
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:bug8067346.java

示例9: getInteger

import javax.swing.UIManager; //导入方法依赖的package包/类
final int getInteger(Component component, String suffix) {
    Object value = UIManager.get(this.prefix + suffix, component.getLocale());
    if (value instanceof Integer) {
        return (Integer) value;
    }
    if (value instanceof String) {
        try {
            return Integer.parseInt((String) value);
        }
        catch (NumberFormatException exception) {
        }
    }
    return -1;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:ColorModel.java

示例10: CancelAction

import javax.swing.UIManager; //导入方法依赖的package包/类
CancelAction(boolean text) {
    if (text) {
        putValue(Action.NAME, NbBundle.getMessage(ListComponent.class, "StatusLineComponent.Cancel"));
        putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
    } else {
        Image icon = (Image)UIManager.get("nb.progress.cancel.icon");
        if (icon == null) {
            // for custom L&F?
            icon = ImageUtilities.loadImage("org/netbeans/progress/module/resources/buton.png");
        }
        putValue(Action.SMALL_ICON, new ImageIcon(icon));
    }
     setEnabled(handle == null ? false : handle.isAllowCancel());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ListComponent.java

示例11: installDefaults

import javax.swing.UIManager; //导入方法依赖的package包/类
protected void installDefaults() {
    super.installDefaults();

    titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
    buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
    buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;

    Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
    hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;


    if (XPStyle.getXP() != null) {
        // Fix for XP bug where sometimes these sizes aren't updated properly
        // Assume for now that height is correct and derive width using the
        // ratio from the uxtheme part
        buttonWidth = buttonHeight;
        Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
        if (d != null && d.width != 0 && d.height != 0) {
            buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
        }
    } else {
        buttonWidth += 2;
        Color activeBorderColor =
                UIManager.getColor("InternalFrame.activeBorderColor");
        setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
    }
    // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
    selectedTitleGradientColor =
            UIManager.getColor("InternalFrame.activeTitleGradient");
    notSelectedTitleGradientColor =
            UIManager.getColor("InternalFrame.inactiveTitleGradient");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:33,代码来源:WindowsInternalFrameTitlePane.java

示例12: findIcon

import javax.swing.UIManager; //导入方法依赖的package包/类
private Image findIcon (String key) {
    Object obj = UIManager.get(key);
    if (obj instanceof Image) {
        return (Image)obj;
    }

    if (obj instanceof Icon) {
        Icon icon = (Icon)obj;
        return ImageUtilities.icon2Image(icon);
    }

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:RepositoryBrowserPanel.java

示例13: paintTabBackground

import javax.swing.UIManager; //导入方法依赖的package包/类
private static void paintTabBackground (Graphics g, int index, Component c,
int x, int y, int w, int h) {

    Shape clip = g.getClip();
    NimbusEditorTabCellRenderer ren = (NimbusEditorTabCellRenderer) c;

    w +=1;
    boolean isPreviousTabSelected = ren.isPreviousTabSelected();
    if (isPreviousTabSelected) {
        g.setClip(x+1, y, w-1, h);
    }

    Object o = null;
    if (ren.isSelected()) {
        if (ren.isActive()) {
            o = UIManager.get("TabbedPane:TabbedPaneTab[MouseOver+Selected].backgroundPainter");
        } else {
            o = UIManager.get("TabbedPane:TabbedPaneTab[Selected].backgroundPainter");
        }
    } else {
        o = UIManager.get("TabbedPane:TabbedPaneTab[Enabled].backgroundPainter");
    }
    if ((o != null) && (o instanceof javax.swing.Painter)) {
        javax.swing.Painter painter = (javax.swing.Painter) o;
        BufferedImage bufIm = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = bufIm.createGraphics();
        g2d.setBackground(UIManager.getColor("Panel.background"));
        g2d.clearRect(0, 0, w, h);
        painter.paint(g2d, null, w, h);
        g.drawImage(bufIm, x, y, null);
    }

    if (isPreviousTabSelected) {
        g.setClip(clip);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:NimbusEditorTabCellRenderer.java

示例14: getAudioActionMap

import javax.swing.UIManager; //导入方法依赖的package包/类
/**
 * Returns an <code>ActionMap</code> containing the audio actions
 * for this look and feel.
 * <P>
 * The returned <code>ActionMap</code> contains <code>Actions</code> that
 * embody the ability to render an auditory cue. These auditory
 * cues map onto user and system activities that may be useful
 * for an end user to know about (such as a dialog box appearing).
 * <P>
 * At the appropriate time,
 * the {@code ComponentUI} is responsible for obtaining an
 * <code>Action</code> out of the <code>ActionMap</code> and passing
 * it to <code>playSound</code>.
 * <P>
 * This method first looks up the {@code ActionMap} from the
 * defaults using the key {@code "AuditoryCues.actionMap"}.
 * <p>
 * If the value is {@code non-null}, it is returned. If the value
 * of the default {@code "AuditoryCues.actionMap"} is {@code null}
 * and the value of the default {@code "AuditoryCues.cueList"} is
 * {@code non-null}, an {@code ActionMapUIResource} is created and
 * populated. Population is done by iterating over each of the
 * elements of the {@code "AuditoryCues.cueList"} array, and
 * invoking {@code createAudioAction()} to create an {@code
 * Action} for each element.  The resulting {@code Action} is
 * placed in the {@code ActionMapUIResource}, using the array
 * element as the key.  For example, if the {@code
 * "AuditoryCues.cueList"} array contains a single-element, {@code
 * "audioKey"}, the {@code ActionMapUIResource} is created, then
 * populated by way of {@code actionMap.put(cueList[0],
 * createAudioAction(cueList[0]))}.
 * <p>
 * If the value of the default {@code "AuditoryCues.actionMap"} is
 * {@code null} and the value of the default
 * {@code "AuditoryCues.cueList"} is {@code null}, an empty
 * {@code ActionMapUIResource} is created.
 *
 *
 * @return      an ActionMap containing {@code Actions}
 *              responsible for playing auditory cues
 * @throws ClassCastException if the value of the
 *         default {@code "AuditoryCues.actionMap"} is not an
 *         {@code ActionMap}, or the value of the default
 *         {@code "AuditoryCues.cueList"} is not an {@code Object[]}
 * @see #createAudioAction
 * @see #playSound(Action)
 * @since 1.4
 */
protected ActionMap getAudioActionMap() {
    ActionMap audioActionMap = (ActionMap)UIManager.get(
                                          "AuditoryCues.actionMap");
    if (audioActionMap == null) {
        Object[] acList = (Object[])UIManager.get("AuditoryCues.cueList");
        if (acList != null) {
            audioActionMap = new ActionMapUIResource();
            for(int counter = acList.length-1; counter >= 0; counter--) {
                audioActionMap.put(acList[counter],
                                   createAudioAction(acList[counter]));
            }
        }
        UIManager.getLookAndFeelDefaults().put("AuditoryCues.actionMap",
                                               audioActionMap);
    }
    return audioActionMap;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:66,代码来源:BasicLookAndFeel.java

示例15: run

import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
public void run() {
    UIManager.put("foobar", "Pending");
    UIManager.get("foobar");
    passed = true;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:Pending.java


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