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

📄 dsextendpaneldata.java

📁 用JAVA编写的绘图程序 功能简介: 支持存储
💻 JAVA
字号:
package drawsmart.itsv.swing;

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import drawsmart.itsv.basic.DSComBoxDatePopup;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import drawsmart.itsv.framework.JDSSetupDataModelface;
import java.util.Date;
import java.util.Vector;

/**
 * <p>Title: 环节配置面板</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class DSExtendPanelData extends JPanel
    implements ActionListener {
  BorderLayout borderLayout1 = new BorderLayout();
  JTabbedPane jTabbedPane1 = new JTabbedPane();
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  BorderLayout borderLayout2 = new BorderLayout();
  JPanel jPanel3 = new JPanel();
  BorderLayout borderLayout3 = new BorderLayout();
  JScrollPane jScrollPane1 = new JScrollPane();
  Border border1;
  TitledBorder titledBorder1;
  JTextArea jTextArea1 = new JTextArea();
  BorderLayout borderLayout4 = new BorderLayout();
  JPanel jPanel4 = new JPanel();
  GridLayout gridLayout1 = new GridLayout();
  JPanel jPanel5 = new JPanel();
  JPanel jPanel6 = new JPanel();
  JLabel jLabel1 = new JLabel();
  //
  DSComBoxDatePopup jComboBox1 = new DSExtendComBoxDatePopup();
  JLabel jLabel2 = new JLabel();
  //
  DSComBoxDatePopup jComboBox2 = new DSExtendComBoxDatePopup();
  JPanel jPanel7 = new JPanel();
  BorderLayout borderLayout7 = new BorderLayout();
  Border border2;
  TitledBorder titledBorder2;
  JPanel jPanel11 = new JPanel();
  JButton jButton3 = new JButton();
  JLabel jLabel3 = new JLabel();
  JButton jButton4 = new JButton();
  FlowLayout flowLayout1 = new FlowLayout();
  FlowLayout flowLayout2 = new FlowLayout();
  JScrollPane jScrollPane2 = new JScrollPane();
  TitledBorder titledBorder3;
  TitledBorder titledBorder4;
  JList jList1 = new JList();
  TitledBorder titledBorder5;
  JPanel jPanel10 = new JPanel();
  JButton jButton2 = new JButton();
  JButton jButton1 = new JButton();
  JPanel jPanel8 = new JPanel();
  GridLayout gridLayout2 = new GridLayout();
  JPanel jPanel9 = new JPanel();
  JDSSetupDataModelface jDSSetupDataModelface;
  String sID;
  DSSetupDataPanel dSSetupDataPanel;
  Vector vector=new Vector();
  public DSExtendPanelData(JDSSetupDataModelface jDSSetupDataModelface,String sID,DSSetupDataPanel dSSetupDataPanel) {
    this.jDSSetupDataModelface=jDSSetupDataModelface;
    this.sID=sID;
    this.dSSetupDataPanel=dSSetupDataPanel;
    try {
      jbInit();
      iniEvent();
      iniComponent();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }

  void jbInit() throws Exception {
    border1 = BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140));
    titledBorder1 = new TitledBorder(border1,"环节描述");
    border2 = BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140));
    titledBorder2 = new TitledBorder(border2,"当前环节责任人");
    titledBorder3 = new TitledBorder("");
    titledBorder4 = new TitledBorder("");
    titledBorder5 = new TitledBorder("");
    this.setLayout(borderLayout1);
    jPanel1.setLayout(borderLayout2);
    jPanel3.setLayout(borderLayout3);
    jPanel3.setBorder(titledBorder1);
    jPanel3.setPreferredSize(new Dimension(20, 200));
    jPanel2.setLayout(borderLayout4);
    jPanel4.setPreferredSize(new Dimension(10, 70));
    jPanel4.setRequestFocusEnabled(true);
    jPanel4.setLayout(gridLayout1);
    gridLayout1.setRows(2);
    jPanel5.setBorder(BorderFactory.createEtchedBorder());
    jPanel5.setDebugGraphicsOptions(0);
    jPanel5.setLayout(flowLayout1);
    jPanel6.setBorder(BorderFactory.createEtchedBorder());
    jPanel6.setLayout(flowLayout2);
    jLabel1.setPreferredSize(new Dimension(100, 20));
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setText("当前环节开始时间");
    jLabel2.setPreferredSize(new Dimension(100, 16));
    jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel2.setText("当前环节结束时间");
    jPanel7.setLayout(borderLayout7);
    jPanel7.setBorder(titledBorder2);
    jButton3.setText("确定");
    jLabel3.setText("               ");
    jButton4.setText("取消");
    jScrollPane2.setBorder(titledBorder5);
    jScrollPane2.setPreferredSize(new Dimension(220, 4));
    jButton2.setText("删除责任人");
    jButton1.setText("添加责任人");
    jPanel8.setLayout(gridLayout2);
    gridLayout2.setRows(6);
    jComboBox1.setPreferredSize(new Dimension(100, 22));
    jComboBox2.setPreferredSize(new Dimension(100, 22));
    this.add(jTabbedPane1,  BorderLayout.NORTH);
    jTabbedPane1.add(jPanel1,     "基本描述");
    jPanel1.add(jPanel3,  BorderLayout.CENTER);
    jPanel3.add(jScrollPane1, BorderLayout.CENTER);
    jScrollPane1.getViewport().add(jTextArea1, null);
    jTabbedPane1.add(jPanel2,   "业务信息");
    jPanel2.add(jPanel4, BorderLayout.NORTH);
    jPanel4.add(jPanel5, null);
    jPanel5.add(jLabel1, null);
    jPanel5.add(jComboBox1, null);
    jPanel4.add(jPanel6, null);
    jPanel6.add(jLabel2, null);
    jPanel6.add(jComboBox2, null);
    jPanel2.add(jPanel7, BorderLayout.CENTER);
    jPanel7.add(jScrollPane2,  BorderLayout.WEST);
    jPanel7.add(jPanel8,  BorderLayout.EAST);
    jPanel8.add(jPanel9, null);
    jPanel9.add(jButton1, null);
    jPanel8.add(jPanel10, null);
    jPanel10.add(jButton2, null);
    jScrollPane2.getViewport().add(jList1, null);
    this.add(jPanel11,  BorderLayout.CENTER);
    jPanel11.add(jButton3, null);
    jPanel11.add(jLabel3, null);
    jPanel11.add(jButton4, null);
  }

  /**
   * 添加事件
   */
  void iniEvent()
  {
    jButton1.addActionListener(this);
    jButton2.addActionListener(this);
    jButton3.addActionListener(this);
    jButton4.addActionListener(this);
  }

  void iniComponent()
  {
    String str1=jDSSetupDataModelface.getDescribe(sID);
    jTextArea1.setText(str1);

    String str2=jDSSetupDataModelface.getStartDate(sID);
    if (str2!=null && !str2.trim().equals(""))
      jComboBox1.setSelectedItem(str2);

    String str3=jDSSetupDataModelface.getEndDate(sID);
    if(str3!=null && !str2.trim().equals(""))
      jComboBox2.setSelectedItem(str3);

    Vector vector1=jDSSetupDataModelface.getPrincipal(sID);
    vector=vector1;
    jList1.setListData(vector);
  }
  /**
   * Invoked when an action occurs.
   *
   * @param e ActionEvent
   * @todo Implement this java.awt.event.ActionListener method
   */
  public void actionPerformed(ActionEvent e) {
    if(e.getSource()==jButton1)
    {
      //添加责任人
      String str1=JOptionPane.showInputDialog(null,"输入该责任人的名字","");
      if(str1==null || str1.trim().equals("")) return;
      vector.add(str1);
      jList1.setListData(vector);
    }
    else if(e.getSource()==jButton2)
    {
      //删除责任人
      int[] index=jList1.getSelectedIndices();
      String[] strName=(String[])vector.toArray(new String[0]);
      for(int i=0;i<strName.length;i++)
      {
        for(int j=0;j<index.length;j++)
        {
          if(i==index[j])
          {
            strName[i]=null;
            break;
          }
        }
      }
      vector.clear();
      for(int i=0;i<strName.length;i++)
      {
        if(strName[i]!=null)
        {
          vector.add(strName[i]);
        }
      }
      jList1.setListData(vector);
    }
    else if(e.getSource()==jButton3)
    {
      //确定事件
      String str1=jTextArea1.getText();
      jDSSetupDataModelface.setDescribe(str1,sID);

      String str2=jComboBox1.getSelectedItem().toString();
      jDSSetupDataModelface.setStartDate(str2,sID);

      String str3=jComboBox2.getSelectedItem().toString();
      jDSSetupDataModelface.setEndDate(str3,sID);

      jDSSetupDataModelface.setPrincipal(vector,sID);

      dSSetupDataPanel.setVisible(false);
    }
    else if(e.getSource()==jButton4)
    {
      //取消事件
      dSSetupDataPanel.setVisible(false);
    }
  }
}

⌨️ 快捷键说明

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