Java Code Examples for javax.swing.table.DefaultTableModel#setRowCount()
The following examples show how to use
javax.swing.table.DefaultTableModel#setRowCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ControllerGui.java From sdn-wise-java with GNU General Public License v3.0 | 6 votes |
private void jButtonReadAcceptedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonReadAcceptedActionPerformed try { jSpinnerNetID.commitEdit(); jSpinnerAddrH.commitEdit(); jSpinnerAddrL.commitEdit(); List<NodeAddress> list = controller.getNodeAliases( ((Integer) jSpinnerNetID.getValue()).byteValue(), new NodeAddress( (Integer) jSpinnerAddrH.getValue(), (Integer) jSpinnerAddrL.getValue())); DefaultTableModel model = (DefaultTableModel) jTableAccepted .getModel(); model.setRowCount(0); list.stream().forEach((na) -> { model.addRow(new Integer[]{Byte.toUnsignedInt(na.getHigh()), Byte.toUnsignedInt(na.getLow())}); }); } catch (ParseException ex) { Logger.getGlobal().log(Level.SEVERE, null, ex); } }
Example 2
Source File: CImportBibTex.java From Zettelkasten with GNU General Public License v3.0 | 6 votes |
@Action public void refreshList() { // first check whether we have any saved values at all if (linkedtablelist != null) { // get table model DefaultTableModel dtm = (DefaultTableModel) jTableBibEntries.getModel(); // delete all data from the author-table dtm.setRowCount(0); // create an iterator for the linked list ListIterator<Object[]> iterator = linkedtablelist.listIterator(); // go through complete linked list and add each element to the table(model) while (iterator.hasNext()) { dtm.addRow(iterator.next()); } // enable filter field jTextFieldFilterTable.setEnabled(true); // disable refresh button jButtonRefresh.setEnabled(false); } linkedtablelist = null; }
Example 3
Source File: AdminPanel.java From ShoppingCartinJava with MIT License | 6 votes |
private void billingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_billingButtonActionPerformed // TODO add your handling code here: cardAdminParentLayout.removeAll(); cardAdminParentLayout.add(billingPanel); cardAdminParentLayout.repaint(); cardAdminParentLayout.revalidate(); DefaultTableModel model = (DefaultTableModel) billingTable.getModel(); model.setRowCount(0); Object[] data = new Object[4]; ArrayList<BillObject> list = new ArrayList<>(); list = BillingDB.billlings(); for(int i=0; i<list.size(); i++){ data[0] = i+1; data[1] = list.get(i).getUname(); data[2] = list.get(i).getBill(); data[3] = list.get(i).getDate(); model.addRow(data); billingTable.setRowHeight(20); } }
Example 4
Source File: AvdUISelector.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
public final void setAvdInfos(AvdInfo[] infos) { avdInfos = infos; DefaultTableModel tableModel = getTableModel(); tableModel.setRowCount(0); for (AvdInfo info : infos) { AndroidVersion target = info.getAndroidVersion(); if (target != null) { tableModel.addRow(new Object[]{ info.getName(), target.getApiLevel(), target.getCodename(), target.getFeatureLevel() }); } else { LOG.log(Level.INFO, "Not valid AvdInfo {0}", info); } } if (infos.length > 0) { avdsTable.setRowSelectionInterval(0, 0); // pre-select 1st row } }
Example 5
Source File: EventViewer.java From jaamsim with Apache License 2.0 | 6 votes |
public void updateConditionals() { // Make a copy of the conditional data to avoid concurrent modification exceptions try { condEvents.clear(); evtMan.getConditionalDataList(condEvents); } catch (Exception e) { setDirty(true); return; } // Build the table entries DefaultTableModel tableModel = (DefaultTableModel) condList.getModel(); String[] condData = new String[1]; for (int i = 0; i < condEvents.size(); i++) { condData[0] = condEvents.get(i); tableModel.insertRow(i, condData); } tableModel.setRowCount(condEvents.size()); condEvents.clear(); }
Example 6
Source File: AOIDetailsProvider.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
public AOIDetailsRenderer() { final DefaultTableModel dataModel = new DefaultTableModel(); dataModel.setColumnCount(2); dataModel.setRowCount(detailsLables.length); for (int i = 0; i < detailsLables.length; i++) { dataModel.setValueAt(detailsLables[i], i, 0); dataModel.setValueAt("", i, 1); } setModel(dataModel); valueFont = getFont().deriveFont(Font.BOLD); getColumnModel().getColumn(1).setCellRenderer(new PropertyValueCellRenderer(valueFont)); getColumnModel().getColumn(0).setMaxWidth(120); //this.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); getTableHeader().setVisible(false); setShowHorizontalLines(false); setShowVerticalLines(false); }
Example 7
Source File: Main_CustomersFrame.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 6 votes |
private void populateMainTable(DefaultTableModel model) { model.setRowCount(0); customerDaoImpl = new CustomerDaoImpl(); final List<Customer> customerList = customerDaoImpl.getAllCustomers(); if(!customerList.isEmpty()) { final ReservationDaoImpl reservationDaoImpl = new ReservationDaoImpl(); for (Customer cust : customerList) { final Optional<Reservation> reservation = reservationDaoImpl.findReservationById(cust.getReservationId()); if (!reservation.isPresent()) { continue; } final Object[] customerObject = new Object[]{reservation.get().getRentedRoomNum(), reservation.get().getId(), cust.getFirstName(), cust.getLastName(), reservation.get().getAgency(), reservation.get().getGroupName(), reservation.get().getCheckinDate(), reservation.get().getCheckoutDate(), cust.getCountry()}; model.addRow(customerObject); } } }
Example 8
Source File: Main_Blockade.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 6 votes |
public void populateBlokajTable(DefaultTableModel blokajModel) { final String workingDate = sdf.format(dateChooser.getDate()); final Reservation reservation = new Reservation(); rezervationIdList = new ArrayList<>(); blokajModel.setRowCount(0); for (int i = 0; i < resList.size(); i++) { if (resList.get(i).getCheckinDate().equals(workingDate) && resList.get(i).getIsCheckedIn().equals("NO")) { reservation.setId(resList.get(i).getId()); reservation.setGroupName(resList.get(i).getGroupName()); reservation.setAgency(resList.get(i).getAgency()); reservation.setPaymentStatus(resList.get(i).getPaymentStatus()); reservation.setCheckinDate(resList.get(i).getCheckinDate()); reservation.setCheckoutDate(resList.get(i).getCheckoutDate()); blokajModel.addRow(new Object[]{ reservation.getId(), reservation.getGroupName(), reservation.getAgency(), reservation.getCheckinDate(), reservation.getCheckoutDate(), reservation.getPaymentStatus()}); rezervationIdList.add(resList.get(i).getId()); } } }
Example 9
Source File: AllReservationsWindow.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 6 votes |
public void populatemainTable(DefaultTableModel defaultTableModel) { defaultTableModel.setRowCount(0); final List<Reservation> reservationsList = reservationDaoImpl.getAllReservations(); for (int i = 0; i < reservationsList.size(); i++) { model.addRow(new Object[]{ reservationsList.get(i).getId(), reservationsList.get(i).getGroupName(), reservationsList.get(i).getCheckinDate(), reservationsList.get(i).getCheckoutDate(), reservationsList.get(i).getAgency(), reservationsList.get(i).getAgencyRefNo(), reservationsList.get(i).getRentedRoomNum(), reservationsList.get(i).getTotalDays(), reservationsList.get(i).getHostType(), reservationsList.get(i).getPaymentStatus(), reservationsList.get(i).getBookStatus() }); } }
Example 10
Source File: DriverSettings.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
private void loadCapabilities(String browserName) { DefaultTableModel model = (DefaultTableModel) capTable.getModel(); model.setRowCount(0); LinkedProperties prop = settings.getCapabilities().getCapabiltiesFor(browserName); if (prop != null) { for (Object key : prop.orderedKeys()) { Object value = prop.get(key); model.addRow(new Object[]{key, value}); } } }
Example 11
Source File: DriverSettings.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
private void loadDriverPropTable() { DefaultTableModel model = (DefaultTableModel) driverPropTable.getModel(); model.setRowCount(0); for (Object key : settings.getDriverSettings().orderedKeys()) { Object value = settings.getDriverSettings().get(key); model.addRow(new Object[]{key, value}); } }
Example 12
Source File: Main_Audit.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 5 votes |
private void populateMainTable(DefaultTableModel model) { // store all reserved Id's in a array to be ready for use in another methods. foundReservationlist = new ArrayList<>(); theRoomList = new ArrayList<>(); model.setRowCount(0); Date checkinDate; LocalDate localDate; final Date currentDate = Date.from(systemStatus.getDateTime().atStartOfDay(ZoneId.systemDefault()).toInstant()); for (int i = 0; i < resList.size(); i++) { //convert reservations date to compare between check in date and current date. localDate = LocalDate.parse(resList.get(i).getCheckinDate()); checkinDate = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); if (checkinDate.equals(currentDate) && resList.get(i).getIsCheckedIn().equals("NO")) { theRoom = roomDaoImpl.getRoomByReservId(resList.get(i).getId()); model.addRow(new Object[]{resList.get(i).getId(), resList.get(i).getGroupName(), theRoom.getNumber(), resList.get(i).getCheckinDate(), theRoom.getPrice(), resList.get(i).getAgency()}); // Storing Id's here foundReservationlist.add(resList.get(i)); theRoomList.add(theRoom); } } }
Example 13
Source File: Main_Blockade.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 5 votes |
public void populateBlokajCustomerModel(DefaultTableModel blokajCustomerModel, String reservId) { if (blokajRoomsModel.getRowCount() == 0) { blokajCustomerModel.setRowCount(0); } else { for (int k = 0; k < customerList.size(); k++) { if (customerList.get(k).getReservationId() == Long.parseLong(reservId)) { blokajCustomerModel.addRow(new Object[]{ customerList.get(k).getFirstName(), customerList.get(k).getLastName()}); } } } }
Example 14
Source File: Main_Blockade.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 5 votes |
public void populateBlokajRoomsModel(DefaultTableModel blokajRoomsModel, String reservId) { if (blokajModel.getRowCount() == 0) { blokajRoomsModel.setRowCount(0); } else { for (int index = 0; index < roomList.size(); index++) { if (roomList.get(index).getReservationId() == Long.parseLong(reservId)) { blokajRoomsModel.addRow(new Object[]{roomList.get(index).getNumber(), roomList.get(index).getType(), roomList.get(index).getPersonCount()}); break; } } } }
Example 15
Source File: JtableUtils.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
/** * Loads the Data Array into the tmodel * * @param table to be populated * @param header column header * @param rows nullRoww data * @return populated tmodel */ public static JTable populatetable(JTable table, String[] header, List<String[]> rows) { removeRowSelection(table); DefaultTableModel tablemodel = (DefaultTableModel) table.getModel(); tablemodel.setRowCount(0); for (String col : header) { tablemodel.addColumn(col); } for (String[] row : rows) { tablemodel.addRow(row); } table.setModel(tablemodel); return table; }
Example 16
Source File: CategoryPanelStepFilters.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void load() { //Preferences p = NbPreferences.root().node("Debugger/JPDA"); Properties p = Properties.getDefault().getProperties("debugger.options.JPDA"); useStepFiltersCheckBox.setSelected(p.getBoolean("UseStepFilters", true)); filterSyntheticCheckBox.setSelected(p.getBoolean("FilterSyntheticMethods", true)); filterStaticInitCheckBox.setSelected(p.getBoolean("FilterStaticInitializers", false)); filterConstructorsCheckBox.setSelected(p.getBoolean("FilterConstructors", false)); //String[] filterClasses = (String[]) pp.getArray("FilterClasses", new String[] {}); DefaultTableModel filterClassesModel = (DefaultTableModel) filterClassesTable.getModel(); Set enabledFilters = (Set) Properties.getDefault ().getProperties ("debugger"). getProperties ("sources").getProperties ("class_filters"). getCollection ( "enabled", Collections.EMPTY_SET ); Set<String> allFilters = (Set<String>) Properties.getDefault ().getProperties ("debugger"). getProperties ("sources").getProperties ("class_filters"). getCollection ( "all", Collections.EMPTY_SET ); filterClassesModel.setRowCount(0); for (String filter : allFilters) { filterClassesModel.addRow(new Object[] { enabledFilters.contains(filter), filter }); } stepThroughFiltersCheckBox.setSelected(p.getBoolean("StepThroughFilters", false)); useStepFiltersCheckBoxActionPerformed(null); }
Example 17
Source File: Main_Blockade.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 4 votes |
public void populateMainTable(DefaultTableModel model) { model.setRowCount(0); /*Simple object POJO class (entity)*/ Blockade blockade = null; final Calendar c = Calendar.getInstance(); final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); for (int colindex = 0; colindex < roomList.size(); colindex++) { ///////////////////////////////////////////////////////////////// //here we created new 'Blockade' object special for this table // //and we will use this object to move datas as desire // blockade = new Blockade(); // blockade.setNumber(roomList.get(colindex).getNumber()); // blockade.setType(roomList.get(colindex).getType()); // blockade.setStatus(roomList.get(colindex).getCleaningStatus());// ///////////////////////////////////////////////////////////////// //populate first three columns with following informations model.addRow(new Object[]{blockade.getNumber(), blockade.getType(), blockade.getStatus()}); //////////////////////////////////////////////////////////////////// //in this part of code we gonna use special date array 'weekDates'// //that initialized up and populated table header as date, so after// //checking the date we have to get that reservation is equals with// //header date and finally populate the table. // for (int listIndex = 0; listIndex < resList.size(); listIndex++) { if (blockade.getNumber().equals(resList.get(listIndex).getRentedRoomNum())) { for (int rowIndex = 3; rowIndex < weekDates.length; rowIndex++) { try { //convert all String type dates to real date type, //we have to extract one day from checkout date because, //it get dates that between checkin and checkout dates included Date today = sdf.parse(weekDates[rowIndex]); Date checkinDate = sdf.parse(resList.get(listIndex).getCheckinDate()); Date checkouDate = sdf.parse(resList.get(listIndex).getCheckoutDate()); c.setTime(checkouDate); c.add(Calendar.DATE, -1); if (checkinDate.compareTo(today) * today.compareTo(c.getTime()) >= 0) { //populating table and sorting as dates model.setValueAt(resList.get(listIndex).getGroupName(), colindex, rowIndex); } } catch (ParseException e) { System.err.println("Holaaa"+e.getLocalizedMessage()); } } } } } }
Example 18
Source File: FindDoubleEntriesTask.java From Zettelkasten with GNU General Public License v3.0 | 4 votes |
@Override protected void finished() { super.finished(); // when the task is finished, clear it doubleEntryTask = null; // hide task-progress bar jPanel1.setVisible(false); // create tablemodel for the table data, which is not editable DefaultTableModel tm = new DefaultTableModel(new Object[] {}, 0) { @Override public boolean isCellEditable(int row, int column) { return false; } }; // apply model to table jTable1.setModel(tm); // and delete all rows and columns tm.setRowCount(0); tm.setColumnCount(0); // now fill the table // check whether we have any multiple entries at all. if (!doubleentries.isEmpty()) { // create iterator for the list Iterator<Integer[]> it = doubleentries.iterator(); // iterate all multiple entries while (it.hasNext()) { // retrieve the row data Integer[] rowdata = it.next(); // if the rowdate has more columns than the table model, adjust // column count while (tm.getColumnCount()<rowdata.length) { tm.addColumn(String.valueOf(tm.getColumnCount()+1)); } // add it to the table model tm.addRow((Object[])rowdata); } // finally, enable table jTable1.setEnabled(true); } else { JOptionPane.showMessageDialog(null,resourceMap.getString("noMultipleEntriesFoundMsg"),resourceMap.getString("noMultipleEntriesFoundTitle"),JOptionPane.PLAIN_MESSAGE); setVisible(false); dispose(); } }
Example 19
Source File: MobileUtil.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
private void removeAllRows(DefaultTableModel model) { model.setRowCount(0); }
Example 20
Source File: AdminPanel.java From ShoppingCartinJava with MIT License | 4 votes |
private void checkStockButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkStockButtonActionPerformed cardAdminParentLayout.removeAll(); cardAdminParentLayout.add(checkStockPanel); cardAdminParentLayout.repaint(); cardAdminParentLayout.revalidate(); DefaultTableModel model = (DefaultTableModel) checkStockTable.getModel(); model.setRowCount(0); ArrayList<ProductList> list = ElectronicsDB.checkStock(); Object data[] = new Object[4]; for(int i=0; i<list.size(); i++){ data[0] = list.get(i).getBrand(); data[1] = list.get(i).getModel(); data[2] = list.get(i).getQty(); data[3] = "Electronics"; model.addRow(data); } list.clear(); list = MobileDB.checkStock(); for(int i=0; i<list.size(); i++){ data[0] = list.get(i).getBrand(); data[1] = list.get(i).getModel(); data[2] = list.get(i).getQty(); data[3] = "Mobiles"; model.addRow(data); } list.clear(); list = KidsDB.checkStock(); for(int i=0; i<list.size(); i++){ data[0] = list.get(i).getBrand(); data[1] = list.get(i).getModel(); data[2] = list.get(i).getQty(); data[3] = "Kids"; model.addRow(data); } }