本文整理匯總了Java中org.jdesktop.swingx.JXTable.setSurrendersFocusOnKeystroke方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.setSurrendersFocusOnKeystroke方法的具體用法?Java JXTable.setSurrendersFocusOnKeystroke怎麽用?Java JXTable.setSurrendersFocusOnKeystroke使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdesktop.swingx.JXTable
的用法示例。
在下文中一共展示了JXTable.setSurrendersFocusOnKeystroke方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: interactiveStrictNumberEditorAllTypesAsNumber
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue ??-swingx: localized NumberEditor using strict.
* Default for JXTable.
*
* Here: all column classes are Number.
*
*/
public void interactiveStrictNumberEditorAllTypesAsNumber() {
@SuppressWarnings("unused")
final Class<?>[] classes = new Class[] {Byte.class, Short.class, Integer.class,
Float.class, Double.class, BigInteger.class, BigDecimal.class, Number.class};
DefaultTableModel model = new DefaultTableModel(new String[] {
"Byte", "Short", "Integer", "Float", "Double", "BigInteger",
"BigDecimal", "Number"}, 10) {
@Override
public Class<?> getColumnClass(int columnIndex) {
return Number.class;
}
};
// positive/max
model.setValueAt(Byte.MAX_VALUE, 0, 0);
model.setValueAt(Short.MAX_VALUE, 0, 1);
model.setValueAt(Integer.MAX_VALUE, 0, 2);
model.setValueAt(Float.MAX_VALUE, 0, 3);
model.setValueAt(Double.MAX_VALUE, 0, 4);
model.setValueAt(new BigInteger(TOO_BIG_INTEGER), 0, 5);
model.setValueAt(new BigDecimal("44444444444444.666666666666666666"), 0, 6);
// negative/min
model.setValueAt(Byte.MIN_VALUE, 1, 0);
model.setValueAt(Short.MIN_VALUE, 1, 1);
model.setValueAt(Integer.MIN_VALUE, 1, 2);
model.setValueAt(-Float.MAX_VALUE, 1, 3);
model.setValueAt(-Double.MAX_VALUE, 1, 4);
// model.setValueAt(new BigInteger(TOO_BIG_INTEGER), 1, 5);
model.setValueAt(new BigDecimal("-44444444444444.666666666666666666"), 1, 6);
final JXTable table = new JXTable(model);
table.setSurrendersFocusOnKeystroke(true);
JXFrame frame = showWithScrollingInFrame(table, "Extended NumberEditors: number class");
addStatusMessage(frame, "number class: no error, commit any number");
}
示例2: interactiveNonStrictNumberEditorAllTypes
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue ??-swingx: localized NumberEditor not using strict.
*
* Column class is concrete type.
*
*/
public void interactiveNonStrictNumberEditorAllTypes() {
final Class<?>[] classes = new Class[] {Byte.class, Short.class, Integer.class,
Float.class, Double.class, BigInteger.class, BigDecimal.class, Number.class};
DefaultTableModel model = new DefaultTableModel(new String[] {
"Byte", "Short", "Integer", "Float", "Double", "BigInteger",
"BigDecimal", "Number"}, 10) {
@Override
public Class<?> getColumnClass(int columnIndex) {
return classes[columnIndex];
}
};
model.setValueAt(Byte.MAX_VALUE, 0, 0);
model.setValueAt(Short.MAX_VALUE, 0, 1);
model.setValueAt(Integer.MAX_VALUE, 0, 2);
model.setValueAt(Float.MAX_VALUE, 0, 3);
model.setValueAt(Double.MAX_VALUE, 0, 4);
model.setValueAt(new BigInteger(TOO_BIG_INTEGER), 0, 5);
model.setValueAt(new BigDecimal("44444444444444.666666666666666666"), 0, 6);
// negative/min
model.setValueAt(Byte.MIN_VALUE, 1, 0);
model.setValueAt(Short.MIN_VALUE, 1, 1);
model.setValueAt(Integer.MIN_VALUE, 1, 2);
model.setValueAt(-Float.MAX_VALUE, 1, 3);
model.setValueAt(-Double.MAX_VALUE, 1, 4);
// model.setValueAt(new BigInteger(TOO_BIG_INTEGER), 1, 5);
model.setValueAt(new BigDecimal("-44444444444444.666666666666666666"), 1, 6);
final JXTable table = new JXTable(model);
table.setSurrendersFocusOnKeystroke(true);
NumberEditorExt strictEditor = new NumberEditorExt(false);
table.setDefaultEditor(Number.class, strictEditor);
JXFrame frame = showWithScrollingInFrame(table, "Extended NumberEditors(non-strict): concrete Number classes");
addStatusMessage(frame, "concrete number classes and non-strict formatter: error not shown, fails on commit");
}
示例3: interactiveStrictNumberEditorAllTypes
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue ??-swingx: localized NumberEditor using strict.
*
* Column class is concrete type.
*
*/
public void interactiveStrictNumberEditorAllTypes() {
final Class<?>[] classes = new Class[] {Byte.class, Short.class, Integer.class,
Float.class, Double.class, BigInteger.class, BigDecimal.class, Number.class};
DefaultTableModel model = new DefaultTableModel(new String[] {
"Byte", "Short", "Integer", "Float", "Double", "BigInteger",
"BigDecimal", "Number"}, 10) {
@Override
public Class<?> getColumnClass(int columnIndex) {
return classes[columnIndex];
}
};
model.setValueAt(Byte.MAX_VALUE, 0, 0);
model.setValueAt(Short.MAX_VALUE, 0, 1);
model.setValueAt(Integer.MAX_VALUE, 0, 2);
model.setValueAt(Float.MAX_VALUE, 0, 3);
model.setValueAt(Double.MAX_VALUE, 0, 4);
model.setValueAt(new BigInteger(TOO_BIG_INTEGER), 0, 5);
model.setValueAt(new BigDecimal("44444444444444.666666666666666666"), 0, 6);
// negative/min
model.setValueAt(Byte.MIN_VALUE, 1, 0);
model.setValueAt(Short.MIN_VALUE, 1, 1);
model.setValueAt(Integer.MIN_VALUE, 1, 2);
model.setValueAt(-Float.MAX_VALUE, 1, 3);
model.setValueAt(-Double.MAX_VALUE, 1, 4);
// model.setValueAt(new BigInteger(TOO_BIG_INTEGER), 1, 5);
model.setValueAt(new BigDecimal("-44444444444444.666666666666666666"), 1, 6);
final JXTable table = new JXTable(model);
table.setSurrendersFocusOnKeystroke(true);
JXFrame frame = showWithScrollingInFrame(table, "Extended NumberEditors(strict): concrete Number classes");
addStatusMessage(frame, "concrete number classes and strict formatter: error shown on typing");
}
示例4: interactiveNumberEditor
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue #393-swingx: localized NumberEditor.
*
* Column type is Number, editors as noted in header text
*
*
*/
public void interactiveNumberEditor() {
final int doubleColumns = 3;
final int integerColumns = 6;
DefaultTableModel model = new DefaultTableModel(new String[] {
"Double-core", "Double-extstrict", "Double-extnonstrict",
"Integer-core", "Integer-extstrict", "Integer-extnonstrict",
"Object" }, 10) {
@Override
public Class<?> getColumnClass(int columnIndex) {
return Number.class;
}
};
final JXTable table = new JXTable(model);
table.setSurrendersFocusOnKeystroke(true);
for (int i = 0; i < table.getColumnCount(); i++) {
if (i < doubleColumns) {
table.setValueAt(Double.MAX_VALUE-1, 0, i);
} else {
table.setValueAt(Integer.MAX_VALUE-1, 0, i);
}
}
NumberEditor numberEditor = new NumberEditor();
table.getColumn(0).setCellEditor(numberEditor);
table.getColumn(doubleColumns).setCellEditor(numberEditor);
NumberEditorExt nonStrictEditor = new NumberEditorExt(false);
table.getColumn(doubleColumns -1).setCellEditor(nonStrictEditor);
table.getColumn(integerColumns -1).setCellEditor(nonStrictEditor);
JXFrame frame = showWithScrollingInFrame(table, "Extended NumberEditors: Number.class");
addStatusMessage(frame, "number-class: has no constructor with string, core/nonstrict can't handle");
}
示例5: interactiveFloatingPointEditor
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue #393-swingx: localized NumberEditor.
*
* Column type is Number, editors as noted in header text
*
*
*/
public void interactiveFloatingPointEditor() {
final int doubleColumns = 3;
final int integerColumns = 6;
DefaultTableModel model = new DefaultTableModel(new String[] {
"Double-core", "Double-extstrict", "Double-extnonstrict",
"Integer-core", "Integer-extstrict", "Integer-extnonstrict",
"Object" }, 10) {
@Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex < doubleColumns) {
return Double.class;
}
if (columnIndex < integerColumns) {
return Integer.class;
}
return Object.class;
}
};
final JXTable table = new JXTable(model);
table.setSurrendersFocusOnKeystroke(true);
for (int i = 0; i < table.getColumnCount(); i++) {
if (i < doubleColumns) {
table.setValueAt(Double.MAX_VALUE, 0, i);
} else {
table.setValueAt(Integer.MAX_VALUE, 0, i);
}
}
NumberEditor numberEditor = new NumberEditor();
table.getColumn(0).setCellEditor(numberEditor);
table.getColumn(doubleColumns).setCellEditor(numberEditor);
NumberEditorExt nonStrictEditor = new NumberEditorExt(false);
table.getColumn(doubleColumns -1).setCellEditor(nonStrictEditor);
table.getColumn(integerColumns -1).setCellEditor(nonStrictEditor);
showWithScrollingInFrame(table, "Extended NumberEditors: concrete classes Double/Integer");
}