Swing常用整理
打开文件或者文件夹:
try { Desktop.getDesktop().open(target); } catch (IOException e1) { e1.printStackTrace(); }
可定制的多选项弹窗:
Object[] options = { ResourceFactory.getString("global_yes"), ResourceFactory.getString("global_no"), ResourceFactory.getString("global_cancel") }; int choice = JOptionPane.showOptionDialog(this, ResourceFactory.getString("message"), ResourceFactory.getString("title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); if(choice == JOptionPane.CANCEL_OPTION) { } if (choice == JOptionPane.NO_OPTION) { }