Example #1
0
  private void initUI() {
    names = new Vector<String>();
    names.add("单号");
    names.add("单据类型");
    names.add("单据简述");
    defaultTableModel = new EditableTableModel(names, 0);
    table = new MyTable(defaultTableModel);
    table.getColumnModel().getColumn(2).setPreferredWidth(300); // 设置单据简述一列较宽
    table.getColumnModel().getColumn(0).setWidth(50);
    table.getColumnModel().getColumn(1).setWidth(50);
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); // 设置可多选
    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.anchor = GridBagConstraints.EAST;

    gbc.weightx = gbc.weighty = 1.0;
    gbc.gridx = gbc.gridy = 0;
    gbc.gridwidth = 3;
    this.add(new JScrollPane(table), gbc);

    gbc.weightx = gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.gridwidth = 1;
    gbc.gridy++;
    this.add(approvebt, gbc);
    gbc.gridx++;
    this.add(disappbt, gbc);
    gbc.gridx++;
    this.add(refreshbt, gbc);

    this.setOpaque(false);
    this.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createBevelBorder(ALLBITS),
            "审批单据",
            TitledBorder.LEFT,
            TitledBorder.TOP,
            new Font("", Font.BOLD, 25)));
  }
Example #2
0
  public BankAccountPanel(MainFrame par) {
    this.parent = par;
    this.setOpaque(false);
    this.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createBevelBorder(ALLBITS),
            "银行账户",
            TitledBorder.LEFT,
            TitledBorder.TOP,
            new Font("", Font.BOLD, 25)));

    initUI();
    setHotKey();

    addbt.addActionListener(this);
    deletebt.addActionListener(this);
    refreshbt.addActionListener(this);

    initBL();
    refresh();
  }