當前位置: 首頁>>代碼示例>>Java>>正文


Java JXTable.setModel方法代碼示例

本文整理匯總了Java中org.jdesktop.swingx.JXTable.setModel方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.setModel方法的具體用法?Java JXTable.setModel怎麽用?Java JXTable.setModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdesktop.swingx.JXTable的用法示例。


在下文中一共展示了JXTable.setModel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LlenarTabla

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public void LlenarTabla(JXTable tabla) throws ClassNotFoundException{
    
    DefaultTableModel modeloT = new DefaultTableModel();
    tabla.setModel(modeloT);
    
    modeloT.addColumn("Usuario");
    modeloT.addColumn("Fecha");
    modeloT.addColumn("Descripcion");
    
    Object[] columna = new Object[3];
    
    int numeroRegistros= modelo.listar().size();
    for ( int i=0; i<numeroRegistros;i++){
            columna[0]=modelo.listar().get(i).getId_usuario();
            columna[1]=modelo.listar().get(i).getFecha();
            columna[2]=modelo.listar().get(i).getDescripcion();
            modeloT.addRow(columna);
    }
    
}
 
開發者ID:gonzapala,項目名稱:CPI,代碼行數:21,代碼來源:Listar_Registros.java

示例2: LlenarTabla

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public void LlenarTabla(JXTable tabla) throws ClassNotFoundException{
    
    DefaultTableModel modeloT = new DefaultTableModel();
    tabla.setModel(modeloT);
    
    modeloT.addColumn("Nombre");
    modeloT.addColumn("Usuario");
    modeloT.addColumn("Tipo");
    
    Object[] columna = new Object[3];
    
    int numeroRegistros= modelo.listar().size();
    //        System.out.println(numeroRegistros);
    for ( int i=0; i<numeroRegistros;i++){
            columna[0]=modelo.listar().get(i).getNombre();
            columna[1]=modelo.listar().get(i).getContraseña();
            columna[2]=modelo.listar().get(i).getId_rol();

            modeloT.addRow(columna);
    }
    
}
 
開發者ID:gonzapala,項目名稱:CPI,代碼行數:23,代碼來源:Gestionar_usuarios.java

示例3: LlenarTabla

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public void LlenarTabla(JXTable tabla_socios){
    DefaultTableModel modeloT = new DefaultTableModel();
    tabla_socios.setModel(modeloT);
    
    modeloT.addColumn("Legajo");
    modeloT.addColumn("Apellido");
    modeloT.addColumn("Nombre");
    modeloT.addColumn("DNI");
    modeloT.addColumn("Socio");
    
    Object[] columna = new Object[5];
    
    int numeroRegistros= modeloCRUD.listarSocios().size();
    for ( int i=0; i<numeroRegistros;i++){
        columna[0]=modeloCRUD.listarSocios().get(i).getLegajo_socio();
        columna[1]=modeloCRUD.listarSocios().get(i).getApellido();
        columna[2]=modeloCRUD.listarSocios().get(i).getNombre();
        columna[3]=modeloCRUD.listarSocios().get(i).getDni();
        columna[4]=modeloCRUD.listarSocios().get(i).getEstado();
        modeloT.addRow(columna);
    
    }
    
}
 
開發者ID:gonzapala,項目名稱:CPI,代碼行數:25,代碼來源:SocioController.java

示例4: LlenarTabla

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public void LlenarTabla(JXTable tabla_socios){
    DefaultTableModel modeloT = new DefaultTableModel();
    tabla_socios.setModel(modeloT);
    
    modeloT.addColumn("Legajo");
    modeloT.addColumn("Apellido");
    modeloT.addColumn("Nombre");
    modeloT.addColumn("DNI");
    modeloT.addColumn("Socio");
    
    Object[] columna = new Object[5];
    
    int numeroRegistros= socio.listarSocios().size();
    for ( int i=0; i<numeroRegistros;i++){
        columna[0]=socio.listarSocios().get(i).getLegajo_socio();
        columna[1]=socio.listarSocios().get(i).getApellido();
        columna[2]=socio.listarSocios().get(i).getNombre();
        columna[3]=socio.listarSocios().get(i).getDni();
        columna[4]=socio.listarSocios().get(i).getEstado();
        modeloT.addRow(columna);
    
    }
    
}
 
開發者ID:gonzapala,項目名稱:CPI,代碼行數:25,代碼來源:PagosController.java

示例5: interactiveTestColumnControlColumnModel

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue ??: Column control on changing column model.
 * 
 */
public void interactiveTestColumnControlColumnModel() {
    final JXTable table = new JXTable(10, 5);
    table.setColumnControlVisible(true);
    Action toggleAction = new AbstractAction("Set ColumnModel") {

        @Override
        public void actionPerformed(ActionEvent e) {
            table.setColumnModel(new DefaultTableColumnModel());
            table.setModel(new AncientSwingTeam());
            setEnabled(false);
        }

    };
    JXFrame frame = wrapWithScrollingInFrame(table,
            "ColumnControl: set columnModel ext -> core default");
    addAction(frame, toggleAction);
    frame.setVisible(true);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:23,代碼來源:ColumnControlButtonVisualCheck.java

示例6: interactiveTestColumnControlColumnModelExt

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue ??: Column control cancontrol update on changing column model.
 * 
 */
public void interactiveTestColumnControlColumnModelExt() {
    final JXTable table = new JXTable();
    table.setColumnModel(new DefaultTableColumnModel());
    table.setModel(new DefaultTableModel(10, 5));
    table.setColumnControlVisible(true);
    Action toggleAction = new AbstractAction("Set ColumnModelExt") {

        @Override
        public void actionPerformed(ActionEvent e) {
            table.setColumnModel(new DefaultTableColumnModelExt());
            table.setModel(new AncientSwingTeam());
            table.getColumnExt(0).setVisible(false);
            setEnabled(false);
        }

    };
    JXFrame frame = wrapWithScrollingInFrame(table,
            "ColumnControl: set ColumnModel core -> modelExt");
    addAction(frame, toggleAction);
    frame.setVisible(true);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:26,代碼來源:ColumnControlButtonVisualCheck.java

示例7: interactiveTestColumnControlSetModelToggleInvisibleColumns

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue #212: programmatically toggle column vis does not work.
 * 
 * Visual check: compare toggle column visibility both via the columnControl
 * and programmatically by button. While the columnControl prevents to hide
 * the very last visible column, developers have full control to do so
 * programatically.
 * 
 * 
 */
public void interactiveTestColumnControlSetModelToggleInvisibleColumns() {
    final JXTable table = new JXTable();
    table.setColumnControlVisible(true);
    JXFrame frame = wrapWithScrollingInFrame(table,
            "ColumnControl (#212-swingx) setModel and toggle first column invisible");
    frame.setVisible(true);
    table.setModel(new DefaultTableModel(10, 2));
    final TableColumnExt firstNameColumn = table.getColumnExt(1);
    Action action = new AbstractAction("Toggle first name visibility") {

        @Override
        public void actionPerformed(ActionEvent e) {
            firstNameColumn.setVisible(!firstNameColumn.isVisible());

        }

    };
    addAction(frame, action);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:30,代碼來源:ColumnControlButtonVisualCheck.java

示例8: testTableCopeWithCreateNullColumn

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue #564-swingx: allow custom factories to return null column.
 * Here: test that table can cope with null columns on create.
 */
@Test
public void testTableCopeWithCreateNullColumn() {
    // factory returns null on create
    ColumnFactory factory = new ColumnFactory() {

        @Override
        public TableColumnExt createTableColumn(int modelIndex) {
            return modelIndex > 0 ? super.createTableColumn(modelIndex) : null;
        }
        
        
    };
    JXTable table = new JXTable();
    table.setColumnFactory(factory);
    TableModel model = new DefaultTableModel(0, 10);
    table.setModel(model);
    assertEquals("factory must have created one less than model columns", 
            model.getColumnCount() - 1, table.getColumnCount());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:24,代碼來源:ColumnFactoryTest.java

示例9: testNullVisibilityAction

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Tests if subclasses are allowed to not create a visibility action.
 * This might happen if they want to exempt certain columns from 
 * user interaction.
 *
 */
@Test
public void testNullVisibilityAction() {
    JXTable table = new JXTable();
    ColumnControlButton columnControl = new ColumnControlButton(table) {

                @Override
                protected ColumnVisibilityAction createColumnVisibilityAction(TableColumn column) {
                    if (column.getModelIndex() == 0) return null;
                    return super.createColumnVisibilityAction(column);
                }
        
        
    };
    table.setColumnControl(columnControl);
    table.setColumnControlVisible(true);
    table.setModel(sortableTableModel);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:24,代碼來源:ColumnControlButtonTest.java

示例10: initJTableFiles

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
private void initJTableFiles()   {
    jTableFiles = new JXTable();
    jTableFilesTableModel = new DBMSImportTableModel(jTableFiles);
    jTableFiles.setColumnControlVisible(true);
    jTableFiles.setEditable(false);
    jTableFiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jTableFiles.setModel(jTableFilesTableModel);
    jTableFiles.setShowGrid(true);
    jTableFiles.setDragEnabled(false); 
    jTableFiles.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if(jTableFiles.getSelectedRow() < 0)   {
                delFileButton.setEnabled(false);
            }else{
                delFileButton.setEnabled(true);
            }
        }
    });
    scrollPaneFiles.setViewportView(jTableFiles);   
}
 
開發者ID:dbunibas,項目名稱:BART,代碼行數:22,代碼來源:ImportPanel.java

示例11: LlenarTabla

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public void LlenarTabla(JXTable tabla_morosos) throws ClassNotFoundException{
    DefaultTableModel modeloT = new DefaultTableModel();
    tabla_morosos.setModel(modeloT);
    
    modeloT.addColumn("Legajo");
    modeloT.addColumn("Apellido");
    modeloT.addColumn("Nombre");
    modeloT.addColumn("DNI");
    modeloT.addColumn("Estado");
    
    Object[] columna = new Object[5];
    
    int numeroRegistros= modelo_socios.listarSocios().size();
    //        System.out.println(numeroRegistros);
    for ( int i=0; i<numeroRegistros;i++){
        
        verfificarPago(modelo_socios.listarSocios().get(i).getLegajo_socio());
        
        String estado=modelo_socios.listarSocios().get(i).getEstado();
        System.out.println("Estado del socio luego de verificar los pago y cambiar estado: "+estado+"\n");
        int compare = estado.compareTo("moroso");
        if(compare==0){
            columna[0]=modelo_socios.listarSocios().get(i).getLegajo_socio();
            columna[1]=modelo_socios.listarSocios().get(i).getApellido();
            columna[2]=modelo_socios.listarSocios().get(i).getNombre();
            columna[3]=modelo_socios.listarSocios().get(i).getDni();
            columna[4]=modelo_socios.listarSocios().get(i).getEstado();

            modeloT.addRow(columna);
        }
    }
    
}
 
開發者ID:gonzapala,項目名稱:CPI,代碼行數:34,代碼來源:Gestionar_Resoluciones.java

示例12: LlenarTabla

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public void LlenarTabla(JXTable tabla) throws ClassNotFoundException{
    DefaultTableModel modeloT = new DefaultTableModel();
    tabla.setModel(modeloT);
    
    modeloT.addColumn("Numero Res.");
    modeloT.addColumn("Estado");
    modeloT.addColumn("Tipo");
    modeloT.addColumn("Fecha Res.");
    modeloT.addColumn("Legajo Socio");
    modeloT.addColumn("Ruta Res.");
    
    Object[] columna = new Object[6];
    
    int numeroRegistros= modelo_res.listar().size();
    //        System.out.println(numeroRegistros);
    for ( int i=0; i<numeroRegistros;i++){
        
        //verfificarPago(modelo_res.listarSocios().get(i).getLegajo_socio());
        
        //String estado=modelo_socios.listarSocios().get(i).getEstado();
        //System.out.println("Estado del socio luego de verificar los pago y cambiar estado: "+estado+"\n");
        //int compare = estado.compareTo("moroso");
            columna[0]=modelo_res.listar().get(i).getNumero_resolucion();
            columna[1]=modelo_res.listar().get(i).getEstado();
            columna[2]=modelo_res.listar().get(i).getTipo();
            //columna[3]=modelo_res.listar().get(i).getFecha();
            columna[4]=modelo_res.listar().get(i).getLegajo_socio();
            columna[5]=modelo_res.listar().get(i).getRuta();

            modeloT.addRow(columna);
            //Cells are by default rendered as a JLabel.

    }
    
}
 
開發者ID:gonzapala,項目名稱:CPI,代碼行數:36,代碼來源:Mostrar_Resoluciones.java

示例13: interactiveNullVisibilityActionWithHideable

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * test if subclasses are allowed to not create a visibility action. This
 * might happen, if they want to exempt certain columns from user
 * interaction.
 * 
 */
public void interactiveNullVisibilityActionWithHideable() {
    JXTable table = new JXTable();
    ColumnControlButton columnControl = new ColumnControlButton(table) {
        
        @Override
        protected ColumnVisibilityAction createColumnVisibilityAction(
                TableColumn column) {
            if (column instanceof TableColumnExt
                    && !((TableColumnExt) column).isHideable())
                return null;
            return super.createColumnVisibilityAction(column);
        }
        
    };
    table.setColumnControl(columnControl);
    table.setColumnControlVisible(true);
    ColumnFactory factory = new ColumnFactory() {
        
        /**
         * @inherited <p>
         */
        @Override
        public void configureTableColumn(TableModel model,
                TableColumnExt columnExt) {
            super.configureTableColumn(model, columnExt);
            if (columnExt.getModelIndex() == 0) {
                columnExt.setHideable(false);
            }
        }
        
    };
    table.setColumnFactory(factory);
    table.setModel(new AncientSwingTeam());
    JXFrame frame = wrapWithScrollingInFrame(table,
            "first model column not togglable");
    frame.setVisible(true);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:44,代碼來源:ColumnControlButtonVisualCheck.java

示例14: interactiveTestLastVisibleColumn

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/** 
  * 
  * 
  */
public void interactiveTestLastVisibleColumn() {
    final JXTable table = new JXTable();
    table.setModel(new DefaultTableModel(10, 2));
    table.setColumnControlVisible(true);

    JFrame frame = wrapWithScrollingInFrame(table,
            "JXTable (#192, #38-swingx) ColumnControl and Visibility of items");
    table.getColumnExt(0).setVisible(false);
    frame.setVisible(true);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:15,代碼來源:ColumnControlButtonVisualCheck.java

示例15: initJTable

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
private void initJTable()   {
    valueTable = new JXTable();
    valueTable.setColumnControlVisible(true);
    valueTable.setEditable(false);
    valueTable.setDefaultRenderer(Object.class, new TableValueCellRender());
    valueTable.setCellSelectionEnabled(true);
    valueTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    valueTable.setModel(dataModel);
    valueTable.setShowGrid(true);
    valueTable.setDragEnabled(false); 
    valueTable.setSelectionBackground(new Color(214, 217, 223));
    valueTable.setVisibleRowCount(20);
    pageCtrlPanel.setVisibleRow(20+"");
}
 
開發者ID:dbunibas,項目名稱:BART,代碼行數:15,代碼來源:TableDataView.java


注:本文中的org.jdesktop.swingx.JXTable.setModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。