?? configurationframe.java
字號:
/* * * * Created on April 1, 2002, 3:08 PM */package gov.nist.sip.instantmessaging;import javax.swing.*;import javax.swing.border.*;import java.awt.*;import java.awt.event.*;import java.io.*;import java.util.*;import gov.nist.sip.instantmessaging.presence.*;/** * * @author deruelle * @version 1.0 */public class ConfigurationFrame extends JFrame { protected JLabel outboundProxyAddressLabel; protected JLabel outboundProxyPortLabel; protected JLabel registrarAddressLabel; protected JLabel registrarPortLabel; protected JLabel imAddressLabel; protected JLabel imPortLabel; protected JLabel imProtocolLabel; protected JLabel outputFileLabel; protected JLabel buddiesFileLabel; protected JLabel authenticationFileLabel; protected JLabel defaultRouterLabel; protected JTextField outboundProxyAddressTextField; protected JTextField outboundProxyPortTextField ; protected JTextField registrarAddressTextField; protected JTextField registrarPortTextField; protected JTextField imAddressTextField ; protected JTextField imPortTextField; protected JTextField imProtocolTextField; protected JTextField outputFileTextField; protected JTextField buddiesFileTextField; protected JTextField authenticationFileTextField; protected JTextField defaultRouterTextField; protected JPanel firstPanel; protected JPanel thirdPanel; protected JButton submitButton; protected InstantMessagingGUI imGUI; // All for the container: public Color containerBackGroundColor=new Color(204,204,204); // All for the labels: public Border labelBorder=new EtchedBorder(EtchedBorder.RAISED); public Color labelBackGroundColor=new Color(217,221,221); // All for the TextField public Color textBackGroundColor=Color.white; // All for the Button public Border buttonBorder=new BevelBorder(BevelBorder.RAISED); public Color buttonBackGroundColor=new Color(186,175,175); /** Creates new form SIPHeadersParametersFrame */ public ConfigurationFrame(InstantMessagingGUI imGUI, String title) { super(title); this.imGUI=imGUI; initComponents(); } public String getRouterPath() { return defaultRouterTextField.getText(); } public String getOutboundProxyAddress() { return outboundProxyAddressTextField.getText(); } public String getOutboundProxyPort() { return outboundProxyPortTextField.getText(); } public String getRegistrarAddress() { return registrarAddressTextField.getText(); } public String getRegistrarPort() { return registrarPortTextField.getText(); } public String getIMAddress() { return imAddressTextField.getText(); } public String getIMPort() { return imPortTextField.getText(); } public String getIMProtocol() { return imProtocolTextField.getText(); } public String getOutputFile() { return outputFileTextField.getText(); } public void hideFrame() { this.hide(); } public void blockProperties() { outboundProxyAddressTextField.setEditable(false); outboundProxyAddressTextField.setBackground(Color.lightGray); outboundProxyPortTextField.setEditable(false); outboundProxyPortTextField.setBackground(Color.lightGray); registrarAddressTextField.setEditable(false); registrarAddressTextField.setBackground(Color.lightGray); registrarPortTextField.setEditable(false); registrarPortTextField.setBackground(Color.lightGray); imAddressTextField.setEditable(false); imAddressTextField.setBackground(Color.lightGray); imPortTextField.setEditable(false); imPortTextField.setBackground(Color.lightGray); imProtocolTextField.setEditable(false); imProtocolTextField.setBackground(Color.lightGray); outputFileTextField.setEditable(false); outputFileTextField.setBackground(Color.lightGray); buddiesFileTextField.setEditable(false); buddiesFileTextField.setBackground(Color.lightGray); authenticationFileTextField.setEditable(false); authenticationFileTextField.setBackground(Color.lightGray); defaultRouterTextField.setEditable(false); defaultRouterTextField.setBackground(Color.lightGray); } public void unblockProperties() { outboundProxyAddressTextField.setEditable(true); outboundProxyAddressTextField.setBackground(Color.white); outboundProxyPortTextField.setEditable(true); outboundProxyPortTextField.setBackground(Color.white); registrarAddressTextField.setEditable(true); registrarAddressTextField.setBackground(Color.white); registrarPortTextField.setEditable(true); registrarPortTextField.setBackground(Color.white); imAddressTextField.setEditable(true); imAddressTextField.setBackground(Color.white); imPortTextField.setEditable(true); imPortTextField.setBackground(Color.white); imProtocolTextField.setEditable(true); imProtocolTextField.setBackground(Color.white); outputFileTextField.setEditable(true); outputFileTextField.setBackground(Color.white); buddiesFileTextField.setEditable(true); buddiesFileTextField.setBackground(Color.white); authenticationFileTextField.setEditable(true); authenticationFileTextField.setBackground(Color.white); defaultRouterTextField.setEditable(true); defaultRouterTextField.setBackground(Color.white); } /** This method is called from within the constructor to * initialize the form. */ public void initComponents() { /***************** The main frame ***************************************/ // width, height this.setSize(560,370); Container container=this.getContentPane(); container.setLayout(new BoxLayout(getContentPane(), 1)); container.setBackground(containerBackGroundColor); this.setLocation(0,0); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { new AlertInstantMessaging("Your changes will not be checked: use the Submit button!!!", JOptionPane.WARNING_MESSAGE); hideFrame(); } }); /****************** The components **********************************/ firstPanel=new JPanel(); firstPanel.setBorder(BorderFactory.createEmptyBorder(15,4,15,4)); // If put to False: we see the container's background firstPanel.setOpaque(false); //rows, columns, horizontalGap, verticalGap firstPanel.setLayout( new GridLayout(11,2,2,2) ); container.add(firstPanel); outboundProxyAddressLabel=new JLabel("Outbound proxy IP address:"); outboundProxyAddressLabel.setForeground(Color.black); outboundProxyAddressTextField = new JTextField(20); outboundProxyAddressLabel.setBorder(labelBorder); outboundProxyAddressLabel.setOpaque(true); outboundProxyAddressLabel.setBackground(labelBackGroundColor); firstPanel.add(outboundProxyAddressLabel);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -