コード例 #1
0
ファイル: EncodeFileBrowser.java プロジェクト: philres/IGV
  private void init(final EncodeTableModel model) {
    setModal(true);
    setTitle("Encode Production Data");

    table.setAutoCreateRowSorter(true);
    table.setModel(model);
    table.setRowSorter(model.getSorter());
    try {
      rowCountLabel.setText(numberFormatter.valueToString(table.getRowCount()) + " rows");
    } catch (ParseException e) {

    }

    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);

    filterTextField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(DocumentEvent e) {
                updateFilter();
              }

              public void insertUpdate(DocumentEvent e) {
                updateFilter();
              }

              public void removeUpdate(DocumentEvent e) {
                updateFilter();
              }
            });
  }
コード例 #2
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));
  }
コード例 #3
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));
  }
コード例 #4
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;
 }
コード例 #5
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));
 }
コード例 #6
0
  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;
  }
コード例 #7
0
  public UReservacion(String i, String n, String a, String c) {
    this.Identificacion = i;
    this.Nombre = n;
    this.Apellido = a;
    this.Correo = c;
    setTitle("Sistema de Registro");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    esquema = new BorderLayout();
    panelnorte = new JPanel();
    panelcentro = new JPanel(new BorderLayout());
    panelBusqueda = new JPanel(new FlowLayout());
    panelsur = new JPanel();

    dtmesa = mesa.listarMesa("");
    String[] columNames = {"Numero", "Capacidad", "Fumador", "Estado"};
    dtmMesa = new DefaultTableModel(dtmesa, columNames);
    jtbMesa = new JTable(dtmMesa);
    jtbMesa.setEnabled(false);
    jtbMesa.setPreferredScrollableViewportSize(new Dimension(700, 120));
    jtbMesa.setAutoCreateRowSorter(true);
    spMesa = new JScrollPane(jtbMesa);
    lbltitulo = new JLabel("Mesas disponibles");
    lbltitulo.setFont(new Font("Verdana", Font.BOLD, 14));

    lblnomproducto = new JLabel("Ingrese numero de mesa:");
    txtNumMesa = new JTextField(5);
    btnRegistrar = new JButton("Registrar");

    panelBusqueda.add(lblnomproducto);
    panelBusqueda.add(txtNumMesa);

    lblAcompaantes = new JLabel("Personas:");
    panelBusqueda.add(lblAcompaantes);

    textCompa = new JTextField();
    panelBusqueda.add(textCompa);
    textCompa.setColumns(5);

    lblNewLabel_1 = new JLabel("Fecha");
    panelBusqueda.add(lblNewLabel_1);

    txtAaaammdd = new JTextField();
    txtAaaammdd.setText("AAAA-MM-DD");
    txtAaaammdd.setToolTipText("");
    panelBusqueda.add(txtAaaammdd);
    txtAaaammdd.setColumns(10);

    lblHora = new JLabel("Hora");
    panelBusqueda.add(lblHora);

    txtHhmmss = new JTextField();
    txtHhmmss.setText("HH-MM-SS");
    panelBusqueda.add(txtHhmmss);
    txtHhmmss.setColumns(10);

    lblNewLabel = new JLabel("¿Vista al mar?");
    panelBusqueda.add(lblNewLabel);

    checkBox = new JCheckBox("");
    checkBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            checkBox.setEnabled(false);
          }
        });
    panelBusqueda.add(checkBox);
    panelBusqueda.add(btnRegistrar);

    getContentPane().setLayout(esquema);

    panelnorte.add(lbltitulo);
    panelcentro.add(panelBusqueda, BorderLayout.NORTH);
    panelcentro.add(spMesa, BorderLayout.CENTER);

    getContentPane().add(panelnorte, BorderLayout.NORTH);
    getContentPane().add(panelcentro, BorderLayout.CENTER);
    getContentPane().add(panelsur, BorderLayout.SOUTH);

    this.pack();
    setResizable(false);
    setLocationRelativeTo(this.getParent());
    setVisible(true);
    mostrarProductos("Libre");
  }