灵活的摆动输入对话框
Flexible Swing Input Dialog
我想创建一个对话框,其中包含一列字段标题和另一列字段。我希望能够指定字段以仅允许特定类型的数据。使用 swing,创建可重用 class 以实现此目的最惯用的方法是什么?
Validating Input, you can use an InputVerifier
to restrict input; a complete example is examined here. In the particular case of columnar data, a JTable
can choose the editor based on the underlying model's data type—the value returned by getColumnClass()
. You can let the editor validate user-entered text in your implementation of stopCellEditing()
, illustrated here. In either case, you can add a panel containing the input component(s) to a dialog, as outlined .
中所示
我想创建一个对话框,其中包含一列字段标题和另一列字段。我希望能够指定字段以仅允许特定类型的数据。使用 swing,创建可重用 class 以实现此目的最惯用的方法是什么?
Validating Input, you can use an InputVerifier
to restrict input; a complete example is examined here. In the particular case of columnar data, a JTable
can choose the editor based on the underlying model's data type—the value returned by getColumnClass()
. You can let the editor validate user-entered text in your implementation of stopCellEditing()
, illustrated here. In either case, you can add a panel containing the input component(s) to a dialog, as outlined