微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.JSpinner.DefaultEditor的实例源码

项目:AgentWorkbench    文件TableCellSpinnerEditor4FloatObject.java   
@Override
public void keypressed(KeyEvent e) {
    if(e.getKeyCode() == KeyEvent.VK_ENTER || e.getKeyCode() == KeyEvent.VK_TAB){
        try {
            ((JSpinner)editorComponent).commitEdit();

        } catch (ParseException e1) {
            DefaultEditor de = (DefaultEditor) ((JSpinner)editorComponent).getEditor();
            String text = de.getTextField().getText();
            if(text.matches("^\\d+(\\.\\d*)?")){
                ((JSpinner)editorComponent).setValue(Float.parseFloat(text));
            }else{
                System.err.println("Invalid input - ignoring");
            }
        }
    }
    super.keypressed(e);
}
项目:marathonv5    文件JavaElementFactory.java   
public static void reset() {
    add(Component.class,JavaElement.class);
    add(JList.class,JListJavaElement.class);
    add(JTabbedPane.class,JTabbedPaneJavaElement.class);
    add(JComboBox.class,JComboBoxJavaElement.class);
    add(JTable.class,JTableJavaElement.class);
    add(jtableheader.class,jtableheaderJavaElement.class);
    add(JTree.class,JTreeJavaElement.class);
    add(JToggleButton.class,JToggleButtonJavaElement.class);
    add(JSpinner.class,JSpinnerJavaElement.class);
    add(JProgressBar.class,JProgressBarJavaElement.class);
    add(JSplitPane.class,JSplitPaneJavaElement.class);
    add(JTextComponent.class,JTextComponentJavaElement.class);
    add(EditorContainer.class,JTreeEditingContainerJavaElement.class);
    add(JEditorPane.class,JEditorPaneJavaElement.class);
    add(JMenuItem.class,JMenuItemJavaElement.class);
    add(JSlider.class,JSliderJavaElement.class);
    add(JSpinner.class,JSpinnerJavaElement.class);
    add(DefaultEditor.class,DefaultEditorJavaElement.class);
    add(JColorChooser.class,JColorChooserJavaElement.class);
    add(JFileChooser.class,JFileChooserJavaElement.class);
}
项目:marathonv5    文件RComponentFactory.java   
public static void reset() {
    entries.clear();
    add(Component.class,RUnkNownComponent.class);
    add(Window.class,RWindow.class);
    add(JTable.class,RTable.class);
    add(jtableheader.class,RTableHeader.class);
    add(AbstractButton.class,RAbstractButton.class);
    add(JToggleButton.class,RToggleButton.class);
    add(JComboBox.class,RComboBox.class);
    add(JTextComponent.class,RTextComponent.class);
    add(JTree.class,RTree.class);
    add(JList.class,RList.class);
    add(JTabbedPane.class,RTabbedPane.class);
    add(JMenuItem.class,RMenuItem.class);
    add(JSlider.class,RSlider.class);
    add(JProgressBar.class,RProgressBar.class);
    add(JSpinner.class,RSpinner.class);
    add(DefaultEditor.class,RDefaultEditor.class);
    add(JColorChooser.class,RColorChooser.class);
    add(JSplitPane.class,RSplitPane.class);
    add(BasicSplitPaneDivider.class,RSplitPane.class);
    add(JFileChooser.class,RFileChooser.class);
    add(JEditorPane.class,REditorPane.class);
    add(JLabel.class,RLabel.class);
    add(JScrollBar.class,RIgnoreComponent.class);
}
项目:Openjsharp    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,i);
        Object object = this.spinners[i].getLabel();
        if (object instanceof JRadioButton) {
            JRadioButton button = (JRadioButton) object;
            button.setText(text);
            button.getAccessibleContext().setAccessibleDescription(text);
        }
        else if (object instanceof JLabel) {
            JLabel label = (JLabel) object;
            label.setText(text);
        }
        this.spinners[i].setRange(this.model.getMinimum(i),this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:Openjsharp    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:jdk8u-jdk    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:jdk8u-jdk    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:openjdk-jdk10    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:openjdk-jdk10    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) {
        return;
    }

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(new FontUIResource(spinner.getFont()));
    }

    final jformattedtextfield editorTextField = ((DefaultEditor) editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(new FontUIResource(spinner.getFont()));
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:openjdk-jdk10    文件bug6421058.java   
private static void testDefaultFont(final JFrame frame) {
    frame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);

    JSpinner spinner = new JSpinner();
    frame.add(spinner);
    frame.setSize(300,100);
    frame.setVisible(true);

    final DefaultEditor editor = (DefaultEditor) spinner.getEditor();
    final Font editorFont = editor.getTextField().getFont();

    /*
     * Validate that the font of the text field is changed to the
     * font of JSpinner if the font of text field was not set by the
     * user.
     */

    if (!(editorFont instanceof UIResource)) {
        throw new RuntimeException("Font must be UIResource");
    }
    if (!editorFont.equals(spinner.getFont())) {
        throw new RuntimeException("Wrong FONT");
    }
}
项目:openjdk9    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:openjdk9    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) {
        return;
    }

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(new FontUIResource(spinner.getFont()));
    }

    final jformattedtextfield editorTextField = ((DefaultEditor) editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(new FontUIResource(spinner.getFont()));
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:openjdk9    文件bug6421058.java   
private static void testDefaultFont(final JFrame frame) {
    frame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);

    JSpinner spinner = new JSpinner();
    frame.add(spinner);
    frame.setSize(300,100);
    frame.setVisible(true);

    final DefaultEditor editor = (DefaultEditor) spinner.getEditor();
    final Font editorFont = editor.getTextField().getFont();

    /*
     * Validate that the font of the text field is changed to the
     * font of JSpinner if the font of text field was not set by the
     * user.
     */

    if (!(editorFont instanceof UIResource)) {
        throw new RuntimeException("Font must be UIResource");
    }
    if (!editorFont.equals(spinner.getFont())) {
        throw new RuntimeException("Wrong FONT");
    }
}
项目:Java8CN    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:jdk8u_jdk    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:jdk8u_jdk    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:littleluck    文件LuckSpinnerUI.java   
protected JComponent createEditor()
{
    JComponent editor = super.createEditor();

    // 设置文本框属性
    // set text frame info.
    if(editor instanceof DefaultEditor)
    {
        ((DefaultEditor)editor).getTextField().setBorder(null);

        ((DefaultEditor)editor).getTextField().setopaque(false);

        ((DefaultEditor)editor).setopaque(false);
    }

    return editor;
}
项目:lookaside_java-1.8.0-openjdk    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:AppWoksUtils    文件ExtSpinnerColumn.java   
/**
 * @param value
 * @param n
 * @param editor2
 * @return
 */
protected DefaultEditor getEditor(final E value,final Number n,final JSpinner editor2) {
    if (Clazz.isDouble(n.getClass())) {
        return this.getDoubleEditor();
    } else if (Clazz.isFloat(n.getClass())) {
        return this.getFloatEditor();
    } else if (Clazz.isLong(n.getClass())) {
        return this.getLongEditor();
    } else if (Clazz.isInteger(n.getClass())) {
        return this.getIntEditor();
    } else if (Clazz.isShort(n.getClass())) {
        return this.getShortEditor();
    } else if (Clazz.isByte(n.getClass())) {
        return this.getByteEditor();
    } else {
        return this.getLongEditor();
    }

}
项目:infobip-open-jdk-8    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:infobip-open-jdk-8    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:jdk8u-dev-jdk    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:jdk8u-dev-jdk    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:OLD-OpenJDK8    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:OLD-OpenJDK8    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:openjdk-jdk7u-jdk    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:openjdk-jdk7u-jdk    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:spring-rich-client    文件TextComponentInterceptor.java   
/**
 * Converts the given component to a <code>JTextComponent</code>. This can be a
 * simple cast if the component is already a text component,or an embedded component
 * (for example a JSpinner).
 * <p>
 * This method is protected,and can be overridden when necessary.
 * 
 * @param component the component
 * @return a <code>JTextComponent</code>,or <code>null</code>
 */
protected JTextComponent getTextComponent( JComponent component ) {
    if( component instanceof JTextField ) {
        return (JTextField) component;
    }

    if( component instanceof JSpinner ) {
        JSpinner spinner = (JSpinner) component;
        if( spinner.getEditor() instanceof JSpinner.DefaultEditor ) {
            return ((DefaultEditor) spinner.getEditor()).getTextField();
        }
        if( spinner.getEditor() instanceof JTextField ) {
            return (JTextField) spinner.getEditor();
        }
    }

    return null;
}
项目:openjdk-icedtea7    文件ColorPanel.java   
void buildPanel() {
    int count = this.model.getCount();
    this.spinners[4].setVisible(count > 4);
    for (int i = 0; i < count; i++) {
        String text = this.model.getLabel(this,this.model.getMaximum(i));
        this.spinners[i].setValue(this.values[i]);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleName(text);
        DefaultEditor editor = (DefaultEditor) this.spinners[i].getSpinner().getEditor();
        editor.getTextField().getAccessibleContext().setAccessibleName(text);
        this.spinners[i].getSlider().getAccessibleContext().setAccessibleDescription(text);
        this.spinners[i].getSpinner().getAccessibleContext().setAccessibleDescription(text);
        editor.getTextField().getAccessibleContext().setAccessibleDescription(text);
    }
}
项目:openjdk-icedtea7    文件AquaSpinnerUI.java   
protected void fixupEditor(final JComponent editor) {
    if (!(editor instanceof DefaultEditor)) return;

    editor.setopaque(false);
    editor.setInheritsPopupMenu(true);

    if (editor.getFont() instanceof UIResource) {
        editor.setFont(spinner.getFont());
    }

    final jformattedtextfield editorTextField = ((DefaultEditor)editor).getTextField();
    if (editorTextField.getFont() instanceof UIResource) {
        editorTextField.setFont(spinner.getFont());
    }
    final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    final InputMap editorInputMap = editorTextField.getInputMap();
    final Keystroke[] keys = spinnerInputMap.keys();
    for (final Keystroke k : keys) {
        editorInputMap.put(k,spinnerInputMap.get(k));
    }
}
项目:spring-richclient    文件TextComponentInterceptor.java   
/**
 * Converts the given component to a <code>JTextComponent</code>. This can be a
 * simple cast if the component is already a text component,or <code>null</code>
 */
protected JTextComponent getTextComponent( JComponent component ) {
    if( component instanceof JTextField ) {
        return (JTextField) component;
    }

    if( component instanceof JSpinner ) {
        JSpinner spinner = (JSpinner) component;
        if( spinner.getEditor() instanceof JSpinner.DefaultEditor ) {
            return ((DefaultEditor) spinner.getEditor()).getTextField();
        }
        if( spinner.getEditor() instanceof JTextField ) {
            return (JTextField) spinner.getEditor();
        }
    }

    return null;
}
项目:netbeans-plugin    文件GwtCompilerOptionsPanel.java   
@Override
public void run() {
    Project project = myLookup.lookup(Project.class);
    NbMavenProject mvnProject = project.getLookup().lookup(
            NbMavenProject.class);
    MavenProject mavenProject = mvnProject.getMavenProject();
    File file = mavenProject.getFile();
    FileObject pom = FileUtil
            .toFileObject(FileUtil.normalizefile(file));
    Utilities.performPOMModelOperations(pom,Collections.singletonList(this));

    myJvmArgs.setText(jvmArgs);
    myStyle.setSelectedItem(style);
    myLogLevel.setSelectedItem(logLevel);
    if (threads == -1) {
        ((DefaultEditor) myThreads.getEditor()).getTextField().setText(
                "");
    }
    else {
        myThreads.setValue(threads);
    }
    myDraft.setSelected(draft);
}
项目:Openjsharp    文件SlidingSpinner.java   
SlidingSpinner(ColorPanel panel,JComponent label) {
    this.panel = panel;
    this.label = label;
    this.slider.addchangelistener(this);
    this.spinner.addchangelistener(this);
    DefaultEditor editor = (DefaultEditor) this.spinner.getEditor();
    ValueFormatter.init(3,false,editor.getTextField());
    editor.setFocusable(false);
    this.spinner.setFocusable(false);
}
项目:Openjsharp    文件AquaSpinnerUI.java   
public void propertyChange(final PropertyChangeEvent e) {
    final String propertyName = e.getPropertyName();
    final JSpinner spinner = (JSpinner)(e.getSource());
    final SpinnerUI spinnerUI = spinner.getUI();

    if (spinnerUI instanceof AquaSpinnerUI) {
        final AquaSpinnerUI ui = (AquaSpinnerUI)spinnerUI;

        if ("editor".equals(propertyName)) {
            final JComponent oldEditor = (JComponent)e.getoldValue();
            final JComponent newEditor = (JComponent)e.getNewValue();
            ui.replaceEditor(oldEditor,newEditor);
            ui.updateEnabledState();
        } else if ("enabled".equals(propertyName)) {
            ui.updateEnabledState();
        } else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
            ui.updatetoolTipTextForChildren(spinner);
        } else if ("font".equals(propertyName)) {
            JComponent editor = spinner.getEditor();
            if (editor != null && editor instanceof JSpinner.DefaultEditor) {
                JTextField tf =
                        ((JSpinner.DefaultEditor) editor).getTextField();
                if (tf != null) {
                    if (tf.getFont() instanceof UIResource) {
                        tf.setFont(spinner.getFont());
                    }
                }
            }
        }
    }
}
项目:Openjsharp    文件AquaSpinnerUI.java   
void updatetoolTipTextForChildren(final JComponent spinnerComponent) {
    final String toolTipText = spinnerComponent.getToolTipText();
    final Component[] children = spinnerComponent.getComponents();
    for (final Component element : children) {
        if (element instanceof JSpinner.DefaultEditor) {
            final JTextField tf = ((JSpinner.DefaultEditor)element).getTextField();
            if (tf != null) {
                tf.setToolTipText(toolTipText);
            }
        } else if (element instanceof JComponent) {
            ((JComponent)element).setToolTipText(toolTipText);
        }
    }
}
项目:jdk8u-jdk    文件SlidingSpinner.java   
SlidingSpinner(ColorPanel panel,editor.getTextField());
    editor.setFocusable(false);
    this.spinner.setFocusable(false);
}
项目:jdk8u-jdk    文件AquaSpinnerUI.java   
public void propertyChange(final PropertyChangeEvent e) {
    final String propertyName = e.getPropertyName();
    final JSpinner spinner = (JSpinner)(e.getSource());
    final SpinnerUI spinnerUI = spinner.getUI();

    if (spinnerUI instanceof AquaSpinnerUI) {
        final AquaSpinnerUI ui = (AquaSpinnerUI)spinnerUI;

        if ("editor".equals(propertyName)) {
            final JComponent oldEditor = (JComponent)e.getoldValue();
            final JComponent newEditor = (JComponent)e.getNewValue();
            ui.replaceEditor(oldEditor,newEditor);
            ui.updateEnabledState();
        } else if ("enabled".equals(propertyName)) {
            ui.updateEnabledState();
        } else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
            ui.updatetoolTipTextForChildren(spinner);
        } else if ("font".equals(propertyName)) {
            JComponent editor = spinner.getEditor();
            if (editor != null && editor instanceof JSpinner.DefaultEditor) {
                JTextField tf =
                        ((JSpinner.DefaultEditor) editor).getTextField();
                if (tf != null) {
                    if (tf.getFont() instanceof UIResource) {
                        tf.setFont(spinner.getFont());
                    }
                }
            }
        }
    }
}
项目:jdk8u-jdk    文件AquaSpinnerUI.java   
void updatetoolTipTextForChildren(final JComponent spinnerComponent) {
    final String toolTipText = spinnerComponent.getToolTipText();
    final Component[] children = spinnerComponent.getComponents();
    for (final Component element : children) {
        if (element instanceof JSpinner.DefaultEditor) {
            final JTextField tf = ((JSpinner.DefaultEditor)element).getTextField();
            if (tf != null) {
                tf.setToolTipText(toolTipText);
            }
        } else if (element instanceof JComponent) {
            ((JComponent)element).setToolTipText(toolTipText);
        }
    }
}
项目:openjdk-jdk10    文件SlidingSpinner.java   
SlidingSpinner(ColorPanel panel,editor.getTextField());
    editor.setFocusable(false);
    this.spinner.setFocusable(false);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。