📄 wuziqiclientframe.java~1~
字号:
package wuziqiclient;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;public class wuziqiClientFrame extends JFrame { JPanel contentPane; XYLayout xYLayout1 = new XYLayout(); JSplitPane jSplitPane1 = new JSplitPane(); JPanel jPanel1 = new JPanel(); JPanel jPanel2 = new JPanel(); XYLayout xYLayout2 = new XYLayout(); JList userList = new JList(); JScrollPane jScrollPane1 = new JScrollPane(); JTextArea chatTextArea = new JTextArea(); JLabel IPLabel = new JLabel(); JTextField InputIp = new JTextField(); JButton ConnectGame = new JButton(); JButton CreateGame = new JButton(); JButton JoinGame = new JButton(); JButton GiveUpGame = new JButton(); JButton CloseGame = new JButton(); JComboBox userChoice = new JComboBox(); JTextField userwords = new JTextField(); //Construct the frame public wuziqiClientFrame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); jSplitPane1.setDebugGraphicsOptions(DebugGraphics.BUFFERED_OPTION); jSplitPane1.setBottomComponent(jPanel2); jSplitPane1.setContinuousLayout(false); jSplitPane1.setDividerSize(5); contentPane.setLayout(xYLayout1); this.setSize(new Dimension(613, 491)); this.setTitle("五子棋客户端"); jPanel1.setLayout(xYLayout2); chatTextArea.setToolTipText(""); chatTextArea.setText(""); jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); IPLabel.setText("IP"); InputIp.setText("localhost"); ConnectGame.setToolTipText(""); ConnectGame.setText("连接主机"); CreateGame.setText("创建游戏"); JoinGame.setText("加入游戏"); GiveUpGame.setText("放弃游戏"); CloseGame.setText("关闭程序"); userwords.setText(""); contentPane.add(jSplitPane1, new XYConstraints(19, 18, 560, 400)); jSplitPane1.add(jPanel1, JSplitPane.LEFT); jPanel1.add(userList, new XYConstraints(3, 5, 133, 127)); jPanel1.add(jScrollPane1, new XYConstraints(3, 139, 138, 261)); jScrollPane1.getViewport().add(chatTextArea, null); jSplitPane1.add(jPanel2, JSplitPane.RIGHT); contentPane.add(InputIp, new XYConstraints(47, 424, 101, 23)); contentPane.add(IPLabel, new XYConstraints(14, 424, 23, 19)); contentPane.add(userChoice, new XYConstraints(41, 457, 103, 25)); contentPane.add(userwords, new XYConstraints(156, 456, 431, 28)); contentPane.add(ConnectGame, new XYConstraints(163, 429, 78, 24)); contentPane.add(CreateGame, new XYConstraints(255, 429, -1, -1)); contentPane.add(JoinGame, new XYConstraints(343, 429, -1, -1)); contentPane.add(GiveUpGame, new XYConstraints(427, 430, -1, -1)); contentPane.add(CloseGame, new XYConstraints(509, 430, -1, -1)); jSplitPane1.setDividerLocation(140); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -