private void launch() { head = new JLabel(); email = new JLabel(); pas = new JLabel(); pass = new JPasswordField(); JTextComponent.KeyBinding[] newBindings = { new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction), new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction), new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction) }; Keymap k = pass.getKeymap(); JTextComponent.loadKeymap(k, newBindings, pass.getActions()); mail = new JTextField(); XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png")); head.setFont(new Font("Verdana", 1, 16)); head.setText("Change Email ID"); email.setFont(new Font("Verdana", 0, 12)); email.setText("Enter New Email ID"); pas.setFont(new Font("Verdana", 0, 12)); pas.setText("Enter the Password"); sub.setToolTipText("Submit"); sub.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { if (pass.getText().equals(pwd)) { if ((mail.getText().equalsIgnoreCase(null)) || (mail.getText().equalsIgnoreCase(""))) { JOptionPane.showMessageDialog( null, "Please Enter the new email id", "Error", JOptionPane.ERROR_MESSAGE); } else { String r = update(mail.getText()); if (r.equalsIgnoreCase("ok")) { JOptionPane.showMessageDialog( null, "Updated....", "Alert", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog( null, "Encountered Error cant update..", "Error", JOptionPane.ERROR_MESSAGE); } } } else { JOptionPane.showMessageDialog( null, "Incorrect Password", "Error", JOptionPane.ERROR_MESSAGE); } dispose(); } }); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(118, 118, 118) .addComponent(head)) .addGroup( layout .createSequentialGroup() .addGap(77, 77, 77) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pas) .addComponent(email)) .addGap(27, 27, 27) .addGroup( layout .createParallelGroup( GroupLayout.Alignment.LEADING, false) .addComponent(mail) .addComponent( pass, GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)))) .addContainerGap(31, Short.MAX_VALUE)) .addGroup( GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(165, Short.MAX_VALUE) .addComponent(sub) .addGap(170, 170, 170))); layout.setVerticalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(38, 38, 38) .addComponent(head) .addGap(48, 48, 48) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(email) .addComponent( mail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pas, GroupLayout.Alignment.TRAILING) .addComponent( pass, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(45, 45, 45) .addComponent(sub) .addContainerGap(56, Short.MAX_VALUE))); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); } }); setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg")); setLocation(h / 2, w / 7); setResizable(false); setTitle("Change Email"); pack(); }
private void launch() { head = new JLabel(); pas = new JPasswordField(); JTextComponent.KeyBinding[] newBindings = { new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction), new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction), new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction) }; Keymap k = pas.getKeymap(); JTextComponent.loadKeymap(k, newBindings, pas.getActions()); XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png")); head.setFont(new Font("Verdana", 1, 16)); head.setText("Employee ID: " + emp + " please enter the password"); sub.setFont(new Font("Verdana", 1, 12)); sub.setToolTipText("Submit"); sub.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { String pwd = new CheckQuery(emp).search(rav); if ((pas.getText().equalsIgnoreCase(null)) || (pas.getText().equalsIgnoreCase(""))) { JOptionPane.showMessageDialog( null, "Please Enter the Password", "Error", JOptionPane.ERROR_MESSAGE); } else if (pas.getText().equalsIgnoreCase(pwd)) { dispose(); merge(); } else { JOptionPane.showMessageDialog( null, "Oops Incorrect Password", "Error", JOptionPane.ERROR_MESSAGE); } } }); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(196, 196, 196) .addComponent(sub)) .addGroup( layout .createSequentialGroup() .addGap(31, 31, 31) .addComponent(head)) .addGroup( layout .createSequentialGroup() .addGap(126, 126, 126) .addComponent( pas, GroupLayout.PREFERRED_SIZE, 216, GroupLayout.PREFERRED_SIZE))) .addContainerGap(34, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(33, 33, 33) .addComponent(head) .addGap(45, 45, 45) .addComponent( pas, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(56, 56, 56) .addComponent(sub) .addContainerGap(42, Short.MAX_VALUE))); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); } }); setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg")); setLocation(h / 2, w / 7); setResizable(false); setTitle("Authentication"); pack(); }
private void launch() { head = new JLabel(); old = new JLabel(); new1 = new JLabel(); new2 = new JLabel(); pas1 = new JPasswordField(); JTextComponent.KeyBinding[] newBindings = { new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction), new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction), new JTextComponent.KeyBinding( KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK), DefaultEditorKit.beepAction) }; Keymap k = pas1.getKeymap(); JTextComponent.loadKeymap(k, newBindings, pas1.getActions()); pas2 = new JPasswordField(); Keymap k2 = pas2.getKeymap(); JTextComponent.loadKeymap(k2, newBindings, pas2.getActions()); pas3 = new JPasswordField(); Keymap k3 = pas3.getKeymap(); JTextComponent.loadKeymap(k3, newBindings, pas3.getActions()); XrButton sub = new XrButton(new ImageIcon("Bin\\img\\ok.png")); sub.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { if (pas1.getText().equals(pwd)) { if ((pas1.getText().equalsIgnoreCase("")) || (pas1.getText().equalsIgnoreCase(null)) || (pas2.getText().equalsIgnoreCase("")) || (pas2.getText().equalsIgnoreCase(null)) || (pas3.getText().equalsIgnoreCase("")) || (pas3.getText().equalsIgnoreCase(null))) { JOptionPane.showMessageDialog( null, "Please all the text fields", "Error", JOptionPane.ERROR_MESSAGE); } else { if ((pas2.getText().equalsIgnoreCase(pas3.getText()))) { String r = update(pas2.getText()); if (r.equalsIgnoreCase("ok")) { JOptionPane.showMessageDialog( null, "Updated....", "Alert", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog( null, "Encountered Error cant update..", "Error", JOptionPane.ERROR_MESSAGE); } } else { JOptionPane.showMessageDialog( null, "New password do not match", "Error", JOptionPane.ERROR_MESSAGE); } } } else { JOptionPane.showMessageDialog( null, "Incorrect old password", "Error", JOptionPane.ERROR_MESSAGE); } dispose(); } }); head.setFont(new Font("Verdana", 1, 16)); head.setText("Change Password"); old.setFont(new Font("Verdana", 0, 12)); old.setText("Old Password"); new1.setFont(new Font("Verdana", 0, 12)); new1.setText("New Password"); new2.setFont(new Font("Verdana", 0, 12)); new2.setText("Confirm Password"); sub.setToolTipText("Submit"); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(57, 57, 57) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(old) .addComponent(new1) .addComponent(new2)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 49, Short.MAX_VALUE) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent( pas1, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE) .addComponent( pas2, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE) .addComponent( pas3, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)) .addContainerGap(57, Short.MAX_VALUE)) .addGroup( GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(166, Short.MAX_VALUE) .addComponent(sub) .addGap(161, 161, 161)) .addGroup( GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(122, Short.MAX_VALUE) .addComponent(head) .addGap(119, 119, 119))); layout.setVerticalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(31, 31, 31) .addComponent(head) .addGap(50, 50, 50) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(old) .addComponent( pas1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(30, 30, 30) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(new1) .addComponent( pas2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(new2) .addComponent( pas3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE) .addComponent(sub) .addGap(22, 22, 22))); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); } }); setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\airindia.jpg")); setLocation(h / 2, w / 7); setResizable(false); setTitle("Change Password"); pack(); }
private void initComponents() { String a[] = getdetails(); look(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel1.setFont(new java.awt.Font("Verdana", 1, 18)); jLabel1.setForeground(new java.awt.Color(0, 102, 255)); jLabel1.setText("Employee's Detail"); jLabel2.setFont(new java.awt.Font("Serif", 1, 16)); jLabel2.setText("Employee ID : " + a[0]); jLabel3.setFont(new java.awt.Font("Serif", 1, 16)); jLabel3.setText("Employee Name : " + a[1]); jLabel4.setFont(new java.awt.Font("Serif", 1, 16)); jLabel4.setText("Current Project : " + a[2]); jLabel5.setFont(new java.awt.Font("Serif", 1, 16)); jLabel5.setText("Department : " + a[3]); jLabel6.setFont(new java.awt.Font("Serif", 1, 16)); jLabel6.setText("Date Of Joining : " + a[4]); jLabel7.setFont(new java.awt.Font("Serif", 1, 16)); jLabel7.setText("Contact No. : " + a[6]); jLabel8.setFont(new java.awt.Font("Serif", 1, 16)); jLabel8.setText("Region : " + a[7]); jLabel9.setFont(new java.awt.Font("Serif", 1, 16)); jLabel9.setText("Address : " + a[5]); jLabel10.setFont(new java.awt.Font("Serif", 1, 16)); jLabel10.setText("Date Of Resignation : " + a[8]); jLabel11.setFont(new java.awt.Font("Serif", 1, 16)); jLabel11.setText("Reason : "); jButton1.setToolTipText("Accept"); jButton1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { int response; response = JOptionPane.showConfirmDialog( null, "Are you sure you want to accept the resignation?"); if (response == 0) { update(0); dispose(); } } }); jButton2.setToolTipText("Under Consideration"); jButton3.setToolTipText("Reject"); jButton3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { int response; response = JOptionPane.showConfirmDialog( null, "Are you sure you want to reject the resignation?"); if (response == 0) { update(2); File f = new File("Bin/reasons/" + empid + ".ravs"); f.delete(); new mailsending(mempid, empid).setVisible(true); dispose(); } } }); jTextArea1.setColumns(20); jTextArea1.setRows(5); jTextArea1.setText(a[9]); jTextArea1.setEditable(false); jTextArea1.setWrapStyleWord(true); jScrollPane1.setViewportView(jTextArea1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(80, 80, 80) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addComponent(jLabel10) .addComponent(jLabel8) .addComponent(jLabel6) .addComponent(jLabel4) .addComponent(jLabel2)) .addGap(157, 157, 157) .addGroup( layout .createParallelGroup( javax.swing.GroupLayout.Alignment .LEADING) .addComponent(jLabel9) .addComponent(jLabel7) .addComponent(jLabel5) .addComponent(jLabel3))) .addGroup( layout .createSequentialGroup() .addComponent(jLabel11) .addGap(90, 90, 90) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup( layout .createSequentialGroup() .addGap(300, 300, 300) .addComponent(jLabel1)) .addGroup( layout .createSequentialGroup() .addGap(215, 215, 215) .addComponent(jButton1) .addGap(73, 73, 73) .addComponent(jButton2) .addGap(64, 64, 64) .addComponent(jButton3))) .addContainerGap(154, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(35, 35, 35) .addComponent(jLabel1) .addGap(61, 61, 61) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(55, 55, 55) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jLabel5)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jLabel7)) .addGap(41, 41, 41) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(jLabel9)) .addGap(45, 45, 45) .addComponent(jLabel10) .addGap(44, 44, 44) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel11) .addComponent( jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2) .addComponent(jButton3)) .addGap(71, 71, 71))); // setAlwaysOnTop(true); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false); } }); setTitle("Employee Detail Screen"); setIconImage(Toolkit.getDefaultToolkit().getImage("Bin\\img\\r.gif")); setLocation(h / 4, w / 20); setResizable(false); pack(); }