WelcomeFrame.java
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:6k
源码类别:
Java编程
开发平台:
Java
- package stumanage;
- import javax.swing.*;
- import java.awt.*;
- import sun.awt.image.*;
- import java.awt.event.*;
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
- */
- public class WelcomeFrame
- extends JFrame {
- JPanel jPanel1 = new MyPanel();
- ImageIcon imageIcon1 = new ImageIcon("beautiful.jpg");
- BorderLayout borderLayout1 = new BorderLayout();
- JPanel jPanel2 = new JPanel();
- GridBagLayout gridBagLayout1 = new GridBagLayout();
- JButton jButton1 = new JButton();
- JButton jButton2 = new JButton();
- JButton jButton3 = new JButton();
- JButton jButton4 = new JButton();
- JButton jButton5 = new JButton();
- public WelcomeFrame() {
- try {
- jbInit();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- public static void main(String[] args) {
- WelcomeFrame welcomeFrame = new WelcomeFrame();
- welcomeFrame.pack();
- welcomeFrame.show();
- }
- private void jbInit() throws Exception {
- imageIcon1.setDescription("beautiful.jpg");
- imageIcon1.setImageObserver(this);
- jPanel1.setLayout(borderLayout1);
- jPanel1.setMinimumSize(new Dimension(600, 400));
- jPanel1.setPreferredSize(new Dimension(600, 420));
- this.setLocale(java.util.Locale.getDefault());
- this.setResizable(true);
- this.setSize(new Dimension(747, 396));
- this.setState(Frame.NORMAL);
- jPanel2.setBackground(UIManager.getColor("RadioButtonMenuItem.selectionBackground"));
- jPanel2.setForeground(Color.black);
- jPanel2.setMinimumSize(new Dimension(100, 30));
- jPanel2.setPreferredSize(new Dimension(100, 400));
- jPanel2.setLayout(gridBagLayout1);
- jButton1.setToolTipText(" 个人信息管理");
- jButton1.setText(" 个人信息管理");
- jButton1.addActionListener(new WelcomeFrame_jButton1_actionAdapter(this));
- jButton2.setToolTipText(" 选课信息管理");
- jButton2.setText(" 选课信息管理");
- jButton2.addActionListener(new WelcomeFrame_jButton2_actionAdapter(this));
- jButton3.setToolTipText("奖励信息管理");
- jButton3.setText("奖励信息管理");
- jButton3.addActionListener(new WelcomeFrame_jButton3_actionAdapter(this));
- jButton4.setToolTipText("职务信息管理");
- jButton4.setText("职务信息管理");
- jButton4.addActionListener(new WelcomeFrame_jButton4_actionAdapter(this));
- jButton5.setToolTipText("退出系统");
- jButton5.setText("退出系统");
- jButton5.addActionListener(new WelcomeFrame_jButton5_actionAdapter(this));
- this.getContentPane().add(jPanel1, BorderLayout.CENTER);
- jPanel1.add(jPanel2, BorderLayout.EAST);
- jPanel2.add(jButton1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
- jPanel2.add(jButton2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(9, 0, 0, 21), 0, 0));
- jPanel2.add(jButton3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 0, 0, 10), 0, 0));
- jPanel2.add(jButton5, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 11), 21, 0));
- jPanel2.add(jButton4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
- ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(9, 0, 13, 0), 12, 0));
- }
- class MyPanel
- extends JPanel {
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- imageIcon1.paintIcon(this, g, 0, 0);
- }
- }
- void jButton4_actionPerformed(ActionEvent e) {
- MainFrame.main( null );
- this.hide();
- MainFrame.jTabbedPane1.setSelectedComponent( MainFrame.jPanel4);
- }
- void jButton1_actionPerformed(ActionEvent e) {
- MainFrame.main( null );
- this.hide();
- }
- void jButton3_actionPerformed(ActionEvent e) {
- MainFrame.main( null );
- this.hide();
- MainFrame.jTabbedPane1.setSelectedComponent( MainFrame.jPanel3);
- }
- void jButton2_actionPerformed(ActionEvent e) {
- MainFrame.main( null );
- this.hide();
- MainFrame.jTabbedPane1.setSelectedComponent( MainFrame.jPanel2);
- }
- void jButton5_actionPerformed(ActionEvent e) {
- System.exit(0);
- }
- }
- class WelcomeFrame_jButton4_actionAdapter implements java.awt.event.ActionListener {
- WelcomeFrame adaptee;
- WelcomeFrame_jButton4_actionAdapter(WelcomeFrame adaptee) {
- this.adaptee = adaptee;
- }
- public void actionPerformed(ActionEvent e) {
- adaptee.jButton4_actionPerformed(e);
- }
- }
- class WelcomeFrame_jButton1_actionAdapter implements java.awt.event.ActionListener {
- WelcomeFrame adaptee;
- WelcomeFrame_jButton1_actionAdapter(WelcomeFrame adaptee) {
- this.adaptee = adaptee;
- }
- public void actionPerformed(ActionEvent e) {
- adaptee.jButton1_actionPerformed(e);
- }
- }
- class WelcomeFrame_jButton3_actionAdapter implements java.awt.event.ActionListener {
- WelcomeFrame adaptee;
- WelcomeFrame_jButton3_actionAdapter(WelcomeFrame adaptee) {
- this.adaptee = adaptee;
- }
- public void actionPerformed(ActionEvent e) {
- adaptee.jButton3_actionPerformed(e);
- }
- }
- class WelcomeFrame_jButton2_actionAdapter implements java.awt.event.ActionListener {
- WelcomeFrame adaptee;
- WelcomeFrame_jButton2_actionAdapter(WelcomeFrame adaptee) {
- this.adaptee = adaptee;
- }
- public void actionPerformed(ActionEvent e) {
- adaptee.jButton2_actionPerformed(e);
- }
- }
- class WelcomeFrame_jButton5_actionAdapter implements java.awt.event.ActionListener {
- WelcomeFrame adaptee;
- WelcomeFrame_jButton5_actionAdapter(WelcomeFrame adaptee) {
- this.adaptee = adaptee;
- }
- public void actionPerformed(ActionEvent e) {
- adaptee.jButton5_actionPerformed(e);
- }
- }