importjava.awt.*;importjava.awt.event.ActionEvent;importjavax.swing.*;importjavax.swing.border.Border;importcom.sun.java.swing.plaf.motif.MotifBorders.BevelBorder;publicc...
import java.awt.*;
import java.awt.event.ActionEvent;
import javax.swing.*;
import javax.swing.border.Border;
import com.sun.java.swing.plaf.motif.MotifBorders.BevelBorder;
public class KyodaiUI extends JFrame {
/**
*
*/
private static final long serialVersionUID = -5314855987766155386L;
public KyodaiUI() {
this.setSize(780,500); //将窗体的大小设定为780*500
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false); //窗体不能改变大小
this.setTitle("连连看"); //设置标题
JPanel toolBar = new JPanel();
toolBar.setPreferredSize(new Dimension(780,48));
toolBar.setBackground(Color.white);
JPanel actionPanel = new JPanel(); //新建JPanel型的控件
actionPanel.setBackground(Color.yellow); //设置背景色
actionPanel.setPreferredSize(new Dimension(160,380)); //设置大小
JPanel contentPanel = new JPanel();
contentPanel.setBackground(Color.blue);
contentPanel.setPreferredSize(new Dimension(620,380));
this.getContentPane().add(toolBar,BorderLayout.NORTH);
this.getContentPane().add(actionPanel,BorderLayout.EAST);
this.getContentPane().add(contentPanel,BorderLayout.CENTER);
}
public static void main(String[] args)throws HeadlessException {
KyodaiUI kyodaiUI = new KyodaiUI();
kyodaiUI.show();
}
public void actionPerformed(ActionEvent e) {
Object about;
if (e.getSource() == about) {
JOptionPane.showMessageDialog(this,"我的大名","关于",
JOptionPane.INFORMATION_MESSAGE);
return ;
}
}
展开