Example #1
0
  public MainPanel() {
    super(new BorderLayout());

    table.setAutoCreateRowSorter(true);

    JSplitPane sp =
        new JSplitPane(
            JSplitPane.VERTICAL_SPLIT, new JScrollPane(new JTable(model)), new JScrollPane(table));
    sp.setResizeWeight(.5);
    add(sp);
    setPreferredSize(new Dimension(320, 240));
  }
Example #2
0
  public MainPanel() {
    super(new BorderLayout());

    table.setAutoCreateRowSorter(true);
    table.setSurrendersFocusOnKeystroke(true);
    table.setRowHeight(64);

    TableColumn c = table.getColumnModel().getColumn(1);
    c.setCellEditor(new TextAreaCellEditor());
    c.setCellRenderer(new TextAreaCellRenderer());

    add(new JScrollPane(table));
    setPreferredSize(new Dimension(320, 240));
  }
Example #3
0
 private JTable makeTable() {
   String empty = "";
   String[] columnNames = {"String", "Button"};
   Object[][] data = {{"AAA", empty}, {"CCC", empty}, {"BBB", empty}, {"ZZZ", empty}};
   DefaultTableModel model =
       new DefaultTableModel(data, columnNames) {
         @Override
         public Class<?> getColumnClass(int column) {
           return getValueAt(0, column).getClass();
         }
       };
   final JTable table = new JTable(model);
   table.setRowHeight(36);
   table.setAutoCreateRowSorter(true);
   // table.addMouseListener(new CellButtonsMouseListener());
   // ButtonsEditorRenderer er = new ButtonsEditorRenderer(table);
   TableColumn column = table.getColumnModel().getColumn(1);
   column.setCellRenderer(new ButtonsRenderer());
   column.setCellEditor(new ButtonsEditor(table));
   return table;
 }
Example #4
0
 public MainPanel() {
   super(new BorderLayout());
   table.setAutoCreateRowSorter(true);
   JPanel p = new JPanel(new GridLayout(2, 1, 5, 5));
   p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
   p.add(componentChoices);
   p.add(
       new JButton(
           new AbstractAction("show") {
             @Override
             public void actionPerformed(ActionEvent e) {
               model.setRowCount(0);
               JComponent c = ((JComponentType) componentChoices.getSelectedItem()).component;
               for (Integer f : focusType) {
                 loadBindingMap(f, c.getInputMap(f), c.getActionMap());
               }
             }
           }));
   add(p, BorderLayout.NORTH);
   add(new JScrollPane(table));
   setPreferredSize(new Dimension(320, 240));
 }
  public JComponent createContestantList() {
    JPanel contListPanel = new JPanel();

    MyTableModel contTable = new MyTableModel();

    JTable table = new JTable(contTable);

    table.setPreferredScrollableViewportSize(new Dimension(WIDTH, HEIGHT));
    table.setFillsViewportHeight(true);
    table.setAutoCreateRowSorter(true);
    table.setRowHeight(77);

    table.setFont(new Font("Viner Hand ITC", Font.PLAIN, 18));
    table.setForeground(Color.BLUE);
    table.setSelectionForeground(Color.RED);
    table.setSelectionBackground(
        new Color(0, 0, 0, 64)); // When a cell is selected, this entire row is highlighted.

    // Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    contListPanel.add(scrollPane);

    return contListPanel;
  }