JPanel DbP = new JPanel();   DbP.setLayout(new GridLayout(4, 1));  m_DbaseURLText = new JTextField(url,50); m_DbaseURLLab = new JLabel(" Database URL:", SwingConstants.LEFT); m_DbaseURLLab.setFont(new Font("Monospaced", Font.PLAIN, 12)); m_DbaseURLLab.setDisplayedMnemonic('D'); m_DbaseURLLab.setLabelFor(m_DbaseURLText);  m_UserNameText = new JTextField(uname,25); m_UserNameLab = new JLabel(" Username:    ", SwingConstants.LEFT); m_UserNameLab.setFont(new Font("Monospaced", Font.PLAIN, 12)); m_UserNameLab.setDisplayedMnemonic('U'); m_UserNameLab.setLabelFor(m_UserNameText);  m_PasswordText = new JPasswordField(25); m_PasswordLab = new JLabel(" Password:    ", SwingConstants.LEFT); m_PasswordLab.setFont(new Font("Monospaced", Font.PLAIN, 12)); m_PasswordLab.setDisplayedMnemonic('P'); m_PasswordLab.setLabelFor(m_PasswordText);  JPanel urlP = new JPanel();  urlP.setLayout(new FlowLayout(FlowLayout.LEFT)); urlP.add(m_DbaseURLLab); urlP.add(m_DbaseURLText); DbP.add(urlP);  JPanel usernameP = new JPanel();  usernameP.setLayout(new FlowLayout(FlowLayout.LEFT)); usernameP.add(m_UserNameLab); usernameP.add(m_UserNameText); DbP.add(usernameP);  JPanel passwordP = new JPanel();  passwordP.setLayout(new FlowLayout(FlowLayout.LEFT)); passwordP.add(m_PasswordLab); passwordP.add(m_PasswordText); DbP.add(passwordP);  JPanel buttonsP = new JPanel(); buttonsP.setLayout(new FlowLayout()); JButton ok,cancel; buttonsP.add(ok = new JButton("OK")); buttonsP.add(cancel=new JButton("Cancel")); ok.setMnemonic('O'); ok.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent evt){ m_returnValue=JOptionPane.OK_OPTION; DatabaseConnectionDialog.this.dispose(); } }); cancel.setMnemonic('C'); cancel.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent evt){ m_returnValue=JOptionPane.CLOSED_OPTION; DatabaseConnectionDialog.this.dispose(); } });  DbP.add(buttonsP); this.getContentPane().add(DbP,BorderLayout.CENTER); this.pack(); getRootPane().setDefaultButton(ok); setResizable(false);
DbConnectionDialog(url, uname, true);
  public void DbConnectionDialog(String url, String uname) {    JPanel DbP = new JPanel();    //DbP.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));    DbP.setLayout(new GridLayout(4, 1));    //DbP.setLayout(new FlowLayout(FlowLayout.LEFT));    m_DbaseURLText = new JTextField(url,50);     m_DbaseURLLab = new JLabel(" Database URL:", SwingConstants.LEFT);    m_DbaseURLLab.setFont(new Font("Monospaced", Font.PLAIN, 12));    m_DbaseURLLab.setDisplayedMnemonic('D');    m_DbaseURLLab.setLabelFor(m_DbaseURLText);    m_UserNameText = new JTextField(uname,25);     m_UserNameLab = new JLabel(" Username:    ", SwingConstants.LEFT);    m_UserNameLab.setFont(new Font("Monospaced", Font.PLAIN, 12));    m_UserNameLab.setDisplayedMnemonic('U');    m_UserNameLab.setLabelFor(m_UserNameText);    m_PasswordText = new JPasswordField(25);     m_PasswordLab = new JLabel(" Password:    ", SwingConstants.LEFT);    m_PasswordLab.setFont(new Font("Monospaced", Font.PLAIN, 12));    m_PasswordLab.setDisplayedMnemonic('P');    m_PasswordLab.setLabelFor(m_PasswordText);    JPanel urlP = new JPanel();       //urlP.setLayout(new BorderLayout());    urlP.setLayout(new FlowLayout(FlowLayout.LEFT));    urlP.add(m_DbaseURLLab);//, BorderLayout.WEST);    urlP.add(m_DbaseURLText);//, BorderLayout.CENTER);    DbP.add(urlP);    JPanel usernameP = new JPanel();       //usernameP.setLayout(new BorderLayout());    usernameP.setLayout(new FlowLayout(FlowLayout.LEFT));    usernameP.add(m_UserNameLab);//, BorderLayout.WEST);    usernameP.add(m_UserNameText);//, BorderLayout.CENTER);    DbP.add(usernameP);    JPanel passwordP = new JPanel();       //passwordP.setLayout(new BorderLayout());    passwordP.setLayout(new FlowLayout(FlowLayout.LEFT));    passwordP.add(m_PasswordLab);//, BorderLayout.WEST);    passwordP.add(m_PasswordText);//, BorderLayout.CENTER);    DbP.add(passwordP);    JPanel buttonsP = new JPanel();    buttonsP.setLayout(new FlowLayout());    JButton ok,cancel;    buttonsP.add(ok = new JButton("OK"));    buttonsP.add(cancel=new JButton("Cancel"));    ok.setMnemonic('O');    ok.addActionListener(new ActionListener(){	public void actionPerformed(ActionEvent evt){	  m_returnValue=JOptionPane.OK_OPTION;	  DatabaseConnectionDialog.this.dispose();      }    });    cancel.setMnemonic('C');    cancel.addActionListener(new ActionListener(){	public void actionPerformed(ActionEvent evt){	  m_returnValue=JOptionPane.CLOSED_OPTION;	  DatabaseConnectionDialog.this.dispose();      }    });       DbP.add(buttonsP);    this.getContentPane().add(DbP,BorderLayout.CENTER);    this.pack();    getRootPane().setDefaultButton(ok);    setResizable(false);  }