コード例 #1
0
ファイル: CodeDictFrame.java プロジェクト: Aaron0214/XGame
 private void search(long pageNumber, long pageSize) {
   SearchBean searchBean = new SearchBean();
   searchBean.setId(
       StringUtils.isEmpty(field.getText()) ? null : Integer.parseInt(field.getText()));
   searchBean.setType(
       type.getSelectedItemValue() == null ? null : type.getSelectedItemValue().toString());
   searchBean.setPageNumber(pageNumber);
   searchBean.setPageSize(pageSize);
   getDatas(searchBean);
 }
コード例 #2
0
ファイル: CodeDictFrame.java プロジェクト: Aaron0214/XGame
  public CodeDictFrame() {
    this.setLayout(null);
    init();

    label = new JLabel("编号:");
    label.setFont(new Font("宋体", Font.PLAIN, 13));
    label.setBounds(new Rectangle(5, 15, 50, 20));

    field = new JTextField();
    field.setBounds(new Rectangle(45, 15, 120, 20));

    label3 = new JLabel("分类:");
    label3.setFont(new Font("宋体", Font.PLAIN, 13));
    label3.setBounds(new Rectangle(185, 15, 80, 20));

    type = new MyComboBox(str);
    type.setFont(new Font("宋体", Font.PLAIN, 13));
    type.setBounds(new Rectangle(250, 15, 90, 20));
    type.setCursor(new Cursor(Cursor.HAND_CURSOR));

    search = new JButton("搜索");
    search.setCursor(new Cursor(Cursor.HAND_CURSOR));
    search.setBounds(new Rectangle(360, 15, 80, 20));

    table =
        new Table(rowData, columns) {
          /** */
          private static final long serialVersionUID = 1L;

          public boolean isCellEditable(int row, int column) {
            if (column == 1) {
              return false;
            } else {
              return true;
            }
          }
        };
    table.setPreferredScrollableViewportSize(new Dimension(670, 450));

    table.isCellEditable(0, 1);
    // 设置第一列的宽度
    table.changeColumnWidth(0, 30);
    // 设置第二列的宽度
    table.changeColumnWidth(1, 150);
    // 设置第3列的宽度
    table.changeColumnWidth(2, 150);
    // 设置第4列的宽度
    table.changeColumnWidth(3, 190);
    // 设置第5列的宽度
    table.changeColumnWidth(4, 150);

    table.setCellEditor(2, new ComboBoxEditor(str));

    table.setCellEditor(4, new ComboBoxEditor(parent));

    table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);

    List<Integer> columns = new ArrayList<Integer>();
    columns.add(2);
    columns.add(4);
    table.initCombox(columns);
    table.setOpaque(false);

    pane3 = new JScrollPane(table);
    pane3.setOpaque(false);
    pane3.getViewport().setOpaque(false);
    pane3.setBounds(new Rectangle(2, 50, 670, 450));

    pageTool = new PageToolBar<CodeDictFrame>(this, totalNumber);
    pageTool.setBounds(
        new Rectangle(668 - pageTool.getPanelLength(), 455, pageTool.getPanelLength() - 3, 22));

    button = new JButton("添加");
    button.setBounds(new Rectangle(240, 508, 60, 25));
    save = new JButton("保存");
    save.setCursor(new Cursor(Cursor.HAND_CURSOR));
    save.setBounds(new Rectangle(310, 508, 60, 25));
    delete = new JButton("删除");
    delete.setCursor(new Cursor(Cursor.HAND_CURSOR));
    delete.setBounds(new Rectangle(380, 508, 60, 25));

    search.addActionListener(this);
    button.addActionListener(this);
    save.addActionListener(this);
    delete.addActionListener(this);

    this.add(label);
    this.add(field);
    this.add(label3);
    this.add(type);
    this.add(search);

    this.add(pageTool);
    this.add(pane3);
    this.add(button);
    this.add(save);
    this.add(delete);

    this.setVisible(false);
  }