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

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.   public WelcomeFrame() {
  26.     try {
  27.       jbInit();
  28.     }
  29.     catch (Exception e) {
  30.       e.printStackTrace();
  31.     }
  32.   }
  33.   public static void main(String[] args) {
  34.     WelcomeFrame welcomeFrame = new WelcomeFrame();
  35.     welcomeFrame.pack();
  36.     welcomeFrame.show();
  37.   }
  38.   private void jbInit() throws Exception {
  39.     imageIcon1.setDescription("beautiful.jpg");
  40.     imageIcon1.setImageObserver(this);
  41.     jPanel1.setLayout(borderLayout1);
  42.     jPanel1.setMinimumSize(new Dimension(600, 400));
  43.     jPanel1.setPreferredSize(new Dimension(600, 420));
  44.     this.setLocale(java.util.Locale.getDefault());
  45.     this.setResizable(true);
  46.     this.setSize(new Dimension(747, 396));
  47.     this.setState(Frame.NORMAL);
  48.     jPanel2.setBackground(UIManager.getColor("RadioButtonMenuItem.selectionBackground"));
  49.     jPanel2.setForeground(Color.black);
  50.     jPanel2.setMinimumSize(new Dimension(100, 30));
  51.     jPanel2.setPreferredSize(new Dimension(100, 400));
  52.     jPanel2.setLayout(gridBagLayout1);
  53.     jButton1.setToolTipText(" 个人信息管理");
  54.     jButton1.setText(" 个人信息管理");
  55.     jButton2.setToolTipText(" 选课信息管理");
  56.     jButton2.setText(" 选课信息管理");
  57.     jButton3.setToolTipText("奖励信息管理");
  58.     jButton3.setText("奖励信息管理");
  59.     jButton4.setToolTipText("职务信息管理");
  60.     jButton4.setText("职务信息管理");
  61.     jButton4.addActionListener(new WelcomeFrame_jButton4_actionAdapter(this));
  62.     this.getContentPane().add(jPanel1, BorderLayout.CENTER);
  63.     jPanel1.add(jPanel2, BorderLayout.EAST);
  64.     jPanel2.add(jButton1,                        new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
  65.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  66.     jPanel2.add(jButton2,                  new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
  67.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(9, 0, 0, 0), 0, 0));
  68.     jPanel2.add(jButton3,            new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
  69.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
  70.     jPanel2.add(jButton4,       new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0
  71.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 10, 0), 12, 0));
  72.   }
  73.   class MyPanel
  74.       extends JPanel {
  75.     public void paintComponent(Graphics g) {
  76.       super.paintComponent(g);
  77.       imageIcon1.paintIcon(this, g, 0, 0);
  78.      }
  79.   }
  80.   void jButton4_actionPerformed(ActionEvent e) {
  81.     MainFrame.main( null );
  82.   }
  83. }
  84. class WelcomeFrame_jButton4_actionAdapter implements java.awt.event.ActionListener {
  85.   WelcomeFrame adaptee;
  86.   WelcomeFrame_jButton4_actionAdapter(WelcomeFrame adaptee) {
  87.     this.adaptee = adaptee;
  88.   }
  89.   public void actionPerformed(ActionEvent e) {
  90.     adaptee.jButton4_actionPerformed(e);
  91.   }
  92. }