📄 configurationframe.java
字号:
/* * ConfigurationFrame.java * * Created on December 11, 2003, 10:19 AM */package gov.nist.applet.phone.ua.gui;import gov.nist.applet.phone.ua.*;/** * * @author DERUELLE Jean */public class ConfigurationFrame extends javax.swing.JFrame { MessengerManager sipMeetingManager; Configuration configuration; /** Creates new form ConfigurationFrame */ public ConfigurationFrame(MessengerManager sipMeetingManager) { this.sipMeetingManager=sipMeetingManager; configuration=sipMeetingManager.getMessageListener().getConfiguration(); initComponents(); this.setSize(400,300); this.setResizable(false); buttonGroup1.add(jRadioButton1); buttonGroup1.add(jRadioButton2); jTextField1.setText(configuration.userURI); jTextField2.setText(configuration.outboundProxy); jTextField3.setText(String.valueOf(configuration.proxyPort)); if(configuration.mediaTransport.equals("udp")){ jRadioButton1.setSelected(true); jRadioButton2.setSelected(false); } else{ jRadioButton1.setSelected(false); jRadioButton2.setSelected(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. */ private void initComponents() {//GEN-BEGIN:initComponents buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); getContentPane().setLayout(null); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Configuration"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); jPanel1.setLayout(null); jLabel1.setText("URI :"); jPanel1.add(jLabel1); jLabel1.setBounds(20, 20, 50, 20); jLabel2.setText("Proxy Address :"); jPanel1.add(jLabel2); jLabel2.setBounds(20, 60, 110, 20); jLabel3.setText("Proxy Port :"); jPanel1.add(jLabel3); jLabel3.setBounds(20, 100, 110, 20); jLabel4.setText("Type of audio conversation :"); jPanel1.add(jLabel4); jLabel4.setBounds(20, 140, 300, 20); jPanel1.add(jTextField1); jTextField1.setBounds(140, 20, 150, 20); jPanel1.add(jTextField2); jTextField2.setBounds(140, 60, 150, 20); jPanel1.add(jTextField3); jTextField3.setBounds(140, 100, 150, 20); jRadioButton1.setText("Real Time"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton1ActionPerformed(evt); } }); jPanel1.add(jRadioButton1); jRadioButton1.setBounds(50, 170, 110, 24); jRadioButton2.setText("Voice Messaging"); jPanel1.add(jRadioButton2); jRadioButton2.setBounds(180, 170, 200, 24); jButton1.setText("Apply changes"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jPanel1.add(jButton1); jButton1.setBounds(50, 210, 140, 26); jButton2.setText("Cancel"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel1.add(jButton2); jButton2.setBounds(240, 210, 81, 26); getContentPane().add(jPanel1); jPanel1.setBounds(0, 0, 400, 300); pack(); }//GEN-END:initComponents private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed // Add your handling code here: }//GEN-LAST:event_jRadioButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // Add your handling code here: this.dispose(); }//GEN-LAST:event_jButton2ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // Add your handling code here: configuration.userURI=jTextField1.getText(); sipMeetingManager.setUserURI(configuration.userURI); configuration.outboundProxy=jTextField2.getText(); try{ configuration.proxyPort=Integer.parseInt(jTextField3.getText()); } catch(NumberFormatException nfe){ nfe.printStackTrace(); } if(jRadioButton1.isSelected()) configuration.mediaTransport="udp"; else configuration.mediaTransport="tcp"; sipMeetingManager.getMessageListener().resetOutBoundProxy(); this.dispose(); }//GEN-LAST:event_jButton1ActionPerformed /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm this.dispose(); }//GEN-LAST:event_exitForm /** * @param args the command line arguments */ public static void main(String args[]) { //new ConfigurationFrame().show(); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel1; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; // End of variables declaration//GEN-END:variables }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -