📄 window00.java
字号:
package view;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import view.Window02;
public class Window00 extends JFrame implements ActionListener,WindowListener {
String[] colorNames = {"red","blue","green","black","yellow","pink","white","orange"};
Color[] colors = {Color.RED,Color.BLUE,Color.GREEN,Color.BLACK,Color.YELLOW,Color.PINK,Color.WHITE,Color.ORANGE};
public void xWindow(){
setTitle("请选择");
Container container = this.getContentPane();
JPanel jp1=new JPanel();
JButton button01=new JButton("点歌");
JButton button02=new JButton("后台");
jp1.add(button01);
jp1.add(button02);
addWindowListener(this);
button01.addActionListener(this);
button02.addActionListener(this);
BorderLayout bl = new BorderLayout();
jp1.setLayout(new FlowLayout());
container.add(jp1);
button01.setBackground(colors[5]);
button02.setBackground(colors[2]);
setVisible(true);
pack();
}
public static void main(String[] args){
Window00 wd=new Window00();
wd.xWindow();
}
public void actionPerformed(ActionEvent arg0) {
if(arg0.getActionCommand().equals("点歌")){
Window02 wi=new Window02();
wi.dgWindow();
}
if(arg0.getActionCommand().equals("后台")){
Window01 win=new Window01();
win.dWindow();
}
}
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowClosing(WindowEvent arg0) {
System.exit(0);
}
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -