/** Creates new form Baitap1_1 */
 public Baitap1_1() {
   initComponents();
   _tfMaSinhVien.setEnabled(false);
   _tfTenSinhVien.setEnabled(false);
   _tfNgaySinh.setEnabled(false);
   _btHuy.setVisible(false);
   modelTable = new DefaultTableModel();
   modelTable.addColumn("Mã sinh viên");
   modelTable.addColumn("Tên sinh viên");
   modelTable.addColumn("Ngày sinh");
   _FileChooser.setFileFilter(new FileNameExtensionFilter("*.txt", "txt"));
   _tbleDanhSachSinhVien
       .getSelectionModel()
       .addListSelectionListener(
           new ListSelectionListener() {
             public void valueChanged(ListSelectionEvent event) {
               _tfMaSinhVien.setText(
                   _tbleDanhSachSinhVien
                       .getValueAt(_tbleDanhSachSinhVien.getSelectedRow(), 0)
                       .toString());
               _tfTenSinhVien.setText(
                   _tbleDanhSachSinhVien
                       .getValueAt(_tbleDanhSachSinhVien.getSelectedRow(), 1)
                       .toString());
               _tfNgaySinh.setText(
                   _tbleDanhSachSinhVien
                       .getValueAt(_tbleDanhSachSinhVien.getSelectedRow(), 2)
                       .toString());
             }
           });
 }
Exemple #2
0
 public DefaultTableModel getClearTableModel() {
   DefaultTableModel model = new DefaultTableModel();
   model.addColumn("Start");
   model.addColumn("End");
   model.addColumn("Type");
   return model;
 }
Exemple #3
0
  void mostrardatos(String valor) {
    DefaultTableModel modelo = new DefaultTableModel();
    modelo.addColumn("CODIGO");
    modelo.addColumn("DESCRIPCION");
    modelo.addColumn("PRECIO UNITARIO");
    tbproductos.setModel(modelo);
    String sql = "";
    if (valor.equals("")) {
      sql = "SELECT * FROM productos";
    } else {
      sql = "SELECT * FROM productos WHERE cod_Pro='" + valor + "'";
    }

    String[] datos = new String[3];
    try {
      Statement st = cn.createStatement();
      ResultSet rs = st.executeQuery(sql);
      while (rs.next()) {
        datos[0] = rs.getString(1);

        datos[1] = rs.getString(2);
        datos[2] = rs.getString(3);
        modelo.addRow(datos);
      }
      tbproductos.setModel(modelo);
    } catch (SQLException ex) {
      Logger.getLogger(VentanaBDD.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  public void ListaKontrahentow() {
    DefaultTableModel table = new DefaultTableModel();
    Kontrahent objKontrahent = new Kontrahent();
    ArrayList<Kontrahent> listaKontrahentow = new ArrayList();
    listaKontrahentow = objKontrahent.ListaKontrahentów();

    table.addColumn("id");
    table.addColumn("Skrót");
    table.addColumn("Nazwa");
    table.addColumn("NIP");
    table.setRowCount(listaKontrahentow.size());
    int i = 0;
    // System.out.println("lista size = " + lista3.size());
    for (Kontrahent x : listaKontrahentow) {
      table.setValueAt(x.getId(), i, 0);
      table.setValueAt(x.getSkrot(), i, 1);
      table.setValueAt(x.getNazwa(), i, 2);
      table.setValueAt(x.getNip(), i, 3);
      i++;
    }

    this.jTable1.setModel(table);
    jTable1.getColumnModel().getColumn(0).setMinWidth(0);
    jTable1.getColumnModel().getColumn(0).setMaxWidth(0);
    jTable1.getColumnModel().getColumn(0).setPreferredWidth(0);
  }
 /** Creates new form DialogoAnadirElemento */
 public DialogoModificarIngrediente(
     java.awt.Frame parent, /* IProducto AlmacenProductos, IGestionarProducto GestorProductos*/
     ICocinero iCocinero) {
   super(parent, false);
   initComponents();
   /*this.gestorProductos = GestorProductos;
   this.almacenProductos = AlmacenProductos;*/
   ArrayList<Ingrediente> listaIngredientes = this.almacenProductos.obtenerListaIngredientes();
   DefaultTableModel modelo = new DefaultTableModel();
   modelo.addColumn(this.tTablaIngredientesDisponibles.getColumnName(0));
   modelo.addColumn(this.tTablaIngredientesDisponibles.getColumnName(1));
   modelo.addColumn(this.tTablaIngredientesDisponibles.getColumnName(2));
   modelo.setRowCount(listaIngredientes.size());
   this.tTablaIngredientesDisponibles.setModel(modelo);
   this.tTablaIngredientesDisponibles
       .getColumnModel()
       .getColumn(2)
       .setCellRenderer(new ImageRenderer());
   this.tTablaIngredientesDisponibles.setRowHeight(50);
   for (int i = 0; i < listaIngredientes.size(); i++) {
     this.tTablaIngredientesDisponibles.setValueAt(listaIngredientes.get(i).getNombre(), i, 0);
     this.tTablaIngredientesDisponibles.setValueAt(listaIngredientes.get(i).getCantidad(), i, 1);
     this.tTablaIngredientesDisponibles.setValueAt(listaIngredientes.get(i).getImagen(), i, 2);
   }
   this.bSiguiente.setEnabled(false);
   this.estado = 1;
   this.bAnterior.setEnabled(false);
   this.dSelector.setFileFilter(
       new FileNameExtensionFilter("IMAGEN", "jpg", "jpeg", "png", "gif"));
 }
  private void criaJTable() {

    tabela = new JTable(modelo);
    modelo.addColumn("Código");
    modelo.addColumn("Nome");
    preencherTabela();
  }
  public void LLenarTabla(JTable tablaD) {
    DefaultTableModel modeloT =
        new DefaultTableModel() {
          @Override
          public boolean isCellEditable(int row, int column) {
            // all cells false
            return false;
          }
        };
    tablaD.setModel(modeloT);

    modeloT.addColumn("R.U.C.");
    modeloT.addColumn("RAZON SOCIAL");
    modeloT.addColumn("TELEFONO");
    modeloT.addColumn("CONTACTO");
    modeloT.addColumn("TELEFONO CONTACTO");

    Object[] columna = new Object[5];

    int numRegistros = daoProv.listarProveedores().size();

    for (int i = 0; i < numRegistros; i++) {
      columna[0] = daoProv.listarProveedores().get(i).getRuc();
      columna[1] = daoProv.listarProveedores().get(i).getRazonsocial();
      columna[2] = daoProv.listarProveedores().get(i).getTelefono();
      columna[3] = daoProv.listarProveedores().get(i).getContacto();
      columna[4] = daoProv.listarProveedores().get(i).getTele_contacto();
      modeloT.addRow(columna);
    }
  }
  /**
   * Fühlt die Tabelle mit den Daten von MediaList
   *
   * @param mediaList
   */
  private void setColumnData(MediaList mediaList) {
    ResourceBundle bundle = ResourceBundle.getBundle(MuViBee.mainBundlePath);
    String[] title = new String[mediaList.getList().size()];
    String[] mediaSpecial = new String[mediaList.getList().size()];
    String[] genre = new String[mediaList.getList().size()];
    String[] location = new String[mediaList.getList().size()];
    String[] year = new String[mediaList.getList().size()];
    String special = "n/a";
    int i = 0;

    for (Media m : mediaList.getList()) {
      if (m instanceof Book) {
        mediaSpecial[i] = ((Book) m).getAuthor();
        special = bundle.getString("authorLabel");
      } else if (m instanceof Music) {
        mediaSpecial[i] = ((Music) m).getInterpreter();
        special = bundle.getString("artistLabel");
      } else if (m instanceof Video) {
        mediaSpecial[i] = ((Video) m).getActors();
        special = bundle.getString("actorsLabel");
      }

      title[i] = m.getTitle();
      genre[i] = m.getGenre();
      year[i] = (m.getReleaseYear() != 0) ? "" + m.getReleaseYear() : "";
      location[i] = m.getLocation();
      i++;
    }
    dtm.addColumn(bundle.getString("titleLabel"), title);
    dtm.addColumn(special, mediaSpecial);
    dtm.addColumn(bundle.getString("genreLabel"), genre);
    dtm.addColumn(bundle.getString("releaseYearLabel"), year);
    dtm.addColumn(bundle.getString("locationLabel"), location);
  }
Exemple #9
0
 /** Creates a table model for the new table and returns it. */
 private DefaultTableModel updateModel() {
   TimeWindowConfigurationStorage storage = null;
   // if not first call, get configuration
   if (sorter != null) {
     storage = getTableConfiguration();
   }
   DefaultTableModel model = new MindmapTableModel();
   model.addColumn(COLUMN_DATE);
   model.addColumn(COLUMN_TEXT);
   model.addColumn(COLUMN_ICONS);
   model.addColumn(COLUMN_CREATED);
   model.addColumn(COLUMN_MODIFIED);
   model.addColumn(COLUMN_NOTES);
   MindMapNode node = getMindMapController().getMap().getRootNode();
   updateModel(model, node);
   timeTableModel = model;
   mFlatNodeTableFilterModel =
       new FlatNodeTableFilterModel(timeTableModel, NODE_TEXT_COLUMN, NODE_NOTES_COLUMN);
   if (sorter == null) {
     sorter = new TableSorter(mFlatNodeTableFilterModel);
     timeTable.setModel(sorter);
   } else {
     sorter.setTableModel(mFlatNodeTableFilterModel);
   }
   if (storage != null) {
     setTableConfiguration(storage);
   }
   try {
     String text = getRegularExpression(getText(mFilterTextSearchField.getDocument()));
     mFlatNodeTableFilterModel.setFilter(text);
   } catch (BadLocationException e) {
     freemind.main.Resources.getInstance().logException(e);
   }
   return model;
 }
  void mostrarDatosRazas(String valor) {

    String[] vecRegistros = new String[2];
    String consultaSql = "";

    DefaultTableModel modelo = new DefaultTableModel();
    modelo.addColumn("Codigo");
    modelo.addColumn("Nombre Raza"); // Estos son los nombres de las Columnas
    tbRazas.setModel(modelo);

    if (valor.equals("")) {
      consultaSql = "select * from CATEGORIA";
    } else {
      consultaSql = "select * from CATEGORIA where nb_categoria='" + valor.trim() + "'";
    }

    try {
      Statement st = objConexion.createStatement();
      ResultSet rs =
          st.executeQuery(consultaSql); // Almacena los datos de la consulta ue se va a realizar
      while (rs.next()) {
        // Mostrando en la tabla
        vecRegistros[0] = rs.getString(1);
        vecRegistros[1] = rs.getString(2);
        modelo.addRow(vecRegistros);
      }
      tbRazas.setModel(modelo); // mostramos los registros
    } catch (SQLException ex) {
      Logger.getLogger(Menutipoproducto.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
 private void CreateTableModel() {
   m_Model = new DefaultTableModel();
   m_Model.addColumn("Identifier");
   m_Model.addColumn("Type");
   m_Model.addColumn("Title");
   journalsTable.setModel(m_Model);
 }
  /** This is a protected constructor called game console. */
  protected GameConsole() {

    _model = new DefaultTableModel();
    _model.addColumn("Round");
    _model.addColumn("Actor");
    _model.addColumn("Message");
    _table = new JTable(_model);
    setSize(800, 300);
    // _table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    _scrollPane = new JScrollPane(_table);

    _table.setSize(1250, 300);
    _table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    int vColIndex = 0;
    TableColumn col = _table.getColumnModel().getColumn(vColIndex);
    int width = 50;
    col.setPreferredWidth(width);

    vColIndex = 1;
    col = _table.getColumnModel().getColumn(vColIndex);
    width = 100;
    col.setPreferredWidth(width);

    vColIndex = 2;
    col = _table.getColumnModel().getColumn(vColIndex);
    width = 1500;
    col.setPreferredWidth(width);

    this.setTitle("Game Console");
    _scrollPane.setAutoscrolls(true);
    // _scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    // Add the scroll pane to this panel.
    add(_scrollPane);
  }
  @Override
  public void keyReleased(KeyEvent e) {
    if (e.getSource() == vistaProv.txtfiltrarrazon) {
      String rsocial = vistaProv.txtfiltrarrazon.getText();
      DefaultTableModel modeloT =
          new DefaultTableModel() {
            @Override
            public boolean isCellEditable(int row, int column) {
              // all cells false
              return false;
            }
          };
      vistaProv.tbldatos.setModel(modeloT);

      modeloT.addColumn("R.U.C.");
      modeloT.addColumn("RAZON SOCIAL");
      modeloT.addColumn("TELEFONO");
      modeloT.addColumn("CONTACTO");
      modeloT.addColumn("TELEFONO CONTACTO");

      Object[] columna = new Object[5];

      int numRegistros = daoProv.buscarRazon(rsocial).size();

      for (int i = 0; i < numRegistros; i++) {
        columna[0] = daoProv.buscarRazon(rsocial).get(i).getRuc();
        columna[1] = daoProv.buscarRazon(rsocial).get(i).getRazonsocial();
        columna[2] = daoProv.buscarRazon(rsocial).get(i).getTelefono();
        columna[3] = daoProv.buscarRazon(rsocial).get(i).getContacto();
        columna[4] = daoProv.buscarRazon(rsocial).get(i).getTele_contacto();
        modeloT.addRow(columna);
      }
    }
  }
Exemple #14
0
  public MediaTable() {
    super();
    setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    table =
        new JTable() {
          private static final long serialVersionUID = 20100125;

          public boolean isCellEditable(int x, int y) {
            return false;
          }
        };
    DefaultTableModel model = new DefaultTableModel();
    model.addColumn("Artist");
    model.addColumn("Title");
    model.addColumn("Album");
    model.addColumn("Length");
    String string[] = {"This", "feature", "is not implemented", "yet"};

    model.addRow(string);

    table.setBackground(Color.WHITE);
    table.setModel(model);
    table.getTableHeader().setReorderingAllowed(false);
    add(table);
    setViewportView(table);
  }
  /**
   * builds the panel which warns users about a cyclic dependency
   *
   * @param dep the list of relations with a cyclic dependency
   * @return the panel
   */
  protected JPanel buildWarningPanel(List<Relation> dep) {
    JPanel pnl = new JPanel();
    pnl.setLayout(new BorderLayout());
    String msg =
        tr(
            "<html>{0} relations build a cycle because they refer to each other.<br>"
                + "JOSM cannot upload them. Please edit the relations and remove the "
                + "cyclic dependency.</html>",
            dep.size() - 1);
    pnl.add(new JLabel(msg), BorderLayout.NORTH);

    DefaultTableModel model = new DefaultTableModel();
    model.addColumn(tr("Relation ..."));
    model.addColumn(tr("... refers to relation"));
    for (int i = 0; i < dep.size() - 1; i++) {
      Relation r1 = dep.get(i);
      Relation r2 = dep.get(i + 1);
      model.addRow(new Relation[] {r1, r2});
    }
    JTable tbl = new JTable(model);
    OsmPrimitivRenderer renderer = new OsmPrimitivRenderer();
    tbl.getColumnModel().getColumn(0).setCellRenderer(renderer);
    tbl.getColumnModel().getColumn(1).setCellRenderer(renderer);
    pnl.add(new JScrollPane(tbl), BorderLayout.CENTER);
    return pnl;
  }
Exemple #16
0
  private JTable initSessionList() {

    final JPopupMenu popupMenu = new JPopupMenu();
    JMenuItem removeItem = new JMenuItem(BundleUtil.getString(BundleUtil.Command_Delete));
    removeItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            remove();
          }
        });
    popupMenu.add(removeItem);

    sessionListModel =
        new DefaultTableModel() {
          @Override
          public boolean isCellEditable(int row, int column) {
            return false;
          }
        };

    TableSorter sorter = new TableSorter(sessionListModel);

    JTable sessionsTable = new JTable(sorter);

    sessionsTable.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            JTable table = (JTable) e.getSource();
            int currentRow = table.rowAtPoint(e.getPoint());
            if (currentRow >= 0) {
              table.setRowSelectionInterval(currentRow, currentRow);
            }
          }

          @Override
          public void mousePressed(MouseEvent e) {
            JTable table = (JTable) e.getSource();
            int currentRow = table.rowAtPoint(e.getPoint());
            if (currentRow >= 0) {
              table.setRowSelectionInterval(currentRow, currentRow);
            }
            currentSession = (Long) table.getValueAt(table.rowAtPoint(e.getPoint()), 0);
            if (e.getButton() == 3) {
              popupMenu.show(table, e.getX(), e.getY());
            }
          }
        });

    sorter.setTableHeader(sessionsTable.getTableHeader());

    sessionListModel.addColumn("会话ID");
    sessionListModel.addColumn("用户名");
    sessionListModel.addColumn("IP地址");
    sessionListModel.addColumn("创建时间");
    sessionListModel.addColumn("操作");
    sessionListModel.addColumn("注销时间");

    return sessionsTable;
  }
  /** @param tablaTelefono */
  public void llenarTabla(JTable tablaTelefono) {
    DefaultTableModel modeloTabla = new DefaultTableModel();
    tablaTelefono.setModel(modeloTabla);
    modeloTabla.addColumn("Id Telefono");
    modeloTabla.addColumn("Id Cliente");
    modeloTabla.addColumn("Tipo Telefono");
    modeloTabla.addColumn("Num. Telefono");
    Object fila[] = new Object[4];

    String Sql = "where Telefono like '%" + this.telefonoBuscarView.txtBuscar.getText() + "%'";

    try {
      for (Object oAux : telefonoBLModelo.obtenerConWhere(new Telefono(), Sql)) {
        Telefono t = (Telefono) oAux;
        fila[0] = t.getPk_idTelefono();
        fila[1] = t.getFK_idCliente();
        fila[2] = t.getTipoTelfono();
        fila[3] = t.getNumeroTelefono();
        modeloTabla.addRow(fila);
      }
    } catch (SQLException ex) {
      JOptionPane.showMessageDialog(
          null,
          "Error (llenarTabla):" + ex.getMessage(),
          "Error en llenarTabla",
          JOptionPane.ERROR_MESSAGE);
    }
  }
Exemple #18
0
  /**
   * Default constructor/Create the frame of kick player window
   *
   * @param lobby the given lobby associated with the frame
   * @param table the table the player current on
   */
  public KickPlayerWindow(final ILobby lobby, final Table table) {
    this.setResizable(false);
    this.isAlwaysOnTop();
    List<Player> playerList = table.getPlayers();
    // get to delete the moderator from the list to make sure
    // the moderator doesn't kick himself
    playerList.remove(table.getModerator());
    playerTable = new JTable();
    players = new HashMap<Integer, Player>();
    setTitle("Kick player");
    setBounds(100, 100, 400, 300);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JScrollPane scrollPane = new JScrollPane(playerTable);
    scrollPane.setBounds(10, 10, 363, 200);
    contentPane.add(scrollPane, BorderLayout.CENTER);

    model = new DefaultTableModel();
    model.addColumn("ID");
    model.addColumn("Display Name");
    model.addColumn("Rating");
    playerTable.setModel(model);
    playerTable.setColumnSelectionAllowed(false);
    playerTable.setRowSelectionAllowed(true);

    JTableHeader header = playerTable.getTableHeader();
    header.setFont(new Font(header.getFont().getFontName(), Font.BOLD, header.getFont().getSize()));
    updatePlayers(playerList);

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setBounds(280, 228, 89, 23);
    contentPane.add(btnCancel);
    btnCancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            dispose();
          }
        });

    JButton btnKick = new JButton("Kick");
    btnKick.setBounds(180, 228, 89, 23);
    contentPane.add(btnKick);
    btnKick.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent evt) {
            for (Integer row : playerTable.getSelectedRows()) {
              Player selected = players.get(model.getValueAt(row, 0));
              new LeaveRequest(table, selected).send(lobby);
            }
            dispose();
          }
        });
  }
  public IntervenantPage() throws SQLException {
    initComponents();

    ConnectBDD();

    jTextField1.setText("-");
    jLabel4.setVisible(false);
    jComboBox3.setVisible(false);
    jLabel5.setVisible(false);
    jTextField1.setVisible(false);

    identifiantConnect = ConnectPage.getIdentifiant();

    IntervenantsDAO i1 = new IntervenantsDAO();
    i1.getConnection();
    ArrayList<Intervenants> mesLogin = i1.selectAll();

    for (Intervenants ii : mesLogin) {
      jComboBox1.addItem(ii.getLogin());
    }

    OrdinateurDAO o1 = new OrdinateurDAO();
    o1.getConnection();
    ArrayList<Ordinateur> mesordi = o1.selectAll();

    for (Ordinateur oo : mesordi) {
      jComboBox2.addItem(oo.getRefOrdinateur());
    }

    PanneDAO p1 = new PanneDAO();
    p1.getConnection();
    ArrayList<Panne> mesPanne = p1.selectAll();

    DefaultTableModel model = new DefaultTableModel();
    model.addColumn("Id Panne");
    model.addColumn("Date Panne");
    model.addColumn("Type Materiel");
    model.addColumn("Urgence Panne");
    model.addColumn("Peripherique Panne");
    model.addColumn("Ordinateur");
    model.addColumn("Descriptif");

    for (Panne pp : mesPanne) {
      model.addRow(
          new Object[] {
            pp.getIdPanne(),
            pp.getDatePanne(),
            pp.getTypeMaterielPanne(),
            pp.getUrgencePanne(),
            pp.getPeripheriquePanne(),
            pp.getIdOrdinateurPanne(),
            pp.getDescriptifPanne()
          });
    }

    jTable2.setModel(model);

    this.setIconImage(new ImageIcon(getClass().getResource("gsb-icon.png")).getImage());
  }
 @Override
 protected void init() {
   DefaultTableModel model = new DefaultTableModel();
   model.addColumn("To user");
   model.addColumn("Date");
   model.addColumn("Description");
   setModel(model);
 }
  private void getTableData() {
    dtm.addColumn("Menu Item");
    dtm.addColumn("Quantity");
    dtm.addColumn("Conformation Status");

    JScrollPane js = new JScrollPane(tbl);
    add(js).setBounds(20, 100, 900, 500);
  }
 /** Creates new form DetailPenjualanFrame */
 public DetailPenjualanFrame() {
   initComponents();
   tableModel = new DefaultTableModel();
   tableModel.addColumn("barang");
   tableModel.addColumn("jumlah");
   tableModel.addColumn("Total");
   barangPenjualanTable.setModel(tableModel);
 }
    /** Constructor */
    public DragTable() {
      setShowHorizontalLines(false);
      setShowVerticalLines(false);
      setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      setColumnModel(
          new DefaultTableColumnModel() {
            public void moveColumn(int columnIndex, int newIndex) {
              if (columnIndex == 0 || newIndex == 0) return;
              super.moveColumn(columnIndex, newIndex);
            }
          });
      // setAutoCreateColumnsFromModel(false);

      DefaultTableModel tableModel = new DefaultTableModel();
      tableModel.addColumn(
          AppContext.getApplicationContext().getI18nString("alfresco.fileList.columnName"));
      tableModel.addColumn("");
      setModel(tableModel);
      setTableColumnModel();

      setBackground(Color.WHITE);
      setDragEnabled(true);
      final DragTable dragTable = this;
      setTransferHandler(
          new TransferHandler() {

            public boolean canImport(TransferSupport support) {
              return false;
            }

            @Override
            public int getSourceActions(JComponent c) {
              return TransferHandler.COPY_OR_MOVE;
            }

            @Override
            protected Transferable createTransferable(JComponent c) {
              assert (c == dragTable);
              DefaultMutableTreeNode defaultMutableTreeNode = new DefaultMutableTreeNode();
              defaultMutableTreeNode.setUserObject(
                  (DefaultMutableTreeNode)
                      dragTable.getModel().getValueAt(dragTable.getSelectedRow(), 0));
              defaultMutableTreeNode.setAllowsChildren(false);
              defaultMutableTreeNode.setParent(null);
              draggedNode = defaultMutableTreeNode;
              return new DataHandler(
                  defaultMutableTreeNode, dragAndDropTree.dataFlavor.getMimeType());
            }

            @Override
            protected void exportDone(JComponent c, Transferable t, int act) {
              if (act == TransferHandler.MOVE) {
                dragTable.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                workDone();
              }
            }
          });
    }
 private void CreateTableModel() {
   m_Model = new DefaultTableModel();
   m_Model.addColumn("Room No");
   m_Model.addColumn("Floor");
   m_Model.addColumn("Capacity");
   m_Model.addColumn("Lib ID");
   m_Model.addColumn("Library Name");
   roomsTable.setModel(m_Model);
 }
  /** @param modelArg the model */
  protected void addColumnHeaders(final DefaultTableModel modelArg) {
    modelArg.addColumn("");
    modelArg.addColumn(nameColTitle);

    if (viewColTitle != null) modelArg.addColumn(viewColTitle);
    if (addColTitle != null) modelArg.addColumn(addColTitle);
    if (modColTitle != null) modelArg.addColumn(modColTitle);
    if (delColTitle != null) modelArg.addColumn(delColTitle);
  }
 public static DefaultTableModel createTableModel() {
   DefaultTableModel model = new DefaultTableModel();
   model.addColumn(RECORD);
   model.addColumn(TARGET);
   model.addColumn(REPORTING_PARTY);
   model.addColumn(EVENT_TYPE);
   model.addColumn(OCCURRED_AT);
   return model;
 }
Exemple #27
0
  private void criaJTable() {
    tabela = new JTable(modelo);
    modelo.addColumn("Código");
    modelo.addColumn("Nome");
    modelo.addColumn("Valor");
    modelo.addColumn("Descrição");
    modelo.addColumn("MAC Address");

    preencherJTable();
  }
  private void cargar() {

    DefaultTableModel tabla = new DefaultTableModel();
    try {
      tabla.addColumn("CODIGO");
      tabla.addColumn("NOMBRES");
      tabla.addColumn("APELLIDOS");
      tabla.addColumn("SEXO");
      tabla.addColumn("DNI");
      tabla.addColumn("TELEFONO");
      tabla.addColumn("RUC");
      tabla.addColumn("E_MAIL");
      tabla.addColumn("DIRECCION");
      cts = cn.prepareCall("{call mostrarclientes}");
      r = cts.executeQuery();
      while (r.next()) {
        Object dato[] = new Object[9];
        for (int i = 0; i < 9; i++) {
          dato[i] = r.getString(i + 1);
        }
        tabla.addRow(dato);
      }
      this.jTable1.setModel(tabla);
      jLabel2.setText("" + jTable1.getRowCount());
    } catch (Exception e) {
    }
  }
Exemple #29
0
 private void loadTableModel() {
   messages = usenet.getMessages(getIndex() - getPageSize(), getIndex());
   DefaultTableModel dtm = new DefaultTableModel();
   dtm.addColumn("subject");
   dtm.addColumn("id");
   for (Message m : messages) {
     MessageBean mb = new MessageBean(m);
     dtm.addRow(mb.getVector());
   }
   setDefaultTableModel(dtm);
 }
  public FrmAlumnosno(String user) {
    Usuario = user;
    initComponents();

    modelo = new DefaultTableModel();
    Tabla.setModel(modelo);
    modelo.addColumn("Nombre");
    modelo.addColumn("Carne");
    this.setLocationRelativeTo(null);
    this.setIconImage(new ImageIcon(getClass().getResource("/Img/user.png")).getImage());
    llenartabla();
  }