Java Code Examples for sun.swing.DefaultLookup#get()

The following examples show how to use sun.swing.DefaultLookup#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicTableUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        InputMap keyMap =
            (InputMap)DefaultLookup.get(table, this,
                                        "Table.ancestorInputMap");
        InputMap rtlKeyMap;

        if (table.getComponentOrientation().isLeftToRight() ||
            ((rtlKeyMap = (InputMap)DefaultLookup.get(table, this,
                                        "Table.ancestorInputMap.RightToLeft")) == null)) {
            return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
Example 2
Source File: BasicOptionPaneUI.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: BasicListUI.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: BasicRootPaneUI.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 5
Source File: BasicRootPaneUI.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example 6
Source File: BasicProgressBarUI.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected Dimension getPreferredInnerVertical() {
    Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this,
        "ProgressBar.verticalSize");
    if (vertDim == null) {
        vertDim = new Dimension(12, 146);
    }
    return vertDim;
}
 
Example 7
Source File: BasicSpinnerUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the InputMap to install for <code>condition</code>.
 */
private InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        return (InputMap)DefaultLookup.get(spinner, this,
                "Spinner.ancestorInputMap");
    }
    return null;
}
 
Example 8
Source File: BasicSliderUI.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Dimension getMinimumHorizontalSize() {
    Dimension minHorizDim = (Dimension)DefaultLookup.get(slider,
            this, "Slider.minimumHorizontalSize");
    if (minHorizDim == null) {
        minHorizDim = new Dimension(36, 21);
    }
    return minHorizDim;
}
 
Example 9
Source File: BasicProgressBarUI.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
protected Dimension getPreferredInnerVertical() {
    Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this,
        "ProgressBar.verticalSize");
    if (vertDim == null) {
        vertDim = new Dimension(12, 146);
    }
    return vertDim;
}
 
Example 10
Source File: BasicSliderUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Dimension getPreferredHorizontalSize() {
    Dimension horizDim = (Dimension)DefaultLookup.get(slider,
            this, "Slider.horizontalSize");
    if (horizDim == null) {
        horizDim = new Dimension(200, 21);
    }
    return horizDim;
}
 
Example 11
Source File: BasicTextUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 12
Source File: BasicComboBoxUI.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        return (InputMap)DefaultLookup.get(comboBox, this,
                                           "ComboBox.ancestorInputMap");
    }
    return null;
}
 
Example 13
Source File: BasicSliderUI.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public Dimension getMinimumHorizontalSize() {
    Dimension minHorizDim = (Dimension)DefaultLookup.get(slider,
            this, "Slider.minimumHorizontalSize");
    if (minHorizDim == null) {
        minHorizDim = new Dimension(36, 21);
    }
    return minHorizDim;
}
 
Example 14
Source File: BasicSplitPaneUI.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        return (InputMap)DefaultLookup.get(splitPane, this,
                                           "SplitPane.ancestorInputMap");
    }
    return null;
}
 
Example 15
Source File: BasicTextUI.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 16
Source File: BasicToolBarUI.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        return (InputMap)DefaultLookup.get(toolBar, this,
                "ToolBar.ancestorInputMap");
    }
    return null;
}
 
Example 17
Source File: BasicSliderUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Dimension getMinimumHorizontalSize() {
    Dimension minHorizDim = (Dimension)DefaultLookup.get(slider,
            this, "Slider.minimumHorizontalSize");
    if (minHorizDim == null) {
        minHorizDim = new Dimension(36, 21);
    }
    return minHorizDim;
}
 
Example 18
Source File: BasicOptionPaneUI.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Configures any necessary colors/fonts for the specified label
 * used representing the message.
 */
private void configureMessageLabel(JLabel label) {
    Color color = (Color)DefaultLookup.get(optionPane, this,
                                           "OptionPane.messageForeground");
    if (color != null) {
        label.setForeground(color);
    }
    Font messageFont = (Font)DefaultLookup.get(optionPane, this,
                                               "OptionPane.messageFont");
    if (messageFont != null) {
        label.setFont(messageFont);
    }
}
 
Example 19
Source File: BasicInternalFrameTitlePane.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 20
Source File: BasicTextUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates the keymap to use for the text component, and installs
 * any necessary bindings into it.  By default, the keymap is
 * shared between all instances of this type of TextUI. The
 * keymap has the name defined by the getKeymapName method.  If the
 * keymap is not found, then DEFAULT_KEYMAP from JTextComponent is used.
 * <p>
 * The set of bindings used to create the keymap is fetched
 * from the UIManager using a key formed by combining the
 * {@link #getPropertyPrefix} method
 * and the string <code>.keyBindings</code>.  The type is expected
 * to be <code>JTextComponent.KeyBinding[]</code>.
 *
 * @return the keymap
 * @see #getKeymapName
 * @see javax.swing.text.JTextComponent
 */
protected Keymap createKeymap() {
    String nm = getKeymapName();
    Keymap map = JTextComponent.getKeymap(nm);
    if (map == null) {
        Keymap parent = JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP);
        map = JTextComponent.addKeymap(nm, parent);
        String prefix = getPropertyPrefix();
        Object o = DefaultLookup.get(editor, this,
            prefix + ".keyBindings");
        if ((o != null) && (o instanceof JTextComponent.KeyBinding[])) {
            JTextComponent.KeyBinding[] bindings = (JTextComponent.KeyBinding[]) o;
            JTextComponent.loadKeymap(map, bindings, getComponent().getActions());
        }
    }
    return map;
}