WelcomeFrame.java~27~
资源名称:Java.rar [点击查看]
上传用户:liming9091
上传日期:2014-10-27
资源大小:3376k
文件大小:3k
源码类别:
Java编程
开发平台:
Java
- package stumanage;
- import javax.swing.*;
- import java.awt.*;
- import sun.awt.image.*;
- /**
- * <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();
- 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(0, 0));
- 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(" 个人信息管理");
- jButton2.setToolTipText(" 选课信息管理"); jButton2.setText(" 选课信息管理");
- jButton3.setToolTipText("奖励信息管理"); jButton3.setText("奖励信息管理");
- jButton4.setToolTipText("职务信息管理"); jButton4.setText("职务信息管理"); this.getContentPane().add(jPanel1, BorderLayout.CENTER);
- jPanel1.add(jPanel2, BorderLayout.EAST);
- jPanel2.add(jButton1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
- jPanel2.add(jButton2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(9, 0, 0, 0), 0, 0));
- jPanel2.add(jButton3, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0)); jPanel2.add(jButton4, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 10, 0), -1, 0));
- }
- class MyPanel
- extends JPanel {
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- imageIcon1.paintIcon(this, g, 0, 0);
- }
- }
- }