Search in sources :

Example 1 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project antlrworks by antlr.

the class XJTable method reload.

public void reload() {
    ignoreSelectionEvent = true;
    try {
        DefaultTableModel model = (DefaultTableModel) getModel();
        model.fireTableDataChanged();
        setSelectedRow(selectionRow);
    } finally {
        ignoreSelectionEvent = false;
    }
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel)

Example 2 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project qi4j-sdk by Qi4j.

the class PropertiesPanel method createData.

/**
     * Create table table or properties using the supplied query
     *
     * @param query the Query
     *
     * @return TableModel
     */
protected TableModel createData(Query query) {
    DefaultTableModel model = new DefaultTableModel();
    for (Object qObj : query) {
        AssociationStateHolder state = qi4jspi.stateOf((EntityComposite) qObj);
        EntityDescriptor descriptor = qi4jspi.entityDescriptorFor((EntityComposite) qObj);
        // genereate column, first time only
        if (model.getColumnCount() < 1) {
            for (PropertyDescriptor persistentPropertyDescriptor : descriptor.state().properties()) {
                model.addColumn(persistentPropertyDescriptor.qualifiedName().name());
            }
        }
        Object[] rowData = new Object[model.getColumnCount()];
        int i = 0;
        for (PropertyDescriptor persistentPropertyDescriptor : descriptor.state().properties()) {
            rowData[i++] = state.propertyFor(persistentPropertyDescriptor.accessor());
        }
        model.addRow(rowData);
    }
    return model;
}
Also used : EntityDescriptor(org.qi4j.api.entity.EntityDescriptor) PropertyDescriptor(org.qi4j.api.property.PropertyDescriptor) DefaultTableModel(javax.swing.table.DefaultTableModel) AssociationStateHolder(org.qi4j.api.association.AssociationStateHolder)

Example 3 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project druid by alibaba.

the class RowHeaderRenderer method getTableCellRendererComponent.

public Component getTableCellRendererComponent(JTable table, Object obj, boolean isSelected, boolean hasFocus, int row, int col) {
    int rowCountNow = refTable.getRowCount() / rowSpan;
    ((DefaultTableModel) table.getModel()).setRowCount(rowCountNow);
    JTableHeader header = refTable.getTableHeader();
    this.setOpaque(true);
    // 设置为TableHeader的边框类型
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    // 让text居中显示
    setHorizontalAlignment(CENTER);
    // 设置背景色为TableHeader的背景色
    setBackground(header.getBackground());
    if (// 当选取单元格时,在row header上设置成选取颜色
    isSelect(row)) {
        setForeground(Color.white);
        setBackground(Color.lightGray);
    } else {
        setForeground(header.getForeground());
    }
    setFont(header.getFont());
    if (row <= rowCountNow) {
        showCol(row);
    }
    return this;
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel) JTableHeader(javax.swing.table.JTableHeader)

Example 4 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project Smack by igniterealtime.

the class EnhancedDebugger method addInformationPanel.

private void addInformationPanel() {
    // Create UI elements for connection information.
    JPanel informationPanel = new JPanel();
    informationPanel.setLayout(new BorderLayout());
    // Add the Host information
    JPanel connPanel = new JPanel();
    connPanel.setLayout(new GridBagLayout());
    connPanel.setBorder(BorderFactory.createTitledBorder("XMPPConnection information"));
    JLabel label = new JLabel("Host: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    JFormattedTextField field = new JFormattedTextField(connection.getXMPPServiceDomain());
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(field, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
    // Add the Port information
    label = new JLabel("Port: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    field = new JFormattedTextField(connection.getPort());
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(field, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
    // Add the connection's User information
    label = new JLabel("User: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(label, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    userField = new JFormattedTextField();
    userField.setMinimumSize(new java.awt.Dimension(150, 20));
    userField.setMaximumSize(new java.awt.Dimension(150, 20));
    userField.setEditable(false);
    userField.setBorder(null);
    connPanel.add(userField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
    // Add the connection's creationTime information
    label = new JLabel("Creation time: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(label, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    field = new JFormattedTextField(new SimpleDateFormat("yyyy.MM.dd HH:mm:ss:SS"));
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setValue(creationTime);
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(field, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
    // Add the connection's creationTime information
    label = new JLabel("Status: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(label, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    statusField = new JFormattedTextField();
    statusField.setMinimumSize(new java.awt.Dimension(150, 20));
    statusField.setMaximumSize(new java.awt.Dimension(150, 20));
    statusField.setValue("Active");
    statusField.setEditable(false);
    statusField.setBorder(null);
    connPanel.add(statusField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
    // Add the connection panel to the information panel
    informationPanel.add(connPanel, BorderLayout.NORTH);
    // Add the Number of sent packets information
    JPanel packetsPanel = new JPanel();
    packetsPanel.setLayout(new GridLayout(1, 1));
    packetsPanel.setBorder(BorderFactory.createTitledBorder("Transmitted Packets"));
    statisticsTable = new DefaultTableModel(new Object[][] { { "IQ", 0, 0 }, { "Message", 0, 0 }, { "Presence", 0, 0 }, { "Other", 0, 0 }, { "Total", 0, 0 } }, new Object[] { "Type", "Received", "Sent" }) {

        // CHECKSTYLE:OFF
        private static final long serialVersionUID = -6793886085109589269L;

        @Override
        public boolean isCellEditable(int rowIndex, int mColIndex) {
            // CHECKSTYLE:ON
            return false;
        }
    };
    JTable table = new JTable(statisticsTable);
    // Allow only single a selection
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    packetsPanel.add(new JScrollPane(table));
    // Add the packets panel to the information panel
    informationPanel.add(packetsPanel, BorderLayout.CENTER);
    tabbedPane.add("Information", new JScrollPane(informationPanel));
    tabbedPane.setToolTipTextAt(4, "Information and statistics about the debugged connection");
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) SimpleDateFormat(java.text.SimpleDateFormat)

Example 5 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project processing by processing.

the class ErrorTable method clearRows.

public void clearRows() {
    DefaultTableModel dtm = (DefaultTableModel) getModel();
    dtm.setRowCount(0);
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel)

Aggregations

DefaultTableModel (javax.swing.table.DefaultTableModel)119 Vector (java.util.Vector)12 JTable (javax.swing.JTable)12 JBTable (com.intellij.ui.table.JBTable)10 Dimension (java.awt.Dimension)9 JScrollPane (javax.swing.JScrollPane)9 TableColumn (javax.swing.table.TableColumn)9 ActionEvent (java.awt.event.ActionEvent)7 JButton (javax.swing.JButton)7 JPanel (javax.swing.JPanel)7 ListSelectionEvent (javax.swing.event.ListSelectionEvent)7 ListSelectionListener (javax.swing.event.ListSelectionListener)7 WebAppDetails (com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails)6 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)5 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 DockerHost (com.microsoft.azure.docker.model.DockerHost)5 EditableDockerHost (com.microsoft.azure.docker.model.EditableDockerHost)5 Color (java.awt.Color)5 ActionListener (java.awt.event.ActionListener)5