frame in dialog in appplet....
i think this is the right place for this posting...
Q. 1 Once the applet is opened, then after clicking on jButton1,why it does not display under NewJDialog... in other words I want NewJFrame to display in NewJDialog. Actually as you know Applet does not allow Frames to be "always on top" so i am changing my code and put all my frames in the NewJDialogs...rather than developing new gui in Dialogs..
Q. 2 After NewJDialog is opened (clicked on jButton1), if the entire application NewJApplet is hidden under any other application, clicking on NewJApplet application will not bring it to the forground. in other words .,. it should atleast come to the front on first click and on second click it should beep...
Q3. Just wander after NewJDialog is opened, is there anyway button1 is also clickable?
Thanks in advance
publicclass NewJAppletextends javax.swing.JApplet{
/** Initializes the applet NewJApplet */
publicvoid init(){
try{
java.awt.EventQueue.invokeAndWait(new Runnable(){
publicvoid run(){
initComponents();
}
});
}catch (Exception ex){
ex.printStackTrace();
}
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
privatevoid initComponents(){
jPanel1 =new javax.swing.JPanel();
jButton1 =new javax.swing.JButton();
button1 =new java.awt.Button();
getContentPane().setLayout(new java.awt.FlowLayout());
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener(){
publicvoid actionPerformed(java.awt.event.ActionEvent evt){
jButton1ActionPerformed(evt);
}
});
jPanel1.add(jButton1);
button1.setLabel("button1");
jPanel1.add(button1);
getContentPane().add(jPanel1);
}
// </editor-fold>
privatevoid jButton1ActionPerformed(java.awt.event.ActionEvent evt){
// TODO add your handling code here:
java.awt.EventQueue.invokeLater(new Runnable(){
publicvoid run(){
new NewJDialog(new javax.swing.JFrame(),true).setVisible(true);
}
});
}
// Variables declaration - do not modify
private java.awt.Button button1;
private javax.swing.JButton jButton1;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
publicclass NewJDialogextends javax.swing.JDialog{
/** Creates new form NewJDialog */
public NewJDialog(java.awt.Frame parent,boolean modal){
super(parent, modal);
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.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
privatevoid initComponents(){
getContentPane().setLayout(new java.awt.FlowLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
pack();
}
// </editor-fold>
/**
* @param args the command line arguments
*/
publicstaticvoid main(String args[]){
java.awt.EventQueue.invokeLater(new Runnable(){
publicvoid run(){
//new NewJDialog(new javax.swing.JFrame(), true).setVisible(true);
new NewJDialog(new javax.swing.JFrame(),true).setVisible(true);
}
});
}
// Variables declaration - do not modify
// End of variables declaration
}
publicclass NewJFrameextends javax.swing.JFrame{
/** Creates new form NewJFrame */
public NewJFrame(){
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.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
privatevoid initComponents(){
jButton1 =new javax.swing.JButton();
jLabel1 =new javax.swing.JLabel();
textField1 =new java.awt.TextField();
getContentPane().setLayout(new java.awt.FlowLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("jButton1");
getContentPane().add(jButton1);
jLabel1.setText("jLabel1");
getContentPane().add(jLabel1);
textField1.setText("textField1");
getContentPane().add(textField1);
pack();
}
// </editor-fold>
/**
* @param args the command line arguments
*/
publicstaticvoid main(String args[]){
java.awt.EventQueue.invokeLater(new Runnable(){
publicvoid run(){
new NewJFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private java.awt.TextField textField1;
// End of variables declaration
}

