📄 udptimeserverframe.java
字号:
package udptimeserver;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class UdpTimeServerFrame extends JFrame { JPanel contentPane; JLabel statusBar = new JLabel(); BorderLayout borderLayout1 = new BorderLayout(); JPanel jPanelCmd = new JPanel(); FlowLayout flowLayout1 = new FlowLayout(); JLabel jLabel1 = new JLabel(); JTextField TxtPort = new JTextField(); JButton Command = new JButton(); JPanel jPanelLog = new JPanel(); BorderLayout borderLayout2 = new BorderLayout(); JScrollPane jScrollPaneLog = new JScrollPane(); TitledBorder titledBorder1; JTextArea TxtLog = new JTextArea(); //Construct the frame public UdpTimeServerFrame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { contentPane = (JPanel) this.getContentPane(); titledBorder1 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(165, 163, 151)),"日志"); contentPane.setLayout(borderLayout1); this.setSize(new Dimension(400, 300)); this.setTitle("时钟服务器程序范例"); statusBar.setText(" "); jPanelCmd.setLayout(flowLayout1); jLabel1.setText("请输入时钟服务端口号:"); Command.setText("Start"); TxtPort.setText(" "); jPanelLog.setLayout(borderLayout2); jScrollPaneLog.setBorder(titledBorder1); TxtLog.setEditable(false); contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(jPanelCmd, BorderLayout.NORTH); jPanelCmd.add(jLabel1, null); jPanelCmd.add(TxtPort, null); jPanelCmd.add(Command, null); contentPane.add(jPanelLog, BorderLayout.CENTER); jPanelLog.add(jScrollPaneLog, BorderLayout.CENTER); jScrollPaneLog.getViewport().add(TxtLog, null); } //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 + -