我觉得自己已经完成了繁重的任务,现在我被困在应该是最简单的部分,关闭我的窗格。罐头有人请告诉我我做错了什么?我认为这些是适用的位,但我很乐意在需要时添加更多。谢谢!
我有一个JOptionPane.showOptionDialog,它做了一些复杂的事情。我有一个翻译按钮:
private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) {
//Translate
启动此面板:
int result = JOptionPane.showOptionDialog(null, xlf_myPanel, "Navigate Segments",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE,
null, xoptions, null);
它做的东西(到目前为止一切都很好):
System.out.println(myglobal+" source: " + xlf_xField.getText());
System.out.println(xlf_varig+"target: " + xlf_yField.getText());
PrintWriter out = new PrintWriter("x-files/temp/"+xlf_varig+"-.txt");
out.println(xlf_yField.getText());
out.close();
我做了一些转换
switch( result ) {
case 0:
// Next selected
myglobal +=1 ;
runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl");
textfield.setText(String.valueOf(myglobal));
break;
case 1:
// Previous selected
myglobal -=1 ;
runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl");
textfield.setText(String.valueOf(myglobal));
break;
case 2:
// First selected
myglobal = 0 ;
// jButton26.setEnabled(true);
runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl");
textfield.setText(String.valueOf(myglobal));
break;
case 3:
// Last selected
myglobal = mylastglobal ;
// jButton25.setEnabled(true);
runnavigate("n/a moved this into runtransform", "x-files/out/tmx.xml", "x-files/xsl/xliff2tmx.xsl");
textfield.setText(String.valueOf(myglobal));
break;
case 4:
// Done selected
//result.dispose(); // not working - this says cannot dispose int
System.out.println( "Done chosen" );
break;
case JOptionPane.CLOSED_OPTION:
// User closed the box. Nothing selected.
System.out.println( "Dialog Closed" );
break;
}
但当我点击" Done"按钮,翻译按钮保持单击。如何让它正确关闭?