本文整理了Java中javax.swing.JSpinner.commitEdit()
方法的一些代码示例,展示了JSpinner.commitEdit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSpinner.commitEdit()
方法的具体详情如下:
包路径:javax.swing.JSpinner
类名称:JSpinner
方法名:commitEdit
暂无
代码示例来源:origin: magefree/mage
@Override
public boolean stopCellEditing() {
try {
editor.commitEdit();
spinner.commitEdit();
resetRow();
} catch (java.text.ParseException e) {
JOptionPane.showMessageDialog(null,
"Invalid value, discarding.");
}
return super.stopCellEditing();
}
}
代码示例来源:origin: stackoverflow.com
try {
editor.commitEdit();
spinner.commitEdit();
} catch ( java.text.ParseException e ) {
JOptionPane.showMessageDialog(null,
代码示例来源:origin: gurkenlabs/litiengine
public float getStrokeWidth() {
try {
this.strokeSpinner.commitEdit();
} catch (ParseException e) {
log.log(Level.WARNING, "Your edits in the grid line thickness spinner could not be parsed as Float.");
}
return (Float) this.strokeSpinner.getValue();
}
代码示例来源:origin: gurkenlabs/litiengine
public Dimension getGridSize() {
try {
this.widthSpinner.commitEdit();
this.heightSpinner.commitEdit();
} catch (ParseException e) {
log.log(Level.WARNING, "\"One of your edits in the grid size spinners could not be parsed as Integer.");
}
return new Dimension((Integer) this.widthSpinner.getValue(), (Integer) this.heightSpinner.getValue());
}
}
代码示例来源:origin: Audiveris/audiveris
/** This is needed to read data manually typed in spinners fields. */
private void commitSpinners ()
{
try {
switch (readKind()) {
case GLOBAL:
globalData.spinner.commitEdit();
break;
case ADAPTIVE:
localDataMean.spinner.commitEdit();
localDataDev.spinner.commitEdit();
break;
default:
}
} catch (ParseException ignored) {
}
}
代码示例来源:origin: mucommander/mucommander
@Override
public void dialogValidated() {
// Commits the current spinner value in case it was being edited and 'enter' was pressed
// (the spinner value would otherwise not be committed)
try { portSpinner.commitEdit(); }
catch(ParseException e) { }
updateValues();
}
}
代码示例来源:origin: mucommander/mucommander
@Override
public void dialogValidated() {
// Commits the current spinner value in case it was being edited and 'enter' was pressed
// (the spinner value would otherwise not be committed)
try { portSpinner.commitEdit(); }
catch(ParseException e) { }
updateValues();
}
代码示例来源:origin: mucommander/mucommander
@Override
public void dialogValidated() {
// Commits the current spinner value in case it was being edited and 'enter' was pressed
// (the spinner value would otherwise not be committed)
try { portSpinner.commitEdit(); }
catch(ParseException e) { }
updateValues();
}
}
代码示例来源:origin: mucommander/mucommander
@Override
public void dialogValidated() {
// Commits the current spinner value in case it was being edited and 'enter' was pressed
// (the spinner value would otherwise not be committed)
try { portSpinner.commitEdit(); }
catch(ParseException e) { }
updateValues();
}
}
代码示例来源:origin: mucommander/mucommander
@Override
public void dialogValidated() {
// Commits the current spinner value in case it was being edited and 'enter' was pressed
// (the spinner value would otherwise not be committed)
try { portSpinner.commitEdit(); }
catch(ParseException e) { }
updateValues();
}
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Commits the currently edited values. If commit fails, focus will be set on the offending
* field.
*
* @throws ParseException If at least one of currently edited value couldn't be commited.
*/
public void commitEdit() throws ParseException {
JSpinner focus=null;
try {
(focus=tmin).commitEdit();
(focus=tmax).commitEdit();
(focus=xmin).commitEdit();
(focus=xmax).commitEdit();
(focus=ymin).commitEdit();
(focus=ymax).commitEdit();
(focus=xres).commitEdit();
(focus=yres).commitEdit();
checkAngle(focus=xmin, false);
checkAngle(focus=xmax, false);
checkAngle(focus=ymin, true);
checkAngle(focus=ymax, true);
} catch (ParseException exception) {
focus.requestFocus();
throw exception;
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@Override
public void commitEdit() throws ParseException {
try {
super.commitEdit();
} catch (ParseException ex) {
if ("".equals(getText())) {
model.setValue(null);
}
}
}
代码示例来源:origin: MegaMek/mekhq
@Override
public boolean stopCellEditing() {
System.err.println("Stopping edit");
try {
editor.commitEdit();
spinner.commitEdit();
} catch (java.text.ParseException e) {
JOptionPane.showMessageDialog(null,
"Invalid value, discarding.");
}
return super.stopCellEditing();
}
}
代码示例来源:origin: tinyMediaManager/tinyMediaManager
@Override
public boolean stopCellEditing() {
try {
editor.commitEdit();
spinner.commitEdit();
}
catch (java.text.ParseException e) {
JOptionPane.showMessageDialog(null, "Invalid value, discarding.");
}
return super.stopCellEditing();
}
}
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInEDT
private static void commit(final @Nonnull JSpinner spinner) {
execute(() -> spinner.commitEdit());
}
代码示例来源:origin: gurkenlabs/litiengine
@Override
public boolean stopCellEditing() {
try {
editor.commitEdit();
spinner.commitEdit();
} catch (java.text.ParseException e) {
JOptionPane.showMessageDialog(null, "Invalid value, discarding.");
}
return super.stopCellEditing();
}
}
代码示例来源:origin: lycying/c2d-engine
@Override
public void valueChanged(ListSelectionEvent e) {
// make sure the user is done adjusting
if (!e.getValueIsAdjusting()) {
JList list = (JList) e.getSource();
int[] selections = list.getSelectedIndices();
short value = 0;
for (int i = 0; i < selections.length; i++) {
value |= CATEGORIES[selections[i]].value;
}
spinnerMaskBits.setValue(value);
try {
spinnerMaskBits.commitEdit();
} catch (Exception ex) {
}
}
}
});
代码示例来源:origin: lycying/c2d-engine
@Override
public void valueChanged(ListSelectionEvent e) {
// make sure the user is done adjusting
if (!e.getValueIsAdjusting()) {
JList list = (JList) e.getSource();
int[] selections = list.getSelectedIndices();
short value = 0;
for (int i = 0; i < selections.length; i++) {
value |= CATEGORIES[selections[i]].value;
}
spinnerCategoryBits.setValue(value);
try {
spinnerCategoryBits.commitEdit();
} catch (Exception ex) {
}
}
}
});
代码示例来源:origin: RPTools/maptool
/**
* Read an integer value from a spinner.
*
* @param name
* Name of the spinner.
* @param displayName
* Name used in the message if there is an error.
* @param formPanel
* The form panel containing the component.
* @return The integer value selected.
*/
public static int getSpinner(String name, String displayName, FormPanel formPanel) {
int width = 0;
JSpinner spinner = formPanel.getSpinner(name);
try {
spinner.commitEdit();
width = ((Integer) spinner.getValue()).intValue();
} catch (ParseException e) {
JOptionPane.showMessageDialog(spinner, "There is an invalid " + displayName + " specified: " + ((JTextField) spinner.getEditor()).getText(),
"Error!", JOptionPane.ERROR_MESSAGE);
throw new IllegalStateException(e);
} // endtry
return width;
}
代码示例来源:origin: org.geotools/gt2-widgets-swing
/**
* Updates the time zone in text fields. This method is automatically invoked
* by {@link JComboBox} on user's selection. It is also (indirectly) invoked
* on {@link #setTimeZone} call.
*/
private void update(final TimeZone timezone) {
boolean refresh=true;
try {
tmin.commitEdit();
tmax.commitEdit();
} catch (ParseException exception) {
refresh = false;
}
((JSpinner.DateEditor)tmin.getEditor()).getFormat().setTimeZone(timezone);
((JSpinner.DateEditor)tmax.getEditor()).getFormat().setTimeZone(timezone);
if (refresh) {
// TODO: If a "JSpinner.reformat()" method was available, we would use it here.
fireStateChanged((AbstractSpinnerModel)tmin.getModel());
fireStateChanged((AbstractSpinnerModel)tmax.getModel());
}
}
内容来源于网络,如有侵权,请联系作者删除!