Java 类javax.swing.JSpinner.ListEditor 实例源码

项目:cn1    文件:JSpinnerTest.java   
public void testCreateEditor() {
    SpinnerModel model = new SpinnerNumberModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.NumberEditor);
    model = new SpinnerDateModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.DateEditor);
    model = new SpinnerListModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.ListEditor);
    assertTrue(spinner.createEditor(abstractModel) instanceof JSpinner.DefaultEditor);
}
项目:cn1    文件:JSpinnerTest.java   
public void testListEditor_ListEditor() {
    Object[] values = { "arrline1", "arrline2", "text", new Integer(33), spinner };
    spinner.setModel(new SpinnerListModel(values));
    ListEditor listEditor = new ListEditor(spinner);
    spinner.setEditor(listEditor);
    assertTrue(listEditor.getTextField().isEditable());
    spinner.setModel(abstractModel);
    testExceptionalCase(new IllegalArgumentCase() {
        @Override
        public void exceptionalAction() throws Exception {
            new JSpinner.ListEditor(spinner);
        }
    });
}
项目:cn1    文件:JSpinnerTest.java   
public void testListEditor_formatter() throws Exception {
    JComponent comp = new JButton();
    Object[] values = { "arrline1", "arrline2", "text", new Integer(33), comp };
    spinner.setModel(new SpinnerListModel(values));
    ListEditor listEditor = new ListEditor(spinner);
    spinner.setEditor(listEditor);
    AbstractFormatter formatter = ((ListEditor) spinner.getEditor()).getTextField()
            .getFormatter();
    assertEquals(formatter.valueToString(null), "");
    assertEquals(formatter.valueToString(new Integer(33)), "33");
    assertEquals(formatter.stringToValue("text"), "text");
}
项目:freeVM    文件:JSpinnerTest.java   
public void testCreateEditor() {
    SpinnerModel model = new SpinnerNumberModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.NumberEditor);
    model = new SpinnerDateModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.DateEditor);
    model = new SpinnerListModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.ListEditor);
    assertTrue(spinner.createEditor(abstractModel) instanceof JSpinner.DefaultEditor);
}
项目:freeVM    文件:JSpinnerTest.java   
public void testListEditor_ListEditor() {
    Object[] values = { "arrline1", "arrline2", "text", new Integer(33), spinner };
    spinner.setModel(new SpinnerListModel(values));
    ListEditor listEditor = new ListEditor(spinner);
    spinner.setEditor(listEditor);
    assertTrue(listEditor.getTextField().isEditable());
    spinner.setModel(abstractModel);
    testExceptionalCase(new IllegalArgumentCase() {
        @Override
        public void exceptionalAction() throws Exception {
            new JSpinner.ListEditor(spinner);
        }
    });
}
项目:freeVM    文件:JSpinnerTest.java   
public void testListEditor_formatter() throws Exception {
    JComponent comp = new JButton();
    Object[] values = { "arrline1", "arrline2", "text", new Integer(33), comp };
    spinner.setModel(new SpinnerListModel(values));
    ListEditor listEditor = new ListEditor(spinner);
    spinner.setEditor(listEditor);
    AbstractFormatter formatter = ((ListEditor) spinner.getEditor()).getTextField()
            .getFormatter();
    assertEquals(formatter.valueToString(null), "");
    assertEquals(formatter.valueToString(new Integer(33)), "33");
    assertEquals(formatter.stringToValue("text"), "text");
}
项目:freeVM    文件:JSpinnerTest.java   
public void testCreateEditor() {
    SpinnerModel model = new SpinnerNumberModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.NumberEditor);
    model = new SpinnerDateModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.DateEditor);
    model = new SpinnerListModel();
    spinner.setModel(model);
    assertTrue(spinner.createEditor(model) instanceof JSpinner.ListEditor);
    assertTrue(spinner.createEditor(abstractModel) instanceof JSpinner.DefaultEditor);
}
项目:freeVM    文件:JSpinnerTest.java   
public void testListEditor_ListEditor() {
    Object[] values = { "arrline1", "arrline2", "text", new Integer(33), spinner };
    spinner.setModel(new SpinnerListModel(values));
    ListEditor listEditor = new ListEditor(spinner);
    spinner.setEditor(listEditor);
    assertTrue(listEditor.getTextField().isEditable());
    spinner.setModel(abstractModel);
    testExceptionalCase(new IllegalArgumentCase() {
        @Override
        public void exceptionalAction() throws Exception {
            new JSpinner.ListEditor(spinner);
        }
    });
}
项目:freeVM    文件:JSpinnerTest.java   
public void testListEditor_formatter() throws Exception {
    JComponent comp = new JButton();
    Object[] values = { "arrline1", "arrline2", "text", new Integer(33), comp };
    spinner.setModel(new SpinnerListModel(values));
    ListEditor listEditor = new ListEditor(spinner);
    spinner.setEditor(listEditor);
    AbstractFormatter formatter = ((ListEditor) spinner.getEditor()).getTextField()
            .getFormatter();
    assertEquals(formatter.valueToString(null), "");
    assertEquals(formatter.valueToString(new Integer(33)), "33");
    assertEquals(formatter.stringToValue("text"), "text");
}