आप ऊपर मेरे विषय से देखा है में एक और JOptionPane के उद्भव पर एक JOptionPane खारिज कर सकते हैं कैसे,
मैं चाहूँगा पता है कि कैसे मैं एक JOptionPane जो एक और JOptionPane की वजह से और क्योंकि उपयोगकर्ता अप्रासंगिक हो गया खारिज कर सकते हैं , किसी कारण से, ओके बटन पर क्लिक करके पहले व्यक्ति को खारिज नहीं किया (उदाहरण के लिए)।मैं जीयूआई
मैं अन्य साइट समान प्रश्न में कुछ बर्तन को देखा है, और लोगों को बस करने के लिए सुझाव दिया:
JOptionPane.getRootFrame().dispose();
लेकिन मैं प्रत्येक JOptionPane मेरे पास है और केवल कि खारिज करने के लिए सक्षम होने के लिए के लिए एक संदर्भ कैसे स्टोर कर सकते हैं एक चाहता था
धन्यवाद
संपादित:
कोड उदाहरण:
package Gui;
import javax.swing.JOptionPane;
import java.awt.*;
/**
*
* @author
*/
public class JpanelMainView extends javax.swing.JPanel {
/** Creates new form JpanelMainView */
public JpanelMainView() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(149, 149, 149)
.addComponent(jButton1)
.addContainerGap(178, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(77, 77, 77)
.addComponent(jButton1)
.addContainerGap(200, Short.MAX_VALUE))
);
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
JOptionPane.showMessageDialog(this, "Board was sent for validation check\n Please wait...","Board Sent",JOptionPane.INFORMATION_MESSAGE);
//Please note that this OptionPane is coming in my real program always after the first JoptionPane
//I want that if I've reached the line in the code that need to show this second JoptionPane, I will first close the first JoptionPane
//Else you will dismiss the last JoptionPane and then the first one and I don't want to give the user two JoptionPane to close, it's annoying.
JOptionPane.showMessageDialog(this, "Set your move now please","Game started",JOptionPane.INFORMATION_MESSAGE);
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
// End of variables declaration
}
एक JOptionPane आमतौर पर मोडल है (वहाँ निश्चित रूप से अपवाद हैं), तो मैं आश्चर्य है कि कैसे उपयोगकर्ता भी एक दूसरे JOptionPane ऊपर लाने के लिए जब पहले एक दिख रहा है कर रहा था? क्या आप एक छोटे से संकलित और चलने योग्य प्रोग्राम को बना सकते हैं और पोस्ट कर सकते हैं जो आपकी समस्या का प्रदर्शन करता है और हम एक [एसएससीई] (http://sscce.org) का परीक्षण, संशोधन और संभवतः सही कर सकते हैं? –
ठीक है मैंने वास्तव में सरल कामकाजी उदाहरण उत्पन्न किया है जहां मुझे इसे अपलोड करना चाहिए? – JavaSa
@JavaSa: अपनी पोस्ट संपादित करें और इसे शामिल करें। –