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

📄 stockpaneloper.java

📁 好的超市源码供大家下载
💻 JAVA
字号:
package view.panel.subpaneloper;

import javax.swing.JOptionPane;

import view.com.CheckInputText;
import view.panel.subpanel.GetStockPanel;
import vo.StockProductVo;

/**
 * 进货面板的简单操作
 * @author linfeng
 *
 */
public class StockPanelOper extends GetStockPanel{

  /**
   * 初始化各种文本框
   */
  public static void initiaTextValue() {
    product_id.setText("");
    product_name.setText("");
    product_price.setText("");
    stock_num.setText("");
  }
  
  /**
   * 对用户输入的文本框的值进行核对
   * @return 
   */
  public static boolean checkInputValue() {
    CheckInputText check = new CheckInputText();
    if (check.checkInputIsNull(product_id.getText())) {
      JOptionPane.showMessageDialog(null, "商品编号不能为空", "message",
          JOptionPane.YES_OPTION);
      product_id.requestFocus();
      return false;
    }
    if (check.checkInputIsNull(product_name.getText())) {
      JOptionPane.showMessageDialog(null, "商品名称不能为空", "message",
          JOptionPane.YES_OPTION);
      product_name.requestFocus();
      return false;
    }
    if (check.checkInputIsNull(product_price.getText())) {
      JOptionPane.showMessageDialog(null, "商品价格不能为空", "message",
          JOptionPane.YES_OPTION);
      product_price.requestFocus();
      return false;
    }
    if (check.checkInputIsNull(stock_num.getText())) {
      JOptionPane.showMessageDialog(null, "进货数量不能为空", "message",
          JOptionPane.YES_OPTION);
      stock_num.requestFocus();
      return false;
    }
    return true;
  }
  
  /**
   * 根据进货面板商品编号输入框的值获得StockProductVo对象
   * @return value StockProductVo对象
   */
  public static StockProductVo getInputTextValue() {
    StockProductVo value;
    int productId = Integer.parseInt(product_id.getText().trim());
    String productName = product_name.getText();
    String productType = product_type.getSelectedItem().toString();
    Double productPrice = Double.parseDouble(product_price.getText());
    int stockNum = Integer.parseInt(stock_num.getText().trim());
    String stockDate = txtStockDate.getSelectedItem().toString().trim();

    value = new StockProductVo(productId, productName, productType, productPrice, stockNum, stockDate);
    return value;
  }

}

⌨️ 快捷键说明

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