当前位置: 首页>>代码示例>>Java>>正文


Java DefaultTableModel.setRowCount方法代码示例

本文整理汇总了Java中javax.swing.table.DefaultTableModel.setRowCount方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableModel.setRowCount方法的具体用法?Java DefaultTableModel.setRowCount怎么用?Java DefaultTableModel.setRowCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.table.DefaultTableModel的用法示例。


在下文中一共展示了DefaultTableModel.setRowCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populateReadersTable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void populateReadersTable(ReaderList readerList) {
    DefaultTableModel model = (DefaultTableModel) jTableReaders.getModel();
    model.setRowCount(0);
    model.setColumnCount(0);
    model.addColumn("ID");
    model.addColumn("First Name");
    model.addColumn("Last Name");
    model.addColumn("Email");
    model.addColumn("Mobile");
    model.addColumn("Street");
    model.addColumn("City");
    model.addColumn("Postal Code");
    model.addColumn("National ID");

    for (Reader reader : readerList) {
        model.addRow(reader.toStringArray());
    }

}
 
开发者ID:chathuras,项目名称:OOP-LMSFCPL,代码行数:20,代码来源:Application.java

示例2: populatemainTable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
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()
  				});
}
  }
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:19,代码来源:AllReservationsWindow.java

示例3: populateCustomerTable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void populateCustomerTable(String roomText, DefaultTableModel model) {

		// clean table model
		model.setRowCount(0);

		// import all customers from database
		final Room foundedRoom = roomDaoImpl.getRoomByRoomNumber(roomText);

		final CustomerDaoImpl customerDaoImpl = new CustomerDaoImpl();
		final List<Customer> custmerList = customerDaoImpl.getCustomerByReservId(foundedRoom.getReservationId());

		int index = 0;
		// populate table model with loop
		for (Customer cst : custmerList) {
			index++;
			final Object[] rowData = new Object[] { index, cst.getFirstName(), cst.getLastName() };
			model.addRow(rowData);
		}
	}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:20,代码来源:RoomWindow.java

示例4: populatePostPayTable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void populatePostPayTable(DefaultTableModel model) {

		// import all customers from database
		final PostingDaoImpl postingDaoImpl = new PostingDaoImpl();
		List<Posting> postingList = postingDaoImpl.getAllPostingsByRoomNumber(roomNumber, hotelSystemStatus.getDateTime().toString());

		final PaymentDaoImpl paymentDaoImpl = new PaymentDaoImpl();
		List<Payment> paymentlist = paymentDaoImpl.getAllPaymentsByRoomNumber(roomNumber, hotelSystemStatus.getDateTime().toString());

		// clean table model
		model.setRowCount(0);

		for (Posting pos : postingList) {

			model.addRow(new Object[] { pos.getId(), pos.getPostType(), pos.getTitle(), pos.getPrice(),
					pos.getCurrency(), pos.getExplanation(), pos.getDateTime() });
		}

		for (Payment pay : paymentlist) {

			model.addRow(new Object[] { pay.getId(), pay.getPaymentType(), pay.getTitle(), pay.getPrice(),
					pay.getCurrency(), pay.getExplanation(), pay.getDateTime() });
		}
	}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:25,代码来源:RoomWindow.java

示例5: populatetable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:22,代码来源:JtableUtils.java

示例6: search

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void search() {
   	try {
   		DefaultTableModel model = (DefaultTableModel)results.getModel();
		Vector<Project> projects = new Vector<Project>();
		String selectedItem = tagSelectBox.getSelectedItem().toString();
    	if(!selectedItem.equals("") && !selectedItem.equals(" ")){
    		projects=ProjectImpl.findProjectByAllTagName(tagSelectBox.getSelectedItem().toString());
    	}
    	else if (!manualTagTextField.getText().toString().equals("")){
    		projects=ProjectImpl.findProjectByAllTagName(manualTagTextField.getText().toString());
    	}
 
    	if(projects.size()==0){
    		JOptionPane.showMessageDialog(null, Local.getString("No project found for this tag"));
    	}
    	else {
    		model.setRowCount(0);
	    	for(int i=0;i < projects.size();i++){
	    		model.addRow(new Object[]{projects.get(i).getTitle(), projects.get(i).getTagsAsString()});
	    	}
    	}
   	} catch (NullPointerException e) {
   		Util.error(e);
   		JOptionPane.showMessageDialog(null,  Local.getString("No project found for this tag"));
   	}
	
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:28,代码来源:TagSearchController.java

示例7: cpfActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void cpfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cpfActionPerformed
    // TODO add your handling code here:
    
    ArrayList<Usuario> aux = NegocioFacade.listaUsuarios();        
    Collections.sort(aux, new CPFComparator());
    
    DefaultTableModel model = (DefaultTableModel)jtb_Proprietarios.getModel();
    model.setRowCount(0);
    
    for(Usuario a : aux){
        model.addRow(new Object[]{ a.getNome(), a.getCpf(), a.getEmail(), a.getFone() });
    }   
    jtb_Proprietarios.setModel(model);
}
 
开发者ID:Mentz,项目名称:PPRCarTrade,代码行数:15,代码来源:TelaBuscarProprietario.java

示例8: clearJTable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public static synchronized void clearJTable(JTable table) {
    try {
        DefaultTableModel def = (DefaultTableModel) table.getModel();
        def.setRowCount(0);
    } catch (Exception e) {
    }
}
 
开发者ID:isu3ru,项目名称:java-swing-template,代码行数:8,代码来源:Utilities.java

示例9: refreshUserLevelsList

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void refreshUserLevelsList() {
    DefaultTableModel def = (DefaultTableModel) jXTable1.getModel();
    def.setRowCount(0);
    List<UserLevel> uls = UserController.getUserLevelsList();
    for (UserLevel ul : uls) {
        Vector v = new Vector();
        v.add(ul);
        v.add(ul.getLevelName());
        v.add(ul.getLevelDisplayName());
        v.add(ul.isActiveLevel());
        def.addRow(v);
    }
}
 
开发者ID:isu3ru,项目名称:java-swing-template,代码行数:14,代码来源:UserLevels.java

示例10: jrb_AnoActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void jrb_AnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_AnoActionPerformed
    // TODO add your handling code here:        
    ArrayList<VendaVeiculo> aux = NegocioFacade.listaVeiculos();        
    Collections.sort(aux, new AnoVeiculoComparator());
    
    DefaultTableModel model = (DefaultTableModel)jtb_Veiculos.getModel();
    model.setRowCount(0);
    for(VendaVeiculo a : aux){
        model.addRow(new Object[]{ a.getVeiculo().getMarca(), a.getVeiculo().getModelo(),
                               a.getVeiculo().getCor(), a.getVeiculo().getAno(), a.getPreco()});
    }
    
    jtb_Veiculos.setModel(model);
}
 
开发者ID:Mentz,项目名称:PPRCarTrade,代码行数:15,代码来源:TelaBuscarVeiculo.java

示例11: jrb_MenorPrecoActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void jrb_MenorPrecoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_MenorPrecoActionPerformed
    // TODO add your handling code here:
    ArrayList<VendaVeiculo> aux = NegocioFacade.listaVeiculos();        
    Collections.sort(aux, new MenorPrecoVeiculoComparator());
    
    DefaultTableModel model = (DefaultTableModel)jtb_Veiculos.getModel();
    model.setRowCount(0);
    for(VendaVeiculo a : aux){
        model.addRow(new Object[]{ a.getVeiculo().getMarca(), a.getVeiculo().getModelo(),
                               a.getVeiculo().getCor(), a.getVeiculo().getAno(), a.getPreco()});
    }
    
    jtb_Veiculos.setModel(model);
}
 
开发者ID:Mentz,项目名称:PPRCarTrade,代码行数:15,代码来源:TelaBuscarVeiculo.java

示例12: jrb_MaiorPrecoActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void jrb_MaiorPrecoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_MaiorPrecoActionPerformed
    // TODO add your handling code here:
    ArrayList<VendaVeiculo> aux = NegocioFacade.listaVeiculos();        
    Collections.sort(aux, new MaiorPrecoVeiculoComparator());
    
   DefaultTableModel model = (DefaultTableModel)jtb_Veiculos.getModel();
   model.setRowCount(0);
    for(VendaVeiculo a : aux){
        model.addRow(new Object[]{ a.getVeiculo().getMarca(), a.getVeiculo().getModelo(),
                               a.getVeiculo().getCor(), a.getVeiculo().getAno(), a.getPreco()});
    }
    
    jtb_Veiculos.setModel(model);
}
 
开发者ID:Mentz,项目名称:PPRCarTrade,代码行数:15,代码来源:TelaBuscarVeiculo.java

示例13: TelaVisualizarComentariosUsuario

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public TelaVisualizarComentariosUsuario(TelaBuscarProprietario tela, UsuDados proprietario){
    this();
    this.telaBusca = tela;
    
    DefaultTableModel model = (DefaultTableModel)jtb_Comentarios.getModel();
    model.setRowCount(0);
    
    ArrayList<Usuario> aux = Negocio.NegocioFacade.listaUsuarios();
    
    for(Usuario a : aux){
        if(a.getCpf().equals(proprietario.getCpf())){
            for(Comentario c : a.getComentUsu()){
                if(c.getComment() != ""){
                    String usuario = "";
                    int i = 0;
                    for(i = 0; i < c.getComment().length() && c.getComment().charAt(i) != '&'; i++){
                        usuario += c.getComment().charAt(i);
                    }
                    i++;
                    String comentario = "";
                    for(; i < c.getComment().length(); i++){
                        comentario += c.getComment().charAt(i);
                    }
                    model.addRow(new Object[]{ usuario, comentario });
                }
            }
        }
    }
    
    jtb_Comentarios.setModel(model);
    
}
 
开发者ID:Mentz,项目名称:PPRCarTrade,代码行数:33,代码来源:TelaVisualizarComentariosUsuario.java

示例14: TelaVisualizarComentarios

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public TelaVisualizarComentarios(TelaUsuarioVendas tela, VendaVeiculo veiculo){
    this();        
    this.tela = tela;
    this.veiculo = veiculo;
    
    DefaultTableModel model = (DefaultTableModel)jtb_Comentarios.getModel();
    model.setRowCount(0);        
    
    for(Comentario c : veiculo.getComentarios()){
        if(c.getComment() != ""){
            String usuario = "";
            int i = 0;
            for(i = 0; i < c.getComment().length() && c.getComment().charAt(i) != '&'; i++){
                usuario += c.getComment().charAt(i);
            }
            i++;
            String comentario = "";
            for(; i < c.getComment().length(); i++){
                comentario += c.getComment().charAt(i);
            }
            model.addRow(new Object[]{ usuario, comentario });
        }
    }
    
    jtb_Comentarios.setModel(model);
   
}
 
开发者ID:Mentz,项目名称:PPRCarTrade,代码行数:28,代码来源:TelaVisualizarComentarios.java

示例15: populateBlokajRoomsModel

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
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;
            }
        }
    }
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:16,代码来源:Main_Blockade.java


注:本文中的javax.swing.table.DefaultTableModel.setRowCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。