📄 appframe.java
字号:
package cq_result_trans.application;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import com.borland.jbcl.layout.*;
import java.net.SocketException;
import javax.swing.event.*;
public class AppFrame extends JFrame{
//我的变量
DemoManger demoManger;
//---------------------------------------------------------------这是一个无奈的做法
RoutineResultPanel routineResultPanel = new RoutineResultPanel();
CQResultTransPanel cqResultTransPanel = new CQResultTransPanel();
GroupResultPanel groupResultPanel = new GroupResultPanel();
//--------------------------------------------------------------------------
JPanel contentPane;
JToolBar jToolBar = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1;
ImageIcon image2;
ImageIcon image3;
JPanel observerPanel = new JPanel();
Border border1;
JPanel settingPanel = new JPanel();
Border border2;
TitledBorder titledBorder1;
JLabel jLabel1 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel2 = new JLabel();
JTextField jTextField2 = new JTextField();
JLabel jLabel3 = new JLabel();
JTextField jTextField3 = new JTextField();
JLabel jLabel4 = new JLabel();
JTextField jTextField4 = new JTextField();
JLabel jLabel6 = new JLabel();
JTextField jTextField6 = new JTextField();
JLabel jLabel7 = new JLabel();
JTextField jTextField7 = new JTextField();
ButtonGroup buttonGroup1 = new ButtonGroup();
JPanel radioButtonPanel = new JPanel();
Border border3;
TitledBorder titledBorder2;
JRadioButton setRandomPositionButton = new JRadioButton();
JRadioButton setFixPositionButton = new JRadioButton();
JButton startButton = new JButton();
JPanel selectPanel = new JPanel();
BorderLayout borderLayout2 = new BorderLayout();
JPanel parentPanel = new JPanel();
ButtonGroup buttonGroup2 = new ButtonGroup();
JRadioButton groupInitButton = new JRadioButton();
JRadioButton routineButton = new JRadioButton();
JRadioButton cqResultTransButton = new JRadioButton();
VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
JButton clearButton = new JButton();
TitledBorder titledBorder3;
JButton resetButton = new JButton();
JRadioButton groupResultButton = new JRadioButton();
Border border4;
TitledBorder titledBorder4;
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JPanel jPanel3 = new JPanel();
GridLayout gridLayout1 = new GridLayout();
BorderLayout borderLayout1 = new BorderLayout();
CardLayout cardLayout1 = new CardLayout();
BorderLayout borderLayout3 = new BorderLayout();
BorderLayout borderLayout4 = new BorderLayout();
JScrollPane jScrollPane1 = new JScrollPane();
JTable groupTable = new JTable();
GridBagLayout gridBagLayout2 = new GridBagLayout();
BorderLayout borderLayout5 = new BorderLayout();
GridBagLayout gridBagLayout3 = new GridBagLayout();
VerticalFlowLayout verticalFlowLayout2 = new VerticalFlowLayout();
GridBagLayout gridBagLayout1 = new GridBagLayout();
//Construct the frame
public AppFrame() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
image1 = new ImageIcon( cq_result_trans.application.AppFrame.class.
getResource( "openFile.png" ) );
image2 = new ImageIcon( cq_result_trans.application.AppFrame.class.
getResource( "closeFile.png" ) );
image3 = new ImageIcon( cq_result_trans.application.AppFrame.class.
getResource( "help.png" ) );
contentPane = ( JPanel )this.getContentPane();
border1 = BorderFactory.createBevelBorder( BevelBorder.LOWERED,
Color.white, Color.white, new Color( 115, 114, 105 ),
new Color( 165, 163, 151 ) );
border2 = new EtchedBorder( EtchedBorder.RAISED, Color.white,
new Color( 165, 163, 151 ) );
titledBorder1 = new TitledBorder( BorderFactory.createEtchedBorder(
Color.white, new Color( 165, 163, 151 ) ), "Initialization" );
border3 = BorderFactory.createEmptyBorder();
titledBorder2 = new TitledBorder( BorderFactory.createEtchedBorder(
Color.white, new Color( 165, 163, 151 ) ), "Node position setting" );
titledBorder3 = new TitledBorder( "" );
border4 = BorderFactory.createEtchedBorder( Color.white,
new Color( 165, 163, 151 ) );
titledBorder4 = new TitledBorder( border4, "FunctionSelect" );
contentPane.setLayout(borderLayout1 );
this.setDefaultCloseOperation( DISPOSE_ON_CLOSE );
this.setSize( new Dimension( 800, 600 ) );
this.setTitle( "连续查询结果的传输模拟" );
jButton1.setIcon( image1 );
jButton1.setToolTipText( "<html>从外部读取<br>Property</br>文件</html>" );
jButton2.setIcon( image2 );
jButton2.setToolTipText( "Close File" );
jButton3.setIcon( image3 );
jButton3.addActionListener( new java.awt.event.ActionListener() {
public void actionPerformed( ActionEvent e ) {
jButton3_actionPerformed( e );
}
} );
jButton3.setToolTipText( "Help" );
observerPanel.setBorder( null );
observerPanel.setPreferredSize(new Dimension(30, 170) );
observerPanel.setLayout( borderLayout2 );
jToolBar.setBorder( BorderFactory.createEtchedBorder() );
jToolBar.setOpaque( true );
jToolBar.setFloatable( false );
settingPanel.setBorder( titledBorder1 );
settingPanel.setLayout(gridLayout1 );
jLabel1.setText("<html>Range value<br>(range>15)</br></html>" );
jTextField1.setPreferredSize(new Dimension(15, 21));
jTextField1.setText( "" );
jLabel2.setText( "<html>Valid range<br>(validRange>15)</br></html>" );
jLabel3.setText("<html>HelloBroadcast<br>Time(ms)</br></html>" );
jTextField3.setPreferredSize(new Dimension(15, 21));
jTextField3.setText( "" );
jLabel4.setText( "<html>UpdatePosition<br>Time(ms)</br></html>" );
jTextField4.setPreferredSize(new Dimension(15, 21));
jTextField4.setText( "" );
jLabel6.setText( "RM Time(ms)" );
jTextField6.setPreferredSize(new Dimension(15, 21));
jTextField6.setText( "" );
jLabel7.setText( "Delay Time(ms)" );
jTextField7.setPreferredSize(new Dimension(15, 21));
jTextField7.setText( "" );
radioButtonPanel.setBorder( titledBorder2 );
radioButtonPanel.setLayout(verticalFlowLayout2 );
setRandomPositionButton.setText("Random position" );
setFixPositionButton.setSelected( true );
setFixPositionButton.setText("Fixation position" );
startButton.setText( "Start" );
startButton.addActionListener( new java.awt.event.ActionListener() {
public void actionPerformed( ActionEvent e ) {
startButton_actionPerformed( e );
}
} );
selectPanel.setBorder( titledBorder4 );
selectPanel.setPreferredSize( new Dimension( 120, 10 ) );
selectPanel.setLayout( verticalFlowLayout1 );
parentPanel.setLayout(cardLayout1 );
groupInitButton.setSelected( true );
groupInitButton.setText( "GroupInit" );
routineButton.setText( "Routine" );
cqResultTransButton.setText( "CQResultTrans" );
verticalFlowLayout1.setAlignment( VerticalFlowLayout.MIDDLE );
verticalFlowLayout1.setVgap( 5 );
clearButton.setText( "Clear" );
clearButton.addActionListener( new java.awt.event.ActionListener() {
public void actionPerformed( ActionEvent e ) {
clearButton_actionPerformed( e );
}
} );
resetButton.setText( "Reset" );
resetButton.addActionListener( new java.awt.event.ActionListener() {
public void actionPerformed( ActionEvent e ) {
resetButton_actionPerformed( e );
}
} );
groupResultButton.setText( "GroupResult" );
parentPanel.setPreferredSize(new Dimension(721, 210));
jPanel1.setLayout(gridBagLayout3);
jPanel2.setLayout(gridBagLayout2);
jPanel3.setLayout(gridBagLayout1);
jTextField2.setPreferredSize(new Dimension(15, 21));
groupResultPanel.setLayout(borderLayout4);
groupTable.setDoubleBuffered(true);
groupTable.setRowHeight(18);
groupTable.setRowSelectionAllowed(false);
radioButtonPanel.add(setRandomPositionButton, null);
radioButtonPanel.add( setFixPositionButton, null );
jPanel3.add(resetButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(14, 11, 13, 0), 2, -3));
jPanel3.add(startButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(14, 0, 13, 0), 8, -3));
jPanel3.add(clearButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(14, 14, 13, 5), 6, -3));
jPanel3.add(radioButtonPanel, new GridBagConstraints(0, 0, 3, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 0, 0, 5), 90, 0));
settingPanel.add(jPanel1, null);
jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 6, 0, 0), 14, -1));
jPanel1.add(jTextField1, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(8, 11, 12, 30), 13, -2));
jPanel1.add(jLabel3, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(19, 6, 0, 0), 1, 3));
jPanel1.add(jTextField3, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(19, 11, 16, 30), 13, -2));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -