Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /*
- * XMPPClient.java
- *
- * Created on Jan 7, 2012, 12:21:01 AM
- */
- package xmpp;
- import java.awt.Image;
- import java.io.File;
- import java.io.IOException;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javax.swing.DefaultCellEditor;
- import javax.swing.JButton;
- import javax.swing.JCheckBox;
- import javax.swing.JComboBox;
- import javax.swing.JRadioButton;
- import javax.swing.table.DefaultTableModel;
- import javax.swing.table.TableCellEditor;
- import javax.swing.table.TableColumn;
- import javax.swing.text.TableView.TableRow;
- /**
- *
- * @author BIJOY
- */
- public class XMPPClient extends javax.swing.JFrame {
- /** Creates new form XMPPClient */
- public static Users usr;
- public XMPPClient() throws IOException {
- initComponents();
- usr=new Users();
- jXImageView1.setImage(new File("jabber.png"));
- jXImageView1.setOpaque(false);
- }
- /** 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() {
- jPanel1 = new javax.swing.JPanel();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jTextField1 = new javax.swing.JTextField();
- jCheckBox1 = new javax.swing.JCheckBox();
- jButton1 = new javax.swing.JButton();
- jPasswordField1 = new javax.swing.JPasswordField();
- jSeparator1 = new javax.swing.JSeparator();
- jLabel3 = new javax.swing.JLabel();
- jTextField2 = new javax.swing.JTextField();
- jXImageView1 = new org.jdesktop.swingx.JXImageView();
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- setMinimumSize(null);
- setResizable(false);
- jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- jLabel1.setText("Username:");
- jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 110, 96, -1));
- jLabel2.setText("Domain");
- jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 210, 96, -1));
- jPanel1.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 130, 165, -1));
- jCheckBox1.setText("Remember password");
- jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jCheckBox1ActionPerformed(evt);
- }
- });
- jPanel1.add(jCheckBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 253, 170, 20));
- jButton1.setText("Sign In");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 280, 118, -1));
- jPanel1.add(jPasswordField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 180, 165, -1));
- jPanel1.add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 100, 220, 18));
- jLabel3.setText("Password");
- jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 160, 96, -1));
- jPanel1.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 230, 165, -1));
- jXImageView1.setEditable(false);
- javax.swing.GroupLayout jXImageView1Layout = new javax.swing.GroupLayout(jXImageView1);
- jXImageView1.setLayout(jXImageView1Layout);
- jXImageView1Layout.setHorizontalGroup(
- jXImageView1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 200, Short.MAX_VALUE)
- );
- jXImageView1Layout.setVerticalGroup(
- jXImageView1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 80, Short.MAX_VALUE)
- );
- jPanel1.add(jXImageView1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 200, 80));
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
- .addContainerGap())
- );
- pack();
- }// </editor-fold>//GEN-END:initComponents
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
- // TODO add your handling code here:
- XMPP xmMain= new XMPP(jTextField1.getText(),jPasswordField1.getText(),jTextField2.getText());
- Thread xmppmain=new Thread(xmMain);
- xmppmain.start();
- for(;;)
- {
- if(XMLParser.auth==1)
- {
- jPanel1.hide();
- getContentPane().add(usr);
- usr.setBounds(0,0,256,411);
- usr.setVisible(true);
- usr.paintAll(getGraphics());
- break;
- }
- else if(XMLParser.auth==3)
- {
- XMLParser.auth=0;
- xmppmain.stop();
- break;
- }
- try {
- Thread.sleep(1000);
- } catch (InterruptedException ex) {
- Logger.getLogger(XMPPClient.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- repaint();
- }//GEN-LAST:event_jButton1ActionPerformed
- private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
- // TODO add your handling code here:
- }//GEN-LAST:event_jCheckBox1ActionPerformed
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(XMPPClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(XMPPClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(XMPPClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(XMPPClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- new XMPPClient().setVisible(true);
- } catch (IOException ex) {
- Logger.getLogger(XMPPClient.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- });
- }
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton jButton1;
- private javax.swing.JCheckBox jCheckBox1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JPanel jPanel1;
- private javax.swing.JPasswordField jPasswordField1;
- private javax.swing.JSeparator jSeparator1;
- private javax.swing.JTextField jTextField1;
- private javax.swing.JTextField jTextField2;
- private org.jdesktop.swingx.JXImageView jXImageView1;
- // End of variables declaration//GEN-END:variables
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement