package server; import javaforce.JF; /** * * @author pquiring */ public class GetPassword extends javax.swing.JDialog { /** * Creates new form GetPassword */ public GetPassword(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); JF.centerWindow(this); JF.assignHotKey(this, ok, java.awt.event.KeyEvent.VK_ENTER); JF.assignHotKey(this, cancel, java.awt.event.KeyEvent.VK_ESCAPE); } /** * 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">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); adminPassword = new javax.swing.JPasswordField(); ok = new javax.swing.JButton(); cancel = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Enter Admin Password"); jLabel1.setText("Admin Password"); ok.setText("Ok"); ok.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okActionPerformed(evt); } }); cancel.setText("Cancel"); cancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(adminPassword)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 120, Short.MAX_VALUE) .addComponent(cancel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ok))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(adminPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ok) .addComponent(cancel)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelActionPerformed dispose(); }//GEN-LAST:event_cancelActionPerformed private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed accepted = true; dispose(); }//GEN-LAST:event_okActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPasswordField adminPassword; private javax.swing.JButton cancel; private javax.swing.JLabel jLabel1; private javax.swing.JButton ok; // End of variables declaration//GEN-END:variables public boolean accepted; public String getPassword() { return new String(adminPassword.getPassword()); } }