⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 containview.java

📁 javaGUI编写的人事管理系统(毕业学生答辩可参考)
💻 JAVA
字号:
package project;

import javax.swing.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class ContainView
    extends JPanel {

  private int num;
  private int panel_height;
  private JPanel[] PaneArray = null;
  private Add_Btn_view[] subBtn = null;
  private String[] label_name = null;
  private int button_height = 30;

  public ContainView(int height, int num, Add_Btn_view[] subBtn,
                     String[] label_name) {
    super();
    this.panel_height = height;
    this.num = num;
    this.subBtn = subBtn;
    this.label_name = label_name;
    initialize();
    createPanel();

  }

  private void initialize() {
    if (num * button_height > panel_height) {
      panel_height = num * button_height;
    }
    this.setSize(300, panel_height);
    this.setLayout(null);
    this.addComponentListener(new java.awt.event.ComponentAdapter() {
      public void componentResized(java.awt.event.ComponentEvent e) {
        //System.out.println("componentResized()"); // TODO Auto-generated Event stub componentResized()
        panel_resie();
      }
    });
  }

  private void createPanel() {
    PaneArray = new BaseView[num];

    for (int i = 0; i < PaneArray.length; i++) {

      PaneArray[i] = new BaseView(PaneArray,
                                  this.getHeight() -
                                  PaneArray.length * button_height,
                                  this.subBtn[i], this.label_name[i]);
      PaneArray[i].setSize(200, 30);
      if (i == 0) {
        PaneArray[i].setLocation(0, 0);
      }
      else {
        PaneArray[i].setLocation(0,
                                 PaneArray[i - 1].getLocation().y + PaneArray[i -
                                 1].getHeight());
      }
      this.add(PaneArray[i]);
    }

  }

  public BaseView[] get_BaseView() {
    return (BaseView[]) PaneArray;
  }

  private void panel_resie() {
    BaseView.call_resize( (BaseView[]) PaneArray,
                         this.getHeight() - PaneArray.length * button_height);
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -