sun.swing.DefaultLookup Java Examples
The following examples show how to use
sun.swing.DefaultLookup.
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: BasicSliderUI.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
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; }
Example #2
Source File: BasicTextUI.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
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()); } }
Example #3
Source File: BasicSplitPaneDivider.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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")); }
Example #4
Source File: BasicListUI.java From JDKSourceCode1.8 with MIT License | 6 votes |
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 #5
Source File: BasicSliderUI.java From Bytecoder with Apache License 2.0 | 6 votes |
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; }
Example #6
Source File: BasicListUI.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
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 #7
Source File: BasicRootPaneUI.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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 #8
Source File: BasicTreeUI.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; }
Example #9
Source File: BasicOptionPaneUI.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example #10
Source File: BasicSplitPaneDivider.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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")); }
Example #11
Source File: BasicRootPaneUI.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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 #12
Source File: BasicButtonListener.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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(); }
Example #13
Source File: BasicButtonListener.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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(); }
Example #14
Source File: BasicListUI.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 #15
Source File: BasicOptionPaneUI.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * 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 #16
Source File: BasicTabbedPaneUI.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; } }
Example #17
Source File: BasicOptionPaneUI.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #18
Source File: BasicSliderUI.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public Dimension getPreferredVerticalSize() { Dimension vertDim = (Dimension)DefaultLookup.get(slider, this, "Slider.verticalSize"); if (vertDim == null) { vertDim = new Dimension(21, 200); } return vertDim; }
Example #19
Source File: BasicOptionPaneUI.java From JDKSourceCode1.8 with MIT License | 5 votes |
InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) { Object[] bindings = (Object[])DefaultLookup.get( optionPane, this, "OptionPane.windowBindings"); if (bindings != null) { return LookAndFeel.makeComponentInputMap(optionPane, bindings); } } return null; }
Example #20
Source File: BasicSplitPaneUI.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) { return (InputMap)DefaultLookup.get(splitPane, this, "SplitPane.ancestorInputMap"); } return null; }
Example #21
Source File: BasicProgressBarUI.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected Dimension getPreferredInnerVertical() { Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.verticalSize"); if (vertDim == null) { vertDim = new Dimension(12, 146); } return vertDim; }
Example #22
Source File: BasicOptionPaneUI.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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); } }
Example #23
Source File: BasicSpinnerUI.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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(); } } }
Example #24
Source File: BasicButtonListener.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the InputMap for condition <code>condition</code>. Called as * part of <code>installKeyboardActions</code>. */ InputMap getInputMap(int condition, JComponent c) { if (condition == JComponent.WHEN_FOCUSED) { BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType( ((AbstractButton)c).getUI(), BasicButtonUI.class); if (ui != null) { return (InputMap)DefaultLookup.get( c, ui, ui.getPropertyPrefix() + "focusInputMap"); } } return null; }
Example #25
Source File: BasicListUI.java From hottub with GNU General Public License v2.0 | 5 votes |
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); } }
Example #26
Source File: BasicProgressBarUI.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected Dimension getPreferredInnerVertical() { Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.verticalSize"); if (vertDim == null) { vertDim = new Dimension(12, 146); } return vertDim; }
Example #27
Source File: DefaultListCellRenderer.java From Bytecoder with Apache License 2.0 | 5 votes |
private Border getNoFocusBorder() { Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder"); if (System.getSecurityManager() != null) { if (border != null) return border; return SAFE_NO_FOCUS_BORDER; } else { if (border != null && (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) { return border; } return noFocusBorder; } }
Example #28
Source File: BasicSplitPaneUI.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) { return (InputMap)DefaultLookup.get(splitPane, this, "SplitPane.ancestorInputMap"); } return null; }
Example #29
Source File: BasicOptionPaneUI.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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 #30
Source File: BasicRootPaneUI.java From hottub with GNU General Public License v2.0 | 5 votes |
InputMap getInputMap(int condition, JComponent c) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) { return (InputMap)DefaultLookup.get(c, this, "RootPane.ancestorInputMap"); } if (condition == JComponent.WHEN_IN_FOCUSED_WINDOW) { return createInputMap(condition, c); } return null; }