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


Java DefaultTableModel.setColumnIdentifiers方法代码示例

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


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

示例1: Soru3

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public Soru3() {
    initComponents();

    dtm = new DefaultTableModel();
    dtm.setColumnIdentifiers(new Object[]{"ID", "ADI", "SOYADI", "MAAS"});
    jTable1.setModel(dtm);
    try {
        // bağlantı için
        Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/PERSONELDB", "sa", "as");
        // iletişimi acıyor
        Statement stmt = con.createStatement();
        // veritabanında sorgu çalıştırıp bize geri tablo döndürüyor.
        ResultSet rs = stmt.executeQuery("SELECT * FROM PERSONEL");

        while (rs.next()) {
            int id = rs.getInt("ID");
            String adi = rs.getString("ADI");
            String soyadi = rs.getString("SOYADI");
            int maas = rs.getInt("MAAS");
            dtm.addRow(new Object[]{id, adi, soyadi, maas});
        }

    } catch (SQLException ex) {
        Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:sametkaya,项目名称:Java_Swing_Programming,代码行数:27,代码来源:Soru3.java

示例2: loadTableBD

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void loadTableBD(int num) {
    Result res = db.execute("MATCH (n:`Avion`{numero:"+num+"}) RETURN n.numero, n.type, n.capacite");
    DefaultTableModel dtm = new DefaultTableModel(0,0);
    String header[] = {"Numero", "Type", "Capacite"};
    String test[] = {"n.numero", "n.type", "n.capacite"};
    dtm.setColumnIdentifiers(header);
    jTable1.setModel(dtm);
    while(res.hasNext()) {
        Map<String, Object> row = res.next();
        Map<String, Object> obj = new LinkedHashMap();
        for (String t:test) {
            obj.put(t, null);
        }
        for(Map.Entry<String, Object> col : row.entrySet()) {
             obj.put(col.getKey(),col.getValue());   
        }
        
        dtm.addRow(obj.values().toArray());
}
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:21,代码来源:AfficherAvions.java

示例3: loadTableBD

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void loadTableBD() {
    Result res = db.execute("MATCH (n:`Personnel`) RETURN n.cin, n.numPassport, n.nom, n.adresse, n.telephone, n.type");
    DefaultTableModel dtm = new DefaultTableModel(0,0);
    String header[] = {"Cin", "Passeport", "Nom", " Adresse", "Telephone", "Type"};
    String test[] = {"n.cin", "n.numPassport", "n.nom", "n.adresse", "n.telephone", "n.type"};
    dtm.setColumnIdentifiers(header);
    jTable1.setModel(dtm);
    while(res.hasNext()) {
        Map<String, Object> row = res.next();
        Map<String, Object> obj = new LinkedHashMap();
        for (String t:test) {
            obj.put(t, null);
        }
        for(Map.Entry<String, Object> col : row.entrySet()) {
             obj.put(col.getKey(),col.getValue());   
        }
        dtm.addRow(obj.values().toArray());
}
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:20,代码来源:AfficherEmployees.java

示例4: loadTableBD

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void loadTableBD() {
    Result res = db.execute("MATCH (n:`Vol`) RETURN n.numero, n.villeDep, n.villeArr, n.heureDep, n.heureArr, n.distance, n.frequence ORDER BY n.numero");
    DefaultTableModel dtm = new DefaultTableModel(0,0);
    String header[] = {"n.numero", "Depart", "Arrivee", "Heure Depart", "Heure Arrivee", "Distance", "Frequence"};
    String test[] = {"n.numero", "n.villeDep", "n.villeArr", "n.heureDep", "n.heureArr", "n.distance", "n.frequence"};
    dtm.setColumnIdentifiers(header);
    jTable1.setModel(dtm);
    while(res.hasNext()) {
        Map<String, Object> row = res.next();
        Map<String, Object> obj = new LinkedHashMap();
        for (String t:test) {
            obj.put(t, null);
        }
        for(Entry<String, Object> col : row.entrySet()) {
             obj.put(col.getKey(),col.getValue());   
        }
        
        dtm.addRow(obj.values().toArray());
}
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:21,代码来源:AfficherVols.java

示例5: loadTableBD

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void loadTableBD(int cin) {
    Result res = db.execute("MATCH (n:`Passager`{cin:"+cin+"}) RETURN n.cin, n.numPassport, n.nom, n.adresse, n.telephone");
    DefaultTableModel dtm = new DefaultTableModel(0,0);
    String header[] = {"Cin", "Passport", "Nom", " Adresse", "Telephone"};
    String test[] = {"n.cin", "n.numPassport", "n.nom", "n.adresse", "n.telephone"};
    dtm.setColumnIdentifiers(header);
    jTable1.setModel(dtm);
    while(res.hasNext()) {
        Map<String, Object> row = res.next();
        Map<String, Object> obj = new LinkedHashMap();
        for (String t:test) {
            obj.put(t, null);
        }
        for(Map.Entry<String, Object> col : row.entrySet()) {
             obj.put(col.getKey(),col.getValue());   
        }
        
        dtm.addRow(obj.values().toArray());
}
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:21,代码来源:AfficherPassagers.java

示例6: Soru2

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public Soru2() {
    initComponents();
    
    dtm = new DefaultTableModel();
    dtm.setColumnIdentifiers(new Object[]{"ID", "ADI", "SOYADI", "MAAS"});
    tbl_personeller.setModel(dtm);
    try {
        // bağlantı için
        Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/PERSONELDB", "sa", "as");
        // iletişimi acıyor
        Statement stmt = con.createStatement();
        // veritabanında sorgu çalıştırıp bize geri tablo döndürüyor.
        ResultSet rs = stmt.executeQuery("SELECT * FROM UNVAN");
        
        while (rs.next()) {
            int unvanno = rs.getInt("UNVANNO");
            String unvanadi = rs.getString("UNVANADI");
            cmb_unvanlar.addItem(unvanadi);
        }
    } catch (SQLException ex) {
        Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
    }
    
}
 
开发者ID:sametkaya,项目名称:Java_Swing_Programming,代码行数:25,代码来源:Soru2.java

示例7: JDBuscarCitaDoctor

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public JDBuscarCitaDoctor(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    
    //--------------inicializacion del disenio de la tabla----------------
    modeloCitasPacientes = new DefaultTableModel(); //le asignamos todas las funciones al modelo
    jtCitasPaciente.setModel(modeloCitasPacientes); //le asignamos a la tabla el modelo que creamos
    String Titulos1[] = {"No." ,"Apellidos Paciente", "Nombre Paciente", "Hora de la cita"}; //creamos una variable con el nombre que queremos para la tabla
    modeloCitasPacientes.setColumnIdentifiers(Titulos1); //le asignamos al modelo el nombre que creamos en la linea anterior
    //-------------------------------------------------------------------         
    
    //---------------------para que al ejecutar esta clase liste de una vez los doctores actuales--------------------------
    Cita nuevoListar = new Cita();
    nuevoListar.ColocarDoctoresCBX(cbxDoctores);
    //---------------------------------------------------------------------------------------------------------------------
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:17,代码来源:JDBuscarCitaDoctor.java

示例8: loadTableBD

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void loadTableBD(String dateAuj) {
    Result res = db.execute("MATCH (a:Avion)-[r:Affecter]->(d:Depart)<-[c:Constituer]-(v:Vol) WHERE d.date='"+dateAuj+"' RETURN d.numero, d.date, v.villeDep, v.villeArr,  a.type, a.capacite, v.numero, v.heureDep, v.heureArr");
    DefaultTableModel dtm = new DefaultTableModel(0,0);
    String header[] = {"Numero", "Date","Depart", "Arriveé", "Type", "Capacite", "NumVol", "Heure De Depart", "Heure d'arrive"};
    String test[] = {"d.numero", "d.date","v.villeDep", "v.villeArr", "a.type", "a.capacite", "v.numero", "v.heureDep", "v.heureArr"};
    dtm.setColumnIdentifiers(header);
    jTable1.setModel(dtm);
    while(res.hasNext()) {
        Map<String, Object> row = res.next();
        Map<String, Object> obj = new LinkedHashMap();
        for (String t:test) {
            obj.put(t, null);
        }
        for(Map.Entry<String, Object> col : row.entrySet()) {
             obj.put(col.getKey(),col.getValue());   
        }
        
        dtm.addRow(obj.values().toArray());
}
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:21,代码来源:MainWindow.java

示例9: init

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void init()
{
	model = new DefaultTableModel()
	{
		private static final long serialVersionUID = 1L;

		@Override
		public Class<?> getColumnClass(int c)
		{
			Object value = getValueAt(0, c);
			Class<?> cs = null;
			if( value != null )
			{
				cs = value.getClass();
			}
			else
			{
				cs = super.getColumnClass(c);
			}
			return cs;
		}
	};
	model.setColumnIdentifiers(getColumnNames());
	table = new JTable(model);
	table.getSelectionModel().addListSelectionListener(this);
	table.setRowHeight(20);

	int count = model.getColumnCount();
	for( int i = 0; i < count; i++ )
	{
		TableColumn column = table.getColumnModel().getColumn(i);
		processTableColumn(column, i);
	}
	table.doLayout();

	this.setLayout(new BorderLayout());
	this.add(new JScrollPane(table), BorderLayout.CENTER);
	this.add(createBottom(), BorderLayout.SOUTH);
}
 
开发者ID:equella,项目名称:Equella,代码行数:40,代码来源:AbstractTableMapping.java

示例10: Soru2

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
 * Creates new form Soru2
 */
public Soru2() {
    initComponents();
    dtm= new DefaultTableModel();
    dtm.setColumnIdentifiers(new Object[]{"NO","ADI","SOYADI","BÖLÜM","MAAS"});
    tbl_personel.setModel(dtm);
    
     dtm2= new DefaultTableModel();
    dtm2.setColumnIdentifiers(new Object[]{"BÖLÜM","MAAS"});
    tbl_ortalama.setModel(dtm2);
}
 
开发者ID:sametkaya,项目名称:Java_Swing_Programming,代码行数:14,代码来源:Soru2.java

示例11: Soru2

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public Soru2() {
    initComponents();
    dtm = new DefaultTableModel();
    dtm.setColumnIdentifiers(new Object[]{"ID", "ADI", "SOYADI", "BİRİM"});
    dtm.addRow(new Object[]{1, "AHMET", "AK", "MUHASEBE"});
    dtm.addRow(new Object[]{2, "HASAN", "MAVİ", "MÜDÜRLÜK"});
    dtm.addRow(new Object[]{3, "YAPRAK", "AĞAÇ", "YAZILIM"});
    dtm.addRow(new Object[]{4, "BEREN", "SAAT", "MÜDÜRLÜK"});
    tbl_personel.setModel(dtm);

}
 
开发者ID:sametkaya,项目名称:Java_Swing_Programming,代码行数:12,代码来源:Soru2.java

示例12: HastaApp

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public HastaApp() {
    initComponents();
    String[] ColoumNames = {"ID", "ADI", "SOYAD", "DOKTOR"};
    dtm = new DefaultTableModel();
    dtm.setColumnIdentifiers(ColoumNames);
    tbl_liste.setModel(dtm);
}
 
开发者ID:sametkaya,项目名称:Java_Swing_Programming,代码行数:8,代码来源:HastaApp.java

示例13: JDBuscarCitaPaciente

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public JDBuscarCitaPaciente(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    
    //--------------inicializacion del disenio de la tabla----------------
    modeloCitas = new DefaultTableModel(); //le asignamos todas las funciones al modelo
    jtCitas.setModel(modeloCitas); //le asignamos a la tabla el modelo que creamos
    String Titulos1[] = {"Apellidos del Doctor","Nombre del Doctor" ,"Fecha", "Hora"}; //creamos una variable con el nombre que queremos para la tabla
    modeloCitas.setColumnIdentifiers(Titulos1); //le asignamos al modelo el nombre que creamos en la linea anterior
    //-------------------------------------------------------------------          
    
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:13,代码来源:JDBuscarCitaPaciente.java

示例14: initialize

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    frame = new JFrame("Library Book Loan System - All Users");
    frame.setResizable(false);
    frame.setBounds(100, 100, 588, 400);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    
    JPanel panel = new JPanel();
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    panel.setLayout(null);
    
    JLabel lblAllBooks = new JLabel("All Users");
    lblAllBooks.setHorizontalAlignment(SwingConstants.CENTER);
    lblAllBooks.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
    lblAllBooks.setBounds(10, 40, 564, 22);
    panel.add(lblAllBooks);
    
    JLabel label_1 = new JLabel("Library Book Loan System");
    label_1.setHorizontalAlignment(SwingConstants.CENTER);
    label_1.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
    label_1.setBounds(10, 11, 564, 25);
    panel.add(label_1);
    
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 73, 564, 257);
    panel.add(scrollPane);
    
    Object columnNames[] = { "Username", "Email", "User Role"};
    DefaultTableModel model = new DefaultTableModel(1, columnNames.length);
    model.setColumnIdentifiers(columnNames);

    table = new JTable(model) {
        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };

    scrollPane.setViewportView(table);

    List<User> userList = UserController.getInstance().getAllUsers();

    ((DefaultTableModel) table.getModel()).removeRow(0);

    for (User user : userList) {
        ((DefaultTableModel) table.getModel()).addRow(
                new Object[]{user.getUsername(), user.getEmail(), user.getRole().toString()});
    }
    
    JLabel lblBooks = new JLabel(userList.size() + " User(s)");
    lblBooks.setBounds(528, 336, 46, 14);
    panel.add(lblBooks);
}
 
开发者ID:hisener,项目名称:bbm487s2017g1,代码行数:56,代码来源:LibrarianAllUsers.java

示例15: KeHuChaXun

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public KeHuChaXun() {
	super();
	setIconifiable(true);
	setClosable(true);
	setTitle("�ͻ���Ϣ��ѯ");
	getContentPane().setLayout(new GridBagLayout());
	setBounds(100, 100, 640, 375);

	table = new JTable();
	table.setEnabled(false);
	table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	String[] tableHeads = new String[]{"�ͻ�ID", "�ͻ�ȫ��", "�ͻ���ַ", "�ͻ����",
			"��������", "�硡����", "��������", "��  ϵ  ��", "��ϵ�绰", "E-Mail", "��������",
			"�����˺�"};
	final DefaultTableModel dftm = (DefaultTableModel) table.getModel();
	dftm.setColumnIdentifiers(tableHeads);
	
	final JScrollPane scrollPane = new JScrollPane(table);
	scrollPane.setAutoscrolls(true);
	final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();
	gridBagConstraints_6.weighty = 1.0;
	gridBagConstraints_6.insets = new Insets(0, 10, 5, 10);
	gridBagConstraints_6.fill = GridBagConstraints.BOTH;
	gridBagConstraints_6.gridwidth = 6;
	gridBagConstraints_6.gridy = 1;
	gridBagConstraints_6.gridx = 0;
	getContentPane().add(scrollPane, gridBagConstraints_6);

	setupComponet(new JLabel(" ѡ���ѯ������"), 0, 0, 1, 1, false);
	conditionBox1 = new JComboBox();
	conditionBox1.setModel(new DefaultComboBoxModel(new String[]{"�ͻ�ȫ��",
			"�ͻ����"}));
	setupComponet(conditionBox1, 1, 0, 1, 30, true);

	conditionBox2 = new JComboBox();
	conditionBox2.setModel(new DefaultComboBoxModel(
			new String[]{"����", "����"}));
	setupComponet(conditionBox2, 2, 0, 1, 30, true);

	conditionContent = new JTextField();
	setupComponet(conditionContent, 3, 0, 1, 140, true);

	final JButton queryButton = new JButton();
	queryButton.addActionListener(new queryAction(dftm));
	queryButton.setText("��ѯ");
	setupComponet(queryButton, 4, 0, 1, 1, false);

	showAllButton = new JButton();
	showAllButton.addActionListener(new ActionListener() {
		public void actionPerformed(final ActionEvent e) {
			conditionContent.setText("");
			List list = Dao.getKhInfos();
			updateTable(list, dftm);
		}
	});
	setupComponet(showAllButton, 5, 0, 1, 1, false);
	showAllButton.setText("��ʾȫ������");
}
 
开发者ID:Edward7Zhang,项目名称:SuperMarketManageSystem,代码行数:59,代码来源:KeHuChaXun.java


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