本文整理汇总了Java中javax.swing.table.DefaultTableModel.addColumn方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableModel.addColumn方法的具体用法?Java DefaultTableModel.addColumn怎么用?Java DefaultTableModel.addColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.table.DefaultTableModel
的用法示例。
在下文中一共展示了DefaultTableModel.addColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CriarTabela2
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private DefaultTableModel CriarTabela2(){
DefaultTableModel tabela2 = new DefaultTableModel() {
private static final long serialVersionUID = 1L;
@Override
public boolean isCellEditable(int linha, int coluna) {
return false;
}
};
/*Bloco com definições e valores específicos da tabela do FGTS*/
gui.getTblFGTS().setModel(tabela2);
tabela2.addColumn(null);
tabela2.addColumn(null);
gui.getTblFGTS().getColumnModel().getColumn(0).setResizable(false);
gui.getTblFGTS().getColumnModel().getColumn(0).setPreferredWidth(350);
gui.getTblFGTS().getColumnModel().getColumn(1).setResizable(false);
gui.getTblFGTS().getColumnModel().getColumn(1).setPreferredWidth(135);
/*Fim do bloco */
return tabela2;
}
示例2: SoftwareTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public SoftwareTable() {
DefaultTableModel model = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
model.addColumn("Domain");
model.addColumn("Name");
model.addColumn("Version");
model.addColumn("CVSS Score");
model.addColumn("Vulnerabilities");
setModel(model);
this.defaultModel = model;
}
示例3: Fine
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
* Creates new form Fine
*/
public Fine() {
initComponents();
model = new DefaultTableModel();
model.addColumn("id");
model.addColumn("codigo usuario");
model.addColumn("Nombre");
model.addColumn("id_prestamo");
model.addColumn("valor");
fineDao.readFine(model);
jTableEquipment.getTableHeader().setReorderingAllowed(false);
jTableEquipment.setModel(model);
jScrollPane1.setViewportView(jTableEquipment);
}
示例4: Devolution
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
* Creates new form Devolution
*/
public Devolution(String Profile,int code) {
initComponents();
model = new DefaultTableModel();
model.addColumn("Codigo_usuario");
model.addColumn("Nombre_usuario");
model.addColumn("Numero_equipo");
model.addColumn("Nombre_equipo");
model.addColumn("Fecha_prestamo");
model.addColumn("Fecha_devolucion");
deshability(Profile,code);
}
示例5: addColumn
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public TableColumn addColumn(Object columnIdentifier, int width,
TableCellRenderer renderer,
TableCellEditor editor, List columnData) {
checkDefaultTableModel();
// Set up the model side first
DefaultTableModel m = (DefaultTableModel)getModel();
m.addColumn(columnIdentifier, columnData.toArray());
// The column will have been added to the end, so the index of the
// column in the model is the last element.
TableColumn newColumn = new TableColumn(
m.getColumnCount()-1, width, renderer, editor);
super.addColumn(newColumn);
return newColumn;
}
示例6: 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());
}
}
示例7: 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;
}
示例8: Estadisticas
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public Estadisticas(ArrayList<Alumno> l) {
initComponents();
DefaultTableModel modelo = new DefaultTableModel();
modelo.addColumn("Nombre");
modelo.addColumn("CUIL");
jTable1.setModel(modelo);
String []pt = new String[4];
for(Alumno a : l) {
pt[0] = a.nombre;
pt[1] = String.valueOf(a.puntajeAcumulado);
modelo.addRow(pt);
}
}
示例9: getTableModel4Slot
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
* This returns the 'DefaultTableModel' for a single
* class out of the ontology-classes.
*
* @return the table model4 slot
*/
public DefaultTableModel getTableModel4Slot() {
DefaultTableModel tm4s = new DefaultTableModel();
tm4s.addColumn("Name");
tm4s.addColumn("Cardinality");
tm4s.addColumn("Type");
tm4s.addColumn("Other Facets");
if (ontologySubClass == null) {
return tm4s;
}
// --- Nach den entsprechenden Slots im Vokabular filtern ---
Hashtable<String, String> ontoSlotHash = ontologyClass.ontologieVocabulary.getSlots(ontologySubClass);
ReflectClass reflectedClass = new ReflectClass(ontologySubClass, ontoSlotHash);
Vector<String> v = new Vector<String>( ontoSlotHash.keySet() );
Collections.sort(v);
Iterator<String> it = v.iterator();
while (it.hasNext()) {
// --- Get Word of the ontology -------------------------
String key = it.next();
String word = ontoSlotHash.get(key);
// --- Get Slot... --------------------------------------
Slot currSlot = reflectedClass.getSlot(word);
// --- Add table row ------------------------------------
Vector<String> rowData = new Vector<String>();
rowData.add(word );
rowData.add(currSlot.Cardinality);
rowData.add(currSlot.VarType);
rowData.add(currSlot.OtherFacts);
tm4s.addRow(rowData);
}
// ----------------------------------------------------------
// --- Are there slots from the parent Node? ----------------
// ----------------------------------------------------------
if (parentOntologyClassTreeObject!=null) {
DefaultTableModel subTBmodel = parentOntologyClassTreeObject.getTableModel4Slot();
Vector<?> subDataVector = subTBmodel.getDataVector();
for (int i = 0; i < subDataVector.size(); i++) {
Vector<?> rowVector = (Vector<?>) subDataVector.get(i);
tm4s.addRow(rowVector);
}
Sorter.sortTableModel(tm4s, 0);
}
// ----------------------------------------------------------
return tm4s;
}
示例10: CriarTabela1
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private DefaultTableModel CriarTabela1(){
// Modelo padrão para definição da Jtable1
DefaultTableModel tabela1 = new DefaultTableModel() {
private static final long serialVersionUID = 1L;
// Método resṕonsável por bloquear a edição das células
@Override
public boolean isCellEditable(int linha, int coluna) {
return false;
}
};
/*Bloco com definições e valores específicos da tabela de rescisão*/
gui.getTblRescisao().setModel(tabela1);
tabela1.addColumn("Item");
tabela1.addColumn("Referência");
tabela1.addColumn("Valor");
gui.getTblRescisao().getColumnModel().getColumn(0).setResizable(false);
gui.getTblRescisao().getColumnModel().getColumn(0).setPreferredWidth(250);
gui.getTblRescisao().getColumnModel().getColumn(1).setResizable(false);
gui.getTblRescisao().getColumnModel().getColumn(1).setPreferredWidth(100);
gui.getTblRescisao().getColumnModel().getColumn(2).setResizable(false);
gui.getTblRescisao().getColumnModel().getColumn(2).setPreferredWidth(135);
/*Fim do bloco*/
return tabela1;
}
示例11: RulesTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public RulesTable() {
DefaultTableModel model = new DefaultTableModel();
model.addColumn("Software");
model.addColumn("Regex");
model.addColumn("Alias");
model.addColumn("Type");
setModel(model);
this.defaultModel = model;
}
示例12: PathsTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public PathsTable() {
DefaultTableModel model = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int column) {
return false;
}
};
model.addColumn("Domain");
model.addColumn("path");
model.addColumn("CVSS Score");
model.addColumn("Vulnerabilities");
setModel(model);
this.defaultModel = model;
}
示例13: loadFileinTable
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public static void loadFileinTable(File file, JTable table) {
if (file.exists()) {
try (Reader in = new FileReader(file)) {
CSVParser parser = CSVFormat.EXCEL.withHeader().withSkipHeaderRecord().withIgnoreEmptyLines().parse(in);
if (!parser.getHeaderMap().isEmpty()) {
DefaultTableModel model = (DefaultTableModel) table.getModel();
for (String columnHeader : parser.getHeaderMap().keySet()) {
if (!columnHeader.trim().isEmpty()) {
model.addColumn(columnHeader);
}
}
List<CSVRecord> records = parser.getRecords();
for (CSVRecord record : records) {
Object[] row = new Object[record.size()];
for (int i = 0; i < record.size(); i++) {
row[i] = record.get(i);
}
model.addRow(row);
}
}
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, null, ex);
}
} else {
LOGGER.log(Level.SEVERE, "File [{0}] doesn''t exist", file.getAbsolutePath());
}
}
示例14: PanneauCalendrier
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public PanneauCalendrier(Projet projet){
//Affichage de la fenêtre
this.setSize(1500, 800);
this.setLayout(new BorderLayout());
this.setVisible(true);
//Cadre
label = new JLabel();
label.setHorizontalAlignment(SwingConstants.CENTER);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
//Taille du tableau (lignes, colonnes)
//TODO Modifier le nombre de colonnes en fonction de la durée du projet
model = new DefaultTableModel(projet.getLotList().size(),0);
model.addColumn("Lots");
//Ajout des dates dans le tableau
for(String item :projet.getCalendar().getDatesBetween()){
model.addColumn(item);
}
//Ajouter les lignes des lots ordonnés
for (int k = 0; k < projet.getLotList().size(); k++){
//model.addRow(row);
//model.setValueAt(projet.getLotList().get(k).getName(), k, 0);
}
//Colorier les cases du tableau pendant la durée d'un lot
ArrayList<String> projectDuration = projet.getCalendar().getDatesBetween();
ArrayList<String> lotDuration;
String value = "1";
for (int h = 0; h < projet.getLotList().size(); h++){
lotDuration = projet.getLotList().get(h).getDatesBetween();
for (int i = 0; i < projectDuration.size(); i++){
for (int j = 0; j < lotDuration.size(); j++){
if (projectDuration.get(i) == lotDuration.get(j)){
model.setValueAt(value, h, i+1);
}
}
}
}
//Création du tableau
JTable table = new JTable(model);
//Disable réduction des colonnes
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
//Barre de défilements
JScrollPane pane = new JScrollPane(table);
this.add(panel, BorderLayout.NORTH);
this.add(pane, BorderLayout.CENTER);
}
示例15: initLocalData
import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
protected void initLocalData(){
collator = Collator.getInstance(Locale.ENGLISH);
collator.setStrength(Collator.TERTIARY);
documentTableModel = new DefaultTableModel();
documentTableModel.addColumn("Document");
documentTableModel.addColumn("Match");
documentTableModel.addColumn("Only A");
documentTableModel.addColumn("Only B");
documentTableModel.addColumn("Overlap");
annotationTableModel = new DefaultTableModel();
annotationTableModel.addColumn("Annotation");
annotationTableModel.addColumn("Match");
annotationTableModel.addColumn("Only A");
annotationTableModel.addColumn("Only B");
annotationTableModel.addColumn("Overlap");
document2TableModel = new DefaultTableModel();
document2TableModel.addColumn("Document");
document2TableModel.addColumn("Agreed");
document2TableModel.addColumn("Total");
confusionTableModel = new DefaultTableModel();
types = new TreeSet<String>(collator);
corpusChanged = false;
measuresType = FSCORE_MEASURES;
doubleComparator = new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
if (s1 == null || s2 == null) {
return 0;
} else if (s1.equals("")) {
return 1;
} else if (s2.equals("")) {
return -1;
} else {
return Double.valueOf(s1).compareTo(Double.valueOf(s2));
}
}
};
totalComparator = new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
if (s1 == null || s2 == null) {
return 0;
} else if (s1.equals("Micro summary")) {
return s2.equals("Macro summary") ? -1 : 1;
} else if (s1.equals("Macro summary")) {
return s2.equals("Micro summary") ? -1 : 1;
} else if (s2.equals("Micro summary")) {
return s1.equals("Macro summary") ? 1 : -1;
} else if (s2.equals("Macro summary")) {
return s1.equals("Micro summary") ? 1 : -1;
} else {
return s1.compareTo(s2);
}
}
};
}