Search in sources :

Example 41 with JTable

use of javax.swing.JTable in project jmeter by apache.

the class SamplerResultTab method createResponseMetadataPanel.

private Component createResponseMetadataPanel() {
    stats = new JTextPane();
    stats.setEditable(false);
    stats.setBackground(backGround);
    // Add styles to use for different types of status messages
    StyledDocument doc = (StyledDocument) stats.getDocument();
    Style style = doc.addStyle(STYLE_REDIRECT, null);
    StyleConstants.setForeground(style, REDIRECT_COLOR);
    style = doc.addStyle(STYLE_CLIENT_ERROR, null);
    StyleConstants.setForeground(style, CLIENT_ERROR_COLOR);
    style = doc.addStyle(STYLE_SERVER_ERROR, null);
    StyleConstants.setForeground(style, SERVER_ERROR_COLOR);
    paneRaw = GuiUtils.makeScrollPane(stats);
    paneRaw.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    // Set up the 1st table Result with empty headers
    tableResult = new JTable(resultModel);
    JMeterUtils.applyHiDPI(tableResult);
    // $NON-NLS-1$
    tableResult.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResult.addMouseListener(new TextBoxDoubleClick(tableResult));
    setFirstColumnPreferredSize(tableResult);
    RendererUtils.applyRenderers(tableResult, RENDERERS_RESULT);
    // Set up the 2nd table 
    tableResHeaders = new JTable(resHeadersModel);
    JMeterUtils.applyHiDPI(tableResHeaders);
    // $NON-NLS-1$
    tableResHeaders.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResHeaders.addMouseListener(new TextBoxDoubleClick(tableResHeaders));
    setFirstColumnPreferredSize(tableResHeaders);
    tableResHeaders.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    RendererUtils.applyRenderers(tableResHeaders, RENDERERS_HEADERS);
    // Set up the 3rd table 
    tableResFields = new JTable(resFieldsModel);
    JMeterUtils.applyHiDPI(tableResFields);
    // $NON-NLS-1$
    tableResFields.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResFields.addMouseListener(new TextBoxDoubleClick(tableResFields));
    setFirstColumnPreferredSize(tableResFields);
    tableResFields.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    RendererUtils.applyRenderers(tableResFields, RENDERERS_FIELDS);
    // Prepare the Results tabbed pane
    tabbedResult = new JTabbedPane(SwingConstants.BOTTOM);
    // Create the split pane
    JSplitPane topSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableResHeaders), GuiUtils.makeScrollPane(tableResFields));
    topSplit.setOneTouchExpandable(true);
    // set split ratio
    topSplit.setResizeWeight(0.80);
    // see bug jdk 4131528
    topSplit.setBorder(null);
    paneParsed = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableResult), topSplit);
    paneParsed.setOneTouchExpandable(true);
    // set split ratio
    paneParsed.setResizeWeight(0.40);
    // see bug jdk 4131528
    paneParsed.setBorder(null);
    // setup bottom tabs, first Raw, second Parsed
    //$NON-NLS-1$
    tabbedResult.addTab(JMeterUtils.getResString("view_results_table_result_tab_raw"), paneRaw);
    //$NON-NLS-1$
    tabbedResult.addTab(JMeterUtils.getResString("view_results_table_result_tab_parsed"), paneParsed);
    // Hint to background color on bottom tabs (grey, not blue)
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(tabbedResult);
    return panel;
}
Also used : JTextPane(javax.swing.JTextPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) HeaderAsPropertyRenderer(org.apache.jmeter.gui.util.HeaderAsPropertyRenderer) JTabbedPane(javax.swing.JTabbedPane) StyledDocument(javax.swing.text.StyledDocument) Style(javax.swing.text.Style) TextBoxDoubleClick(org.apache.jmeter.gui.util.TextBoxDialoger.TextBoxDoubleClick) JSplitPane(javax.swing.JSplitPane)

Example 42 with JTable

use of javax.swing.JTable in project jmeter by apache.

the class HTTPArgumentsPanel method init.

private void init() {
    // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    // register the right click menu
    JTable table = getTable();
    final JPopupMenu popupMenu = new JPopupMenu();
    JMenuItem variabilizeItem = new JMenuItem(JMeterUtils.getResString("transform_into_variable"));
    variabilizeItem.addActionListener(e -> transformNameIntoVariable());
    popupMenu.add(variabilizeItem);
    table.setComponentPopupMenu(popupMenu);
}
Also used : JTable(javax.swing.JTable) JMenuItem(javax.swing.JMenuItem) JPopupMenu(javax.swing.JPopupMenu)

Example 43 with JTable

use of javax.swing.JTable in project joda-time by JodaOrg.

the class DateTimeBrowser method resetDefaults.

/*
     * resetDefaults
     */
private void resetDefaults(TableView tView) {
    Object[] colNames = tView.getColNames();
    Object[][] tableValues = tView.getCalcdValues();
    // dumpObjs( tableValues, System.out);
    JTable table = new JTable(tableValues, colNames);
    tView.setViewColumnsWidth(table);
    setTitle(tView.getViewTitle());
    //
    if (mainSP != null)
        getContentPane().remove(mainSP);
    mainSP = new JScrollPane(table);
    getContentPane().add(mainSP, "Center");
    validate();
}
Also used : JScrollPane(javax.swing.JScrollPane) JTable(javax.swing.JTable)

Example 44 with JTable

use of javax.swing.JTable in project jgnash by ccavanaugh.

the class MainRegisterPanel method columnAction.

private void columnAction() {
    AbstractRegisterTableModel m = getActiveModel();
    if (m != null) {
        if (ColumnDialog.showDialog(m)) {
            // save new column configuration
            JTable t = getActiveTable();
            if (t != null) {
                JTableUtils.packTable(t);
            }
            saveCurrentRegisterLayout();
        }
    }
}
Also used : AbstractRegisterTableModel(jgnash.ui.register.table.AbstractRegisterTableModel) JTable(javax.swing.JTable)

Example 45 with JTable

use of javax.swing.JTable in project jgnash by ccavanaugh.

the class AbstractRegisterPanel method autoScroll.

/**
     * Must place at the end of the event list for this to work
     */
private void autoScroll() {
    EventQueue.invokeLater(() -> {
        final JTable table = getTable();
        Rectangle cell = table.getCellRect(table.getRowCount() - 1, 0, true);
        table.scrollRectToVisible(cell);
    });
}
Also used : JTable(javax.swing.JTable) Rectangle(java.awt.Rectangle)

Aggregations

JTable (javax.swing.JTable)284 JScrollPane (javax.swing.JScrollPane)149 JPanel (javax.swing.JPanel)120 JLabel (javax.swing.JLabel)85 JButton (javax.swing.JButton)80 BorderLayout (java.awt.BorderLayout)77 Dimension (java.awt.Dimension)74 ActionEvent (java.awt.event.ActionEvent)53 BoxLayout (javax.swing.BoxLayout)52 TableColumn (javax.swing.table.TableColumn)50 ActionListener (java.awt.event.ActionListener)44 JTextField (javax.swing.JTextField)40 TableColumnModel (javax.swing.table.TableColumnModel)36 MouseEvent (java.awt.event.MouseEvent)34 Component (java.awt.Component)33 FlowLayout (java.awt.FlowLayout)32 JComboBox (javax.swing.JComboBox)28 GridBagLayout (java.awt.GridBagLayout)24 GridBagConstraints (java.awt.GridBagConstraints)23 Insets (java.awt.Insets)23