📄 mainwindow.java
字号:
package chat.client;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class MainWindow extends JFrame{
MainPanel mp;
LoginPanel lp;
RegisterPanel rp;
OnlinePanel op;
CardLayout cl;
public MainWindow(){
cl = new CardLayout();
mp = new MainPanel();
lp = new LoginPanel();
rp = new RegisterPanel();
op = new OnlinePanel();
this.setLayout(cl);
this.add(mp, "mp");
this.add(lp, "lp");
this.add(rp, "rp");
this.add(op, "op");
this.setSize(mp.getWidth(), mp.getHeight());
this.setVisible(true);
}
public void show(String name){
if(name.equals("mp")) {
this.setSize(mp.getWidth(), mp.getHeight());
}else if(name.equals("lp")) {
this.setSize(lp.getWidth(), lp.getHeight());
}else if(name.equals("rp")){
this.setSize(rp.getWidth(), rp.getHeight());
}else{
this.setSize(op.getWidth(), op.getHeight());
}
cl.show(this.getContentPane(), name);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -