?? interfazconectar.java
字號:
/* * To change this template, choose Tools | Templates * and open the template in the editor. *//* * interfazConectar.java * * Created on 31/03/2009, 06:18:28 AM */package vista;import controlador.cliente;import java.io.IOException;import java.net.UnknownHostException;import java.util.logging.Level;import java.util.logging.Logger;import javax.swing.JOptionPane;/** * * @author Camilo Andres */public class interfazConectar extends javax.swing.JFrame { cliente client; /** Creates new form interfazConectar */ public interfazConectar() { initComponents(); setVisible(true); } /** 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(); TFIP = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); TFPort = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); jLabel1.setText("IP Servidor"); jLabel1.setName("jLabel1"); // NOI18N TFIP.setName("TFIP"); // NOI18N jLabel2.setText("Puerto"); jLabel2.setName("jLabel2"); // NOI18N TFPort.setName("TFPort"); // NOI18N jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/WLM-Alt_48x48-32.png"))); // NOI18N jButton1.setText("Conectar"); jButton1.setName("jButton1"); // NOI18N jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(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() .addGap(30, 30, 30) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(TFPort) .addComponent(TFIP, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE))) .addContainerGap(58, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(38, 38, 38) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(TFIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(30, 30, 30) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(TFPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE) .addComponent(jButton1) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { // TODO add your handling code here: String IP = TFIP.getText(); int PORT = Integer.parseInt(TFPort.getText()); client = new cliente(IP,PORT); new ventanaCliente(client); this.dispose(); } catch (UnknownHostException ex) { Logger.getLogger(interfazConectar.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(null, "Host desconocido","No se pudo conectar al servidor FTP",JOptionPane.ERROR_MESSAGE) ; } catch (IOException ex) { Logger.getLogger(interfazConectar.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(null, "Error de conexion","No se pudo conectar al servidor FTP",JOptionPane.ERROR_MESSAGE) ; } }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField TFIP; private javax.swing.JTextField TFPort; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; // End of variables declaration//GEN-END:variables}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -