📄 configurationframe.java
字号:
firstPanel.add(outboundProxyAddressTextField); outboundProxyPortLabel=new JLabel("Outbound proxy port:"); outboundProxyPortLabel.setForeground(Color.black); outboundProxyPortTextField = new JTextField(20); outboundProxyPortLabel.setBorder(labelBorder); outboundProxyPortLabel.setOpaque(true); outboundProxyPortLabel.setBackground(labelBackGroundColor); firstPanel.add(outboundProxyPortLabel); firstPanel.add(outboundProxyPortTextField); registrarAddressLabel=new JLabel("Registrar IP address:"); registrarAddressLabel.setForeground(Color.black); registrarAddressTextField = new JTextField(20); registrarAddressLabel.setBorder(labelBorder); registrarAddressLabel.setOpaque(true); registrarAddressLabel.setBackground(labelBackGroundColor); firstPanel.add(registrarAddressLabel); firstPanel.add(registrarAddressTextField); registrarPortLabel=new JLabel("Registrar port:"); registrarPortLabel.setForeground(Color.black); registrarPortTextField = new JTextField(20); registrarPortLabel.setBorder(labelBorder); registrarPortLabel.setOpaque(true); registrarPortLabel.setBackground(labelBackGroundColor); firstPanel.add(registrarPortLabel); firstPanel.add(registrarPortTextField); imAddressLabel=new JLabel("Contact IP address:"); imAddressLabel.setForeground(Color.black); imAddressTextField = new JTextField(20); imAddressLabel.setBorder(labelBorder); imAddressLabel.setOpaque(true); imAddressLabel.setBackground(labelBackGroundColor); firstPanel.add(imAddressLabel); firstPanel.add(imAddressTextField); imPortLabel=new JLabel("Contact port:"); imPortLabel.setForeground(Color.black); imPortTextField = new JTextField(20); imPortLabel.setBorder(labelBorder); imPortLabel.setOpaque(true); imPortLabel.setBackground(labelBackGroundColor); firstPanel.add(imPortLabel); firstPanel.add(imPortTextField); imProtocolLabel=new JLabel("Contact transport:"); imProtocolLabel.setForeground(Color.black); imProtocolTextField = new JTextField(20); imProtocolLabel.setBorder(labelBorder); imProtocolLabel.setOpaque(true); imProtocolLabel.setBackground(labelBackGroundColor); firstPanel.add(imProtocolLabel); firstPanel.add(imProtocolTextField); outputFileLabel=new JLabel("Output file:"); outputFileLabel.setForeground(Color.black); outputFileTextField = new JTextField(20); outputFileLabel.setBorder(labelBorder); outputFileLabel.setOpaque(true); outputFileLabel.setBackground(labelBackGroundColor); firstPanel.add(outputFileLabel); firstPanel.add(outputFileTextField); buddiesFileLabel=new JLabel("Buddies file:"); buddiesFileLabel.setForeground(Color.black); buddiesFileTextField = new JTextField(20); buddiesFileLabel.setBorder(labelBorder); buddiesFileLabel.setOpaque(true); buddiesFileLabel.setBackground(labelBackGroundColor); firstPanel.add(buddiesFileLabel); firstPanel.add(buddiesFileTextField); authenticationFileLabel=new JLabel("Authentication file:"); authenticationFileLabel.setForeground(Color.black); authenticationFileTextField = new JTextField(20); authenticationFileLabel.setBorder(labelBorder); authenticationFileLabel.setOpaque(true); authenticationFileLabel.setBackground(labelBackGroundColor); firstPanel.add(authenticationFileLabel); firstPanel.add(authenticationFileTextField); defaultRouterLabel=new JLabel("Default router class name:"); defaultRouterLabel.setForeground(Color.black); defaultRouterTextField = new JTextField(20); defaultRouterLabel.setBorder(labelBorder); defaultRouterLabel.setOpaque(true); defaultRouterLabel.setBackground(labelBackGroundColor); firstPanel.add(defaultRouterLabel); firstPanel.add(defaultRouterTextField); thirdPanel = new JPanel(); thirdPanel.setOpaque(false); // top, left, bottom, right thirdPanel.setLayout(new FlowLayout(FlowLayout.CENTER) ); submitButton = new JButton(" Submit "); submitButton.setToolTipText("Submit your changes!"); submitButton.setFocusPainted(false); submitButton.setFont(new Font ("Dialog", 1, 16)); submitButton.setBackground(buttonBackGroundColor); submitButton.setBorder(buttonBorder); submitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { submitButtonActionPerformed(evt); } } ); thirdPanel.add(submitButton); container.add(thirdPanel); } public boolean check(String text) { if (text==null || text.trim().equals("") ) { return false; } else return true; } public void submitButtonActionPerformed(ActionEvent evt) { String text=""; IMUserAgent imUA=imGUI.getInstantMessagingUserAgent(); IMRegisterProcessing imRegisterProcessing=imUA.getIMRegisterProcessing(); if ( !imRegisterProcessing.isRegistered()) { String temp=outboundProxyAddressTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.outboundProxyAddress="+temp+"\n"; temp=outboundProxyPortTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.outboundProxyPort="+temp+"\n"; temp=registrarAddressTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.registrarAddress="+temp+"\n"; temp=registrarPortTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.registrarPort="+temp+"\n"; temp=imAddressTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.imAddress="+temp+"\n"; temp=imPortTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.imPort="+temp+"\n"; temp=imProtocolTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.imProtocol="+temp+"\n"; temp=outputFileTextField.getText(); if (temp !=null && !temp.trim().equals("") ) { text+="examples.im.outputFile="+temp+"\n"; DebugIM.setDebugFile(temp); } else DebugIM.setDebugFile(null); temp=buddiesFileTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.buddiesFile="+temp+"\n"; temp=authenticationFileTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.authenticationFile="+temp+"\n"; temp=defaultRouterTextField.getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.defaultRouter="+temp+"\n"; temp=imGUI.getLocalSipURLTextField().getText(); if (temp !=null && !temp.trim().equals("") ) text+="examples.im.localSipURL="+temp+"\n"; String propertiesFile=imGUI.getPropertiesFile(); if (propertiesFile==null) DebugIM.println("DebugIM, unable to write the "+ "properties, specify a properties file when you start the client" ); else { IMUtilities.writeFile(propertiesFile,text); imGUI.restart(); } this.setVisible(false); } else { new AlertInstantMessaging( "You must sign out from the registrar before changing something!!!", JOptionPane.ERROR_MESSAGE); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -