コード例 #1
0
ファイル: BankAccountPanel.java プロジェクト: Harry1001/No007
  private void initUI() {
    names.add("帐号");
    names.add("金额");
    defaultTableModel = new MyDefaultTableModel(names, 0);
    table = new MyTable(defaultTableModel);

    this.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;

    gbc.gridx = gbc.gridy = 0;
    gbc.gridwidth = 4;
    this.add(new JScrollPane(table), gbc);

    // gbc.weightx=gbc.weighty=0.0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridwidth = 1;
    gbc.gridy++;
    gbc.gridx = 1;
    this.add(addbt, gbc);
    gbc.gridx++;
    this.add(deletebt, gbc);
    gbc.gridx++;
    this.add(refreshbt, gbc);

    gbc.gridy++;
    gbc.gridx = 1;
    this.add(new BlankBlock(), gbc);
  }
コード例 #2
0
ファイル: ShenPiPanel.java プロジェクト: Harry1001/No007
  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)));
  }