本文整理匯總了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());
}
}
示例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()
});
}
}
示例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);
}
}
示例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() });
}
}
示例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;
}
示例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"));
}
}
示例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);
}
示例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) {
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
}
}