📄 mainframe.java
字号:
package liaotian;/* * MainFrame.java * * Created on 2006年11月12日, 下午11:29 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. *//** * * @author xingwang */import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.util.*;public class MainFrame extends JDialog implements ActionListener{ JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); JPanel p3 = new JPanel(); JPanel p4 = new JPanel(); JButton ok1 = new JButton("登录"); JButton ok2 = new JButton("注册"); JButton cancel = new JButton("退出"); public MainFrame() { setModal(false); setBackground(Color.LIGHT_GRAY); Container contentPane = this.getContentPane(); contentPane.setLayout(new GridLayout(4,1)); p2.add(ok1); p2.add(ok2); p3.add(cancel); ok1.addActionListener(this); ok2.addActionListener(this); cancel.addActionListener(this); contentPane.add(p1); contentPane.add(p2); contentPane.add(p3); contentPane.add(p4); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(300,200); setTitle("零点聊天室"); setResizable(false); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == ok1 ) { dispose(); new LoginWindow(); } else if(e.getSource() == ok2) { dispose(); new RegisterWindow(); } else if(e.getSource()== cancel) { dispose(); System.exit(0); } } public static void main(String args[]) { new MainFrame(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -