WelcomeFrame.java~32~
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:4k
源码类别:

Java编程

开发平台:

Java

  1. package stumanage;
  2. import javax.swing.*;
  3. import java.awt.*;
  4. import sun.awt.image.*;
  5. import java.awt.event.*;
  6. /**
  7.  * <p>Title: </p>
  8.  * <p>Description: </p>
  9.  * <p>Copyright: Copyright (c) 2003</p>
  10.  * <p>Company: </p>
  11.  * @author not attributable
  12.  * @version 1.0
  13.  */
  14. public class WelcomeFrame
  15.     extends JFrame {
  16.   JPanel jPanel1 = new MyPanel();
  17.   ImageIcon imageIcon1 = new ImageIcon("beautiful.jpg");
  18.   BorderLayout borderLayout1 = new BorderLayout();
  19.   JPanel jPanel2 = new JPanel();
  20.   GridBagLayout gridBagLayout1 = new GridBagLayout();
  21.   JButton jButton1 = new JButton();
  22.   JButton jButton2 = new JButton();
  23.   JButton jButton3 = new JButton();
  24.   JButton jButton4 = new JButton();
  25.   JButton jButton5 = new JButton();
  26.   public WelcomeFrame() {
  27.     try {
  28.       jbInit();
  29.     }
  30.     catch (Exception e) {
  31.       e.printStackTrace();
  32.     }
  33.   }
  34.   public static void main(String[] args) {
  35.     WelcomeFrame welcomeFrame = new WelcomeFrame();
  36.     welcomeFrame.pack();
  37.     welcomeFrame.show();
  38.   }
  39.   private void jbInit() throws Exception {
  40.     imageIcon1.setDescription("beautiful.jpg");
  41.     imageIcon1.setImageObserver(this);
  42.     jPanel1.setLayout(borderLayout1);
  43.     jPanel1.setMinimumSize(new Dimension(600, 400));
  44.     jPanel1.setPreferredSize(new Dimension(600, 420));
  45.     this.setLocale(java.util.Locale.getDefault());
  46.     this.setResizable(true);
  47.     this.setSize(new Dimension(747, 396));
  48.     this.setState(Frame.NORMAL);
  49.     jPanel2.setBackground(UIManager.getColor("RadioButtonMenuItem.selectionBackground"));
  50.     jPanel2.setForeground(Color.black);
  51.     jPanel2.setMinimumSize(new Dimension(100, 30));
  52.     jPanel2.setPreferredSize(new Dimension(100, 400));
  53.     jPanel2.setLayout(gridBagLayout1);
  54.     jButton1.setToolTipText(" 个人信息管理");
  55.     jButton1.setText(" 个人信息管理");
  56.     jButton1.addActionListener(new WelcomeFrame_jButton1_actionAdapter(this));
  57.     jButton2.setToolTipText(" 选课信息管理");
  58.     jButton2.setText(" 选课信息管理");
  59.     jButton3.setToolTipText("奖励信息管理");
  60.     jButton3.setText("奖励信息管理");
  61.     jButton4.setToolTipText("职务信息管理");
  62.     jButton4.setText("职务信息管理");
  63.     jButton4.addActionListener(new WelcomeFrame_jButton4_actionAdapter(this));
  64.     jButton5.setToolTipText("退出系统");
  65.     jButton5.setText("退出系统");
  66.     this.getContentPane().add(jPanel1, BorderLayout.CENTER);
  67.     jPanel1.add(jPanel2, BorderLayout.EAST);
  68.     jPanel2.add(jButton1,                        new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
  69.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  70.     jPanel2.add(jButton2,                     new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
  71.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(9, 0, 0, 21), 0, 0));
  72.     jPanel2.add(jButton3,              new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
  73.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 0, 0, 10), 0, 0));
  74.     jPanel2.add(jButton4,       new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
  75.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 10, 0), 12, 0));
  76.     jPanel2.add(jButton5,        new GridBagConstraints(1, 4, 2, 1, 0.0, 0.0
  77.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(13, 0, 0, 11), 21, 0));
  78.   }
  79.   class MyPanel
  80.       extends JPanel {
  81.     public void paintComponent(Graphics g) {
  82.       super.paintComponent(g);
  83.       imageIcon1.paintIcon(this, g, 0, 0);
  84.      }
  85.   }
  86.   void jButton4_actionPerformed(ActionEvent e) {
  87.     MainFrame.main( null );
  88.     this.hide();
  89.   }
  90.   void jButton1_actionPerformed(ActionEvent e) {
  91.     MainFrame.main( null );
  92.     this.hide();
  93.   }
  94. }
  95. class WelcomeFrame_jButton4_actionAdapter implements java.awt.event.ActionListener {
  96.   WelcomeFrame adaptee;
  97.   WelcomeFrame_jButton4_actionAdapter(WelcomeFrame adaptee) {
  98.     this.adaptee = adaptee;
  99.   }
  100.   public void actionPerformed(ActionEvent e) {
  101.     adaptee.jButton4_actionPerformed(e);
  102.   }
  103. }
  104. class WelcomeFrame_jButton1_actionAdapter implements java.awt.event.ActionListener {
  105.   WelcomeFrame adaptee;
  106.   WelcomeFrame_jButton1_actionAdapter(WelcomeFrame adaptee) {
  107.     this.adaptee = adaptee;
  108.   }
  109.   public void actionPerformed(ActionEvent e) {
  110.     adaptee.jButton1_actionPerformed(e);
  111.   }
  112. }