javax.swing.plaf.synth.SynthUI#sun.swing.DefaultLookup源码实例Demo

下面列出了javax.swing.plaf.synth.SynthUI#sun.swing.DefaultLookup 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u60   文件: BasicButtonListener.java
public void focusLost(FocusEvent e) {
    AbstractButton b = (AbstractButton) e.getSource();
    JRootPane root = b.getRootPane();
    if (root != null) {
       JButton initialDefault = (JButton)root.getClientProperty("initialDefaultButton");
       if (b != initialDefault) {
           BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType(
                     b.getUI(), BasicButtonUI.class);
           if (ui != null && DefaultLookup.getBoolean(b, ui,
                               ui.getPropertyPrefix() +
                               "defaultButtonFollowsFocus", true)) {
               root.setDefaultButton(initialDefault);
           }
       }
    }

    ButtonModel model = b.getModel();
    model.setPressed(false);
    model.setArmed(false);
    b.repaint();
}
 
源代码2 项目: openjdk-jdk8u-backup   文件: BasicRootPaneUI.java
/**
 * Invoked when the default button property has changed. This reloads
 * the bindings from the defaults table with name
 * <code>RootPane.defaultButtonWindowKeyBindings</code>.
 */
void updateDefaultButtonBindings(JRootPane root) {
    InputMap km = SwingUtilities.getUIInputMap(root, JComponent.
                                           WHEN_IN_FOCUSED_WINDOW);
    while (km != null && !(km instanceof RootPaneInputMap)) {
        km = km.getParent();
    }
    if (km != null) {
        km.clear();
        if (root.getDefaultButton() != null) {
            Object[] bindings = (Object[])DefaultLookup.get(root, this,
                       "RootPane.defaultButtonWindowKeyBindings");
            if (bindings != null) {
                LookAndFeel.loadKeyBindings(km, bindings);
            }
        }
    }
}
 
源代码3 项目: openjdk-jdk8u   文件: BasicTreeUI.java
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        return (InputMap)DefaultLookup.get(tree, this,
                                           "Tree.ancestorInputMap");
    }
    else if (condition == JComponent.WHEN_FOCUSED) {
        InputMap keyMap = (InputMap)DefaultLookup.get(tree, this,
                                                  "Tree.focusInputMap");
        InputMap rtlKeyMap;

        if (tree.getComponentOrientation().isLeftToRight() ||
              ((rtlKeyMap = (InputMap)DefaultLookup.get(tree, this,
              "Tree.focusInputMap.RightToLeft")) == null)) {
            return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
源代码4 项目: jdk8u-jdk   文件: BasicSplitPaneDivider.java
/**
 * Creates an instance of BasicSplitPaneDivider. Registers this
 * instance for mouse events and mouse dragged events.
 */
public BasicSplitPaneDivider(BasicSplitPaneUI ui) {
    oneTouchSize = DefaultLookup.getInt(ui.getSplitPane(), ui,
            "SplitPane.oneTouchButtonSize", ONE_TOUCH_SIZE);
    oneTouchOffset = DefaultLookup.getInt(ui.getSplitPane(), ui,
            "SplitPane.oneTouchButtonOffset", ONE_TOUCH_OFFSET);
    centerOneTouchButtons = DefaultLookup.getBoolean(ui.getSplitPane(),
             ui, "SplitPane.centerOneTouchButtons", true);
    setLayout(new DividerLayout());
    setBasicSplitPaneUI(ui);
    orientation = splitPane.getOrientation();
    setCursor((orientation == JSplitPane.HORIZONTAL_SPLIT) ?
              Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR) :
              Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
    setBackground(UIManager.getColor("SplitPane.background"));
}
 
源代码5 项目: jdk1.8-source-analysis   文件: BasicTextUI.java
private void installDefaults2() {
    editor.addMouseListener(dragListener);
    editor.addMouseMotionListener(dragListener);

    String prefix = getPropertyPrefix();

    Caret caret = editor.getCaret();
    if (caret == null || caret instanceof UIResource) {
        caret = createCaret();
        editor.setCaret(caret);

        int rate = DefaultLookup.getInt(getComponent(), this, prefix + ".caretBlinkRate", 500);
        caret.setBlinkRate(rate);
    }

    Highlighter highlighter = editor.getHighlighter();
    if (highlighter == null || highlighter instanceof UIResource) {
        editor.setHighlighter(createHighlighter());
    }

    TransferHandler th = editor.getTransferHandler();
    if (th == null || th instanceof UIResource) {
        editor.setTransferHandler(getTransferHandler());
    }
}
 
源代码6 项目: JDKSourceCode1.8   文件: BasicListUI.java
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_FOCUSED) {
        InputMap keyMap = (InputMap)DefaultLookup.get(
                         list, this, "List.focusInputMap");
        InputMap rtlKeyMap;

        if (isLeftToRight ||
            ((rtlKeyMap = (InputMap)DefaultLookup.get(list, this,
                          "List.focusInputMap.RightToLeft")) == null)) {
                return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
源代码7 项目: jdk8u-jdk   文件: BasicOptionPaneUI.java
/**
 * Returns the icon to use for the passed in type.
 */
protected Icon getIconForType(int messageType) {
    if(messageType < 0 || messageType > 3)
        return null;
    String propertyName = null;
    switch(messageType) {
    case 0:
        propertyName = "OptionPane.errorIcon";
        break;
    case 1:
        propertyName = "OptionPane.informationIcon";
        break;
    case 2:
        propertyName = "OptionPane.warningIcon";
        break;
    case 3:
        propertyName = "OptionPane.questionIcon";
        break;
    }
    if (propertyName != null) {
        return (Icon)DefaultLookup.get(optionPane, this, propertyName);
    }
    return null;
}
 
源代码8 项目: jdk1.8-source-analysis   文件: BasicSliderUI.java
InputMap getInputMap(int condition, JSlider slider) {
    if (condition == JComponent.WHEN_FOCUSED) {
        InputMap keyMap = (InputMap)DefaultLookup.get(slider, this,
              "Slider.focusInputMap");
        InputMap rtlKeyMap;

        if (slider.getComponentOrientation().isLeftToRight() ||
            ((rtlKeyMap = (InputMap)DefaultLookup.get(slider, this,
                      "Slider.focusInputMap.RightToLeft")) == null)) {
            return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
源代码9 项目: TencentKona-8   文件: BasicListUI.java
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_FOCUSED) {
        InputMap keyMap = (InputMap)DefaultLookup.get(
                         list, this, "List.focusInputMap");
        InputMap rtlKeyMap;

        if (isLeftToRight ||
            ((rtlKeyMap = (InputMap)DefaultLookup.get(list, this,
                          "List.focusInputMap.RightToLeft")) == null)) {
                return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
源代码10 项目: Bytecoder   文件: BasicSliderUI.java
InputMap getInputMap(int condition, JSlider slider) {
    if (condition == JComponent.WHEN_FOCUSED) {
        InputMap keyMap = (InputMap)DefaultLookup.get(slider, this,
              "Slider.focusInputMap");
        InputMap rtlKeyMap;

        if (slider.getComponentOrientation().isLeftToRight() ||
            ((rtlKeyMap = (InputMap)DefaultLookup.get(slider, this,
                      "Slider.focusInputMap.RightToLeft")) == null)) {
            return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
/**
 * Creates an instance of BasicSplitPaneDivider. Registers this
 * instance for mouse events and mouse dragged events.
 */
public BasicSplitPaneDivider(BasicSplitPaneUI ui) {
    oneTouchSize = DefaultLookup.getInt(ui.getSplitPane(), ui,
            "SplitPane.oneTouchButtonSize", ONE_TOUCH_SIZE);
    oneTouchOffset = DefaultLookup.getInt(ui.getSplitPane(), ui,
            "SplitPane.oneTouchButtonOffset", ONE_TOUCH_OFFSET);
    centerOneTouchButtons = DefaultLookup.getBoolean(ui.getSplitPane(),
             ui, "SplitPane.centerOneTouchButtons", true);
    setLayout(new DividerLayout());
    setBasicSplitPaneUI(ui);
    orientation = splitPane.getOrientation();
    setCursor((orientation == JSplitPane.HORIZONTAL_SPLIT) ?
              Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR) :
              Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
    setBackground(UIManager.getColor("SplitPane.background"));
}
 
源代码12 项目: openjdk-jdk8u-backup   文件: BasicButtonListener.java
public void focusLost(FocusEvent e) {
    AbstractButton b = (AbstractButton) e.getSource();
    JRootPane root = b.getRootPane();
    if (root != null) {
       JButton initialDefault = (JButton)root.getClientProperty("initialDefaultButton");
       if (b != initialDefault) {
           BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType(
                     b.getUI(), BasicButtonUI.class);
           if (ui != null && DefaultLookup.getBoolean(b, ui,
                               ui.getPropertyPrefix() +
                               "defaultButtonFollowsFocus", true)) {
               root.setDefaultButton(initialDefault);
           }
       }
    }

    ButtonModel model = b.getModel();
    model.setPressed(false);
    model.setArmed(false);
    b.repaint();
}
 
源代码13 项目: Bytecoder   文件: BasicOptionPaneUI.java
/**
 * Creates and returns a {@code Container} containing the buttons.
 * The buttons are created by calling {@code getButtons}.
 *
 * @return a {@code Container} containing the buttons
 */
protected Container createButtonArea() {
    JPanel bottom = new JPanel();
    Border border = (Border)DefaultLookup.get(optionPane, this,
                                      "OptionPane.buttonAreaBorder");
    bottom.setName("OptionPane.buttonArea");
    if (border != null) {
        bottom.setBorder(border);
    }
    bottom.setLayout(new ButtonAreaLayout(
       DefaultLookup.getBoolean(optionPane, this,
                                "OptionPane.sameSizeButtons", true),
       DefaultLookup.getInt(optionPane, this, "OptionPane.buttonPadding",
                            6),
       DefaultLookup.getInt(optionPane, this,
                    "OptionPane.buttonOrientation", SwingConstants.CENTER),
       DefaultLookup.getBoolean(optionPane, this, "OptionPane.isYesLast",
                                false)));
    addButtonComponents(bottom, getButtons(), getInitialValueIndex());
    return bottom;
}
 
源代码14 项目: openjdk-jdk8u   文件: BasicTabbedPaneUI.java
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) {
    Rectangle tabRect = rects[tabIndex];
    String propKey = (isSelected ? "selectedLabelShift" : "labelShift");
    int nudge = DefaultLookup.getInt(
            tabPane, this, "TabbedPane." + propKey, 1);

    switch (tabPlacement) {
        case LEFT:
            return nudge;
        case RIGHT:
            return -nudge;
        case BOTTOM:
        case TOP:
        default:
            return tabRect.width % 2;
    }
}
 
源代码15 项目: jdk1.8-source-analysis   文件: BasicRootPaneUI.java
/**
 * Invoked when the default button property has changed. This reloads
 * the bindings from the defaults table with name
 * <code>RootPane.defaultButtonWindowKeyBindings</code>.
 */
void updateDefaultButtonBindings(JRootPane root) {
    InputMap km = SwingUtilities.getUIInputMap(root, JComponent.
                                           WHEN_IN_FOCUSED_WINDOW);
    while (km != null && !(km instanceof RootPaneInputMap)) {
        km = km.getParent();
    }
    if (km != null) {
        km.clear();
        if (root.getDefaultButton() != null) {
            Object[] bindings = (Object[])DefaultLookup.get(root, this,
                       "RootPane.defaultButtonWindowKeyBindings");
            if (bindings != null) {
                LookAndFeel.loadKeyBindings(km, bindings);
            }
        }
    }
}
 
源代码16 项目: jdk1.8-source-analysis   文件: BasicListUI.java
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_FOCUSED) {
        InputMap keyMap = (InputMap)DefaultLookup.get(
                         list, this, "List.focusInputMap");
        InputMap rtlKeyMap;

        if (isLeftToRight ||
            ((rtlKeyMap = (InputMap)DefaultLookup.get(list, this,
                          "List.focusInputMap.RightToLeft")) == null)) {
                return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
源代码17 项目: dragonwell8_jdk   文件: BasicSpinnerUI.java
public void stateChanged(ChangeEvent e) {
    if (e.getSource() instanceof JSpinner) {
        JSpinner spinner = (JSpinner)e.getSource();
        SpinnerUI spinnerUI = spinner.getUI();
        if (DefaultLookup.getBoolean(spinner, spinnerUI,
            "Spinner.disableOnBoundaryValues", false) &&
            spinnerUI instanceof BasicSpinnerUI) {
            BasicSpinnerUI ui = (BasicSpinnerUI)spinnerUI;
            ui.updateEnabledState();
        }
    }
}
 
源代码18 项目: jdk8u_jdk   文件: BasicOptionPaneUI.java
/**
 * Configures any necessary colors/fonts for the specified button
 * used representing the button portion of the optionpane.
 */
private void configureButton(JButton button) {
    Font buttonFont = (Font)DefaultLookup.get(optionPane, this,
                                        "OptionPane.buttonFont");
    if (buttonFont != null) {
        button.setFont(buttonFont);
    }
}
 
源代码19 项目: openjdk-jdk9   文件: BasicOptionPaneUI.java
/**
 * Configures any necessary colors/fonts for the specified button
 * used representing the button portion of the optionpane.
 */
private void configureButton(JButton button) {
    Font buttonFont = (Font)DefaultLookup.get(optionPane, this,
                                        "OptionPane.buttonFont");
    if (buttonFont != null) {
        button.setFont(buttonFont);
    }
}
 
源代码20 项目: Bytecoder   文件: BasicListUI.java
private void paintDropLine(Graphics g) {
    JList.DropLocation loc = list.getDropLocation();
    if (loc == null || !loc.isInsert()) {
        return;
    }

    Color c = DefaultLookup.getColor(list, this, "List.dropLineColor", null);
    if (c != null) {
        g.setColor(c);
        Rectangle rect = getDropLineRect(loc);
        g.fillRect(rect.x, rect.y, rect.width, rect.height);
    }
}
 
源代码21 项目: jdk8u_jdk   文件: BasicInternalFrameTitlePane.java
public void paint(Graphics g) {
    Icon icon = frame.getFrameIcon();
    if (icon == null) {
      icon = (Icon)DefaultLookup.get(frame, frame.getUI(),
              "InternalFrame.icon");
    }
    if (icon != null) {
        // Resize to 16x16 if necessary.
        if (icon instanceof ImageIcon && (icon.getIconWidth() > 16 || icon.getIconHeight() > 16)) {
            Image img = ((ImageIcon)icon).getImage();
            ((ImageIcon)icon).setImage(img.getScaledInstance(16, 16, Image.SCALE_SMOOTH));
        }
        icon.paintIcon(this, g, 0, 0);
    }
}
 
源代码22 项目: Java8CN   文件: BasicOptionPaneUI.java
/**
 * Configures any necessary colors/fonts for the specified button
 * used representing the button portion of the optionpane.
 */
private void configureButton(JButton button) {
    Font buttonFont = (Font)DefaultLookup.get(optionPane, this,
                                        "OptionPane.buttonFont");
    if (buttonFont != null) {
        button.setFont(buttonFont);
    }
}
 
源代码23 项目: Java8CN   文件: BasicOptionPaneUI.java
/**
 * Messaged from installComponents to create a Container containing the
 * body of the message. The icon is the created by calling
 * <code>addIcon</code>.
 */
protected Container createMessageArea() {
    JPanel top = new JPanel();
    Border topBorder = (Border)DefaultLookup.get(optionPane, this,
                                         "OptionPane.messageAreaBorder");
    if (topBorder != null) {
        top.setBorder(topBorder);
    }
    top.setLayout(new BorderLayout());

    /* Fill the body. */
    Container          body = new JPanel(new GridBagLayout());
    Container          realBody = new JPanel(new BorderLayout());

    body.setName("OptionPane.body");
    realBody.setName("OptionPane.realBody");

    if (getIcon() != null) {
        JPanel sep = new JPanel();
        sep.setName("OptionPane.separator");
        sep.setPreferredSize(new Dimension(15, 1));
        realBody.add(sep, BorderLayout.BEFORE_LINE_BEGINS);
    }
    realBody.add(body, BorderLayout.CENTER);

    GridBagConstraints cons = new GridBagConstraints();
    cons.gridx = cons.gridy = 0;
    cons.gridwidth = GridBagConstraints.REMAINDER;
    cons.gridheight = 1;
    cons.anchor = DefaultLookup.getInt(optionPane, this,
                  "OptionPane.messageAnchor", GridBagConstraints.CENTER);
    cons.insets = new Insets(0,0,3,0);

    addMessageComponents(body, cons, getMessage(),
                      getMaxCharactersPerLineCount(), false);
    top.add(realBody, BorderLayout.CENTER);

    addIcon(top);
    return top;
}
 
private Border getNoFocusBorder() {
    Border border = DefaultLookup.getBorder(this, ui, "Table.cellNoFocusBorder");
    if (System.getSecurityManager() != null) {
        if (border != null) return border;
        return SAFE_NO_FOCUS_BORDER;
    } else if (border != null) {
        if (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER) {
            return border;
        }
    }
    return noFocusBorder;
}
 
源代码25 项目: dragonwell8_jdk   文件: BasicTextUI.java
/**
 * Get the InputMap to use for the UI.
 */
InputMap getInputMap() {
    InputMap map = new InputMapUIResource();

    InputMap shared =
        (InputMap)DefaultLookup.get(editor, this,
        getPropertyPrefix() + ".focusInputMap");
    if (shared != null) {
        map.setParent(shared);
    }
    return map;
}
 
源代码26 项目: openjdk-jdk9   文件: BasicComboBoxUI.java
/**
 * Paints the background of the currently selected item.
 *
 * @param g an instance of {@code Graphics}
 * @param bounds a bounding rectangle to render to
 * @param hasFocus is focused
 */
public void paintCurrentValueBackground(Graphics g,Rectangle bounds,boolean hasFocus) {
    Color t = g.getColor();
    if ( comboBox.isEnabled() )
        g.setColor(DefaultLookup.getColor(comboBox, this,
                                          "ComboBox.background", null));
    else
        g.setColor(DefaultLookup.getColor(comboBox, this,
                                 "ComboBox.disabledBackground", null));
    g.fillRect(bounds.x,bounds.y,bounds.width,bounds.height);
    g.setColor(t);
}
 
源代码27 项目: jdk8u-jdk   文件: BasicSplitPaneUI.java
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        return (InputMap)DefaultLookup.get(splitPane, this,
                                           "SplitPane.ancestorInputMap");
    }
    return null;
}
 
源代码28 项目: jdk8u-jdk   文件: BasicProgressBarUI.java
protected Dimension getPreferredInnerVertical() {
    Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this,
        "ProgressBar.verticalSize");
    if (vertDim == null) {
        vertDim = new Dimension(12, 146);
    }
    return vertDim;
}
 
源代码29 项目: TencentKona-8   文件: BasicSliderUI.java
public Dimension getMinimumVerticalSize() {
    Dimension minVertDim = (Dimension)DefaultLookup.get(slider,
            this, "Slider.minimumVerticalSize");
    if (minVertDim == null) {
        minVertDim = new Dimension(21, 36);
    }
    return minVertDim;
}
 
源代码30 项目: jdk8u-jdk   文件: BasicInternalFrameUI.java
InputMap createInputMap(int condition) {
    if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) {
        Object[] bindings = (Object[])DefaultLookup.get(
                frame, this, "InternalFrame.windowBindings");

        if (bindings != null) {
            return LookAndFeel.makeComponentInputMap(frame, bindings);
        }
    }
    return null;
}
 
 同类方法