calling constructor of a dialogbox in main using netbeans
In my project,Login window is created as a Dialog box.
So when i tried to call the constructor of Login from Main it was generating an error regarding the arguments passed. I have not used any arguments when i called. when i looked at the code, the function was declared as public Login(java.awt.Frame parent,boolean modal) so when i call it from main(),what am i supposed to do ? hope my query is understandable. THANX |
How about you show us how you are currently calling it from main() and then we can see where you have gone wrong?
|
Quote:
// this is the constructor i want to call public class UserLogin extends javax.swing.JDialog { /** Creates new form UserLogin */ public UserLogin(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } //and it has the main function public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { UserLogin dialog = new UserLogin(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } ============================================================ // in the main function of the project,main.java i tried calling it using UserLogin ul=new UserLogin(); //which reports an error as no such constructor =========================================================== |
That would be the correct error as you have written:
Quote:
Quote:
|
All times are GMT -5. The time now is 07:50 PM. |