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

📄 salepanel.java~1~

📁 是适合于使用的管理系统 可以在现实中使用
💻 JAVA~1~
字号:
package mysiloer;

import java.awt.*;
import javax.swing.*;
import com.borland.jbcl.layout.BoxLayout2;
import java.awt.event.ActionEvent;
import java.util.Vector;

/**
 * <p>Title: MySiloer</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2005</p>
 * <p>Company: yskey</p>
 * @author 杨涛
 * @version 1.0
 */

public class SalePanel
    extends JPanel {
  private JSplitPane jSplitPane = new JSplitPane();
  private BorderLayout borderLayout1 = new BorderLayout();
  private JPanel jPanel1 = new JPanel();
  private JToggleButton materialButton = new JToggleButton();
  private JSplitPane jSplitPane1 = new JSplitPane();
  private BoxLayout2 boxLayout21 = new BoxLayout2();
  private JToggleButton productButton = new JToggleButton();
  private Component component2;
  private Component component3;
  private JPanel controlPanel = new JPanel();
  private JButton updateButton = new JButton();
  private FlowLayout flowLayout1 = new FlowLayout();
  private JButton selectButton = new JButton();
  private Component component4;
  private JLabel jLabel1 = new JLabel();
  private Component component1;
  private JPanel subPanel = new JPanel(new BorderLayout());
  private ImageIcon materialIcon = new ImageIcon(this.getClass().getResource(
      "material.jpg"));
  private ImageIcon productIcon = new ImageIcon(this.getClass().getResource(
      "product.jpg"));
  private ImageIcon selectIcon = new ImageIcon(this.getClass().getResource(
      "select.jpg"));
  private ImageIcon updateIcon = new ImageIcon(this.getClass().getResource(
      "update.jpg"));
  private int type;
  private JLabel label;
  private ButtonGroup buttonGroup1 = new ButtonGroup();
  public DataBase dataBase;
  public TablePanel tablePanel = new TablePanel();
  private JFrame frame;

  public SalePanel(JFrame frame, int type, DataBase dataBase) {
    try {
      this.type = type;
      this.dataBase = dataBase;
      if (this.dataBase == null) {
        this.dataBase = new DataBase();
      }
      this.frame = frame;
      jbInit();
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {
    component2 = Box.createVerticalStrut(64);
    component3 = Box.createVerticalStrut(97);
    component4 = Box.createHorizontalStrut(8);
    component1 = Box.createVerticalStrut(84);
    this.setLayout(borderLayout1);
    jSplitPane.setLeftComponent(jPanel1);
    materialButton.setMaximumSize(new Dimension(60, 60));
    materialButton.setMinimumSize(new Dimension(60, 60));
    materialButton.setToolTipText("原材料库");
    materialButton.setSelected(true);
    materialButton.setIcon(materialIcon);
    materialButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        materialButton_actionPerformed(e);
      }
    });
    jPanel1.setLayout(boxLayout21);
    boxLayout21.setAxis(BoxLayout.Y_AXIS);
    productButton.setMaximumSize(new Dimension(60, 60));
    productButton.setMinimumSize(new Dimension(60, 60));
    productButton.setPreferredSize(new Dimension(60, 60));
    productButton.setToolTipText("成品库");
    productButton.setIcon(productIcon);
    productButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        productButton_actionPerformed(e);
      }
    });
    jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
    updateButton.setMinimumSize(new Dimension(100, 40));
    updateButton.setPreferredSize(new Dimension(100, 40));
    updateButton.setMargin(new Insets(2, 2, 2, 2));
    updateButton.setVerticalTextPosition(AbstractButton.CENTER);
    updateButton.setText("更新库存");
    updateButton.setIcon(updateIcon);
    updateButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        updateButton_actionPerformed(e);
      }
    });
    controlPanel.setLayout(flowLayout1);
    selectButton.setMaximumSize(new Dimension(100, 40));
    selectButton.setMinimumSize(new Dimension(100, 40));
    selectButton.setPreferredSize(new Dimension(100, 40));
    selectButton.setMargin(new Insets(2, 2, 2, 2));
    selectButton.setText("查    询");
    selectButton.setIcon(selectIcon);
    selectButton.setVerticalTextPosition(AbstractButton.CENTER);
    selectButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        selectButton_actionPerformed(e);
      }
    });
    jLabel1.setText("                                              ");
    this.add(jSplitPane, BorderLayout.CENTER);
    jSplitPane.add(jPanel1, JSplitPane.TOP);
    jPanel1.add(component1, null);
    jPanel1.add(materialButton, null);
    jPanel1.add(component2, null);
    jPanel1.add(productButton, null);
    jPanel1.add(component3, null);
    jSplitPane.add(jSplitPane1, JSplitPane.BOTTOM);
    jSplitPane1.add(controlPanel, JSplitPane.TOP);
    controlPanel.add(selectButton, null);
    controlPanel.add(component4, null);
    controlPanel.add(jLabel1, null);
    controlPanel.add(updateButton, null);
    jSplitPane1.add(subPanel, JSplitPane.BOTTOM);
    if (type == Type.MATERIALMANAGE) {
      label = new JLabel(" 原材料管理页面", JLabel.LEFT);
    }
    else if (type == Type.PRODUCTMANAGE) {
      label = new JLabel(" 成品库管理页面", JLabel.LEFT);
    }
    label.setForeground(Color.blue);
    label.setFont(new Font("宋体", Font.BOLD, 15));
    subPanel.add(label, BorderLayout.NORTH);
    subPanel.add(tablePanel, BorderLayout.CENTER);
    buttonGroup1.add(materialButton);
    buttonGroup1.add(productButton);

  }

  private void selectButton_actionPerformed(ActionEvent e) {
    if (this.type == Type.MATERIALMANAGE) {
      JDialog selectDialog = new SiloOutSelectDialog(frame, this, true);
      selectDialog.setVisible(true);
    }
    else if (this.type == Type.PRODUCTMANAGE) {
//添加product成品库的页面的内容
        JDialog productSelectDialog = new ProductOutSelectDialog(frame, this, true);
        productSelectDialog.setVisible(true);
    }
  }

  void materialButton_actionPerformed(ActionEvent e) {
    setType(Type.MATERIALMANAGE);
    subPanel.remove(label);
    if (type == Type.MATERIALMANAGE) {
      label = new JLabel(" 原材料出库管理页面", JLabel.LEFT);
    }
    else if (type == Type.PRODUCTMANAGE) {
      label = new JLabel(" 成品出库库管理页面", JLabel.LEFT);
    }
    label.setForeground(Color.blue);
    label.setFont(new Font("宋体", Font.BOLD, 15));
    subPanel.add(label, BorderLayout.NORTH);
    resetTable();
    validate();
  }

  private void setType(int type) {
    this.type = type;
  }

  void productButton_actionPerformed(ActionEvent e) {
    setType(Type.PRODUCTMANAGE);
    subPanel.remove(label);
    if (type == Type.MATERIALMANAGE) {
      label = new JLabel(" 原材料出库管理页面", JLabel.LEFT);
    }
    else if (type == Type.PRODUCTMANAGE) {
      label = new JLabel(" 成品出库库管理页面", JLabel.LEFT);
    }
    label.setForeground(Color.blue);
    label.setFont(new Font("宋体", Font.BOLD, 15));
    subPanel.add(label, BorderLayout.NORTH);
    resetTable();
    validate();
  }

  void updateButton_actionPerformed(ActionEvent e) {
    if (this.type == Type.MATERIALMANAGE) {
      JDialog updateDialog = new SiloOutUpdateDialog(frame, this, true);
      updateDialog.setVisible(true);
    }
    else if (this.type == Type.PRODUCTMANAGE) {
//添加product成品页面的内容
      JDialog updateDialog = new ProductOutUpdateDialog(frame, this, true);
      updateDialog.setVisible(true);
    }
  }

  private void resetTable() {
    int rowCount = this.tablePanel.tbModel.getRowCount();
    int colCount = this.tablePanel.tbModel.getColumnCount();
    Vector colName = new Vector();
    for (int i = 0; i < rowCount; i++)
      this.tablePanel.tbModel.removeRow(0);
    for (int i = 0; i < rowCount; i++)
      colName.add(" ");
    this.tablePanel.tbModel.setColumnIdentifiers(colName);
  }
}

⌨️ 快捷键说明

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