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


Java DefaultLookup类代码示例

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


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

示例1: getTableCellRendererComponent

import sun.swing.DefaultLookup; //导入依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
		boolean isSelected, boolean hasFocus, int row, int column) {
	Color fg = null;
	Color bg = null;
	JTable.DropLocation dropLocation = table.getDropLocation();
	if (dropLocation != null
			&& !dropLocation.isInsertRow()
			&& !dropLocation.isInsertColumn()
			&& dropLocation.getRow() == row
			&& dropLocation.getColumn() == column) {

		fg = DefaultLookup.getColor(this, ui, "Table.dropCellForeground");
		bg = DefaultLookup.getColor(this, ui, "Table.dropCellBackground");
		isSelected = true;
	}
	if (isSelected) {
		setBackground(DefaultLookup.getColor(this, ui, "Table.dropCellBackground"));
	} else {
		setBackground( DefaultLookup.getColor(this, ui, "Table.alternateRowColor"));
	}
	MapRule rule=(MapRule)value;
	update(rule,table,row);
	return this;
}
 
开发者ID:breakEval13,项目名称:NSS,代码行数:26,代码来源:MapRuleRender.java

示例2: paintComponent

import sun.swing.DefaultLookup; //导入依赖的package包/类
@Override
public void paintComponent(Graphics g) {
    boolean b = DefaultLookup.getBoolean(this, ui,
            "TableHeader.rightAlignSortArrow", false);
    if (b && sortArrow != null) {
        //emptyIcon is used so that if the text in the header is right
        //aligned, or if the column is too narrow, then the text will
        //be sized appropriately to make room for the icon that is about
        //to be painted manually here.
        emptyIcon.width = sortArrow.getIconWidth();
        emptyIcon.height = sortArrow.getIconHeight();
        setIcon(emptyIcon);
        super.paintComponent(g);
        Point position = computeIconPosition(g);
        sortArrow.paintIcon(this, g, position.x, position.y);
    } else {
        super.paintComponent(g);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:DefaultTableCellHeaderRenderer.java

示例3: getInputMap

import sun.swing.DefaultLookup; //导入依赖的package包/类
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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:BasicListUI.java

示例4: getInputMap

import sun.swing.DefaultLookup; //导入依赖的package包/类
InputMap getInputMap(int condition) {
    if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) {
        InputMap keyMap = (InputMap)DefaultLookup.get(scrollpane, this,
                                    "ScrollPane.ancestorInputMap");
        InputMap rtlKeyMap;

        if (scrollpane.getComponentOrientation().isLeftToRight() ||
                ((rtlKeyMap = (InputMap)DefaultLookup.get(scrollpane, this,
                "ScrollPane.ancestorInputMap.RightToLeft")) == null)) {
            return keyMap;
        } else {
            rtlKeyMap.setParent(keyMap);
            return rtlKeyMap;
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:BasicScrollPaneUI.java

示例5: createButtonArea

import sun.swing.DefaultLookup; //导入依赖的package包/类
/**
 * Creates and returns a Container containing the buttons. The buttons
 * are created by calling <code>getButtons</code>.
 */
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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:BasicOptionPaneUI.java

示例6: getIconForType

import sun.swing.DefaultLookup; //导入依赖的package包/类
/**
 * Returns the icon to use for the passed in type.
 *
 * @param messageType a type of message
 * @return 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:BasicOptionPaneUI.java

示例7: createButtonArea

import sun.swing.DefaultLookup; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:BasicOptionPaneUI.java

示例8: getInputMap

import sun.swing.DefaultLookup; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:BasicTableUI.java

示例9: installListeners

import sun.swing.DefaultLookup; //导入依赖的package包/类
/**
 * Initializes <code>PropertyChangeListener</code> with
 * a shared object that delegates interesting PropertyChangeEvents
 * to protected methods.
 * <p>
 * This method is called by <code>installUI</code>.
 *
 * @see #replaceEditor
 * @see #uninstallListeners
 */
protected void installListeners() {
    propertyChangeListener = createPropertyChangeListener();
    spinner.addPropertyChangeListener(propertyChangeListener);
    if (DefaultLookup.getBoolean(spinner, this,
        "Spinner.disableOnBoundaryValues", false)) {
        spinner.addChangeListener(getHandler());
    }
    JComponent editor = spinner.getEditor();
    if (editor != null && editor instanceof JSpinner.DefaultEditor) {
        JTextField tf = ((JSpinner.DefaultEditor)editor).getTextField();
        if (tf != null) {
            tf.addFocusListener(nextButtonHandler);
            tf.addFocusListener(previousButtonHandler);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:BasicSpinnerUI.java

示例10: getIconForType

import sun.swing.DefaultLookup; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:BasicOptionPaneUI.java

示例11: getTabLabelShiftY

import sun.swing.DefaultLookup; //导入依赖的package包/类
/**
 * Returns the tab label shift y.
 * @param tabPlacement the tab placement
 * @param tabIndex the tab index
 * @param isSelected selection status
 * @return the tab label shift y
 */
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) {
    Rectangle tabRect = rects[tabIndex];
    int nudge = (isSelected ? DefaultLookup.getInt(tabPane, this, "TabbedPane.selectedLabelShift", -1) :
            DefaultLookup.getInt(tabPane, this, "TabbedPane.labelShift", 1));

    switch (tabPlacement) {
        case BOTTOM:
            return -nudge;
        case LEFT:
        case RIGHT:
            return tabRect.height % 2;
        case TOP:
        default:
            return nudge;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:BasicTabbedPaneUI.java

示例12: focusGained

import sun.swing.DefaultLookup; //导入依赖的package包/类
public void focusGained(FocusEvent e) {
    AbstractButton b = (AbstractButton) e.getSource();
    if (b instanceof JButton && ((JButton)b).isDefaultCapable()) {
        JRootPane root = b.getRootPane();
        if (root != null) {
           BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType(
                     b.getUI(), BasicButtonUI.class);
           if (ui != null && DefaultLookup.getBoolean(b, ui,
                               ui.getPropertyPrefix() +
                               "defaultButtonFollowsFocus", true)) {
               root.putClientProperty("temporaryDefaultButton", b);
               root.setDefaultButton((JButton)b);
               root.putClientProperty("temporaryDefaultButton", null);
           }
        }
    }
    b.repaint();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:BasicButtonListener.java

示例13: focusLost

import sun.swing.DefaultLookup; //导入依赖的package包/类
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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:BasicButtonListener.java

示例14: updateDefaultButtonBindings

import sun.swing.DefaultLookup; //导入依赖的package包/类
/**
 * 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);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:BasicRootPaneUI.java

示例15: getInputMap

import sun.swing.DefaultLookup; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:BasicTreeUI.java


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