Search in sources :

Example 6 with JTable

use of javax.swing.JTable in project binnavi by google.

the class CGraphSelectionDialog method createGui.

/**
   * Creates the GUI of the dialog.
   *
   * @param views The views to be shown in the table.
   */
private void createGui(final List<INaviView> views) {
    setLayout(new BorderLayout());
    final JTextArea field = new JTextArea("The debugger stopped at an instruction that does not belong to any open graphs.\nPlease select a graph from the list to continue debugging.");
    field.setEditable(false);
    add(field, BorderLayout.NORTH);
    m_table = new JTable(new CGraphSelectionTableModel(views));
    m_table.addMouseListener(m_listener);
    add(new JScrollPane(m_table), BorderLayout.CENTER);
    final CPanelTwoButtons panel = new CPanelTwoButtons(m_listener, "OK", "Cancel");
    add(panel, BorderLayout.SOUTH);
    setSize(500, 300);
}
Also used : JScrollPane(javax.swing.JScrollPane) JTextArea(javax.swing.JTextArea) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) CPanelTwoButtons(com.google.security.zynamics.zylib.gui.CPanelTwoButtons)

Example 7 with JTable

use of javax.swing.JTable in project gitblit by gitblit.

the class Utils method newTable.

public static JTable newTable(TableModel model, String datePattern, final RowRenderer rowRenderer) {
    JTable table;
    if (rowRenderer == null) {
        table = new JTable(model);
    } else {
        table = new JTable(model) {

            @Override
            public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
                Component c = super.prepareRenderer(renderer, row, column);
                boolean isSelected = isCellSelected(row, column);
                rowRenderer.prepareRow(c, isSelected, row, column);
                return c;
            }
        };
    }
    table.setRowHeight(table.getFont().getSize() + 8);
    table.setCellSelectionEnabled(false);
    table.setRowSelectionAllowed(true);
    table.getTableHeader().setReorderingAllowed(false);
    table.setGridColor(new Color(0xd9d9d9));
    table.setBackground(Color.white);
    table.setDefaultRenderer(Date.class, new DateCellRenderer(datePattern, Color.orange.darker()));
    return table;
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) JTable(javax.swing.JTable) Color(java.awt.Color) Component(java.awt.Component)

Example 8 with JTable

use of javax.swing.JTable in project gitblit by gitblit.

the class StatusPanel method initialize.

private void initialize() {
    JButton refreshStatus = new JButton(Translation.get("gb.refresh"));
    refreshStatus.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            refreshStatus();
        }
    });
    version = new JLabel();
    releaseDate = new JLabel();
    bootDate = new JLabel();
    url = new JLabel();
    servletContainer = new JLabel();
    heapMaximum = new JLabel();
    heapAllocated = new JLabel();
    heapUsed = new JLabel();
    JPanel fieldsPanel = new JPanel(new GridLayout(0, 1, 0, Utils.MARGIN)) {

        private static final long serialVersionUID = 1L;

        @Override
        public Insets getInsets() {
            return Utils.INSETS;
        }
    };
    fieldsPanel.add(createFieldPanel("gb.version", version));
    fieldsPanel.add(createFieldPanel("gb.releaseDate", releaseDate));
    fieldsPanel.add(createFieldPanel("gb.bootDate", bootDate));
    fieldsPanel.add(createFieldPanel("gb.url", url));
    fieldsPanel.add(createFieldPanel("gb.servletContainer", servletContainer));
    fieldsPanel.add(createFieldPanel("gb.heapUsed", heapUsed));
    fieldsPanel.add(createFieldPanel("gb.heapAllocated", heapAllocated));
    fieldsPanel.add(createFieldPanel("gb.heapMaximum", heapMaximum));
    tableModel = new PropertiesTableModel();
    JTable propertiesTable = Utils.newTable(tableModel, Utils.DATE_FORMAT);
    String name = propertiesTable.getColumnName(PropertiesTableModel.Columns.Name.ordinal());
    NameRenderer nameRenderer = new NameRenderer();
    propertiesTable.getColumn(name).setCellRenderer(nameRenderer);
    JPanel centerPanel = new JPanel(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
    centerPanel.add(fieldsPanel, BorderLayout.NORTH);
    centerPanel.add(new JScrollPane(propertiesTable), BorderLayout.CENTER);
    JPanel controls = new JPanel(new FlowLayout(FlowLayout.CENTER, Utils.MARGIN, 0));
    controls.add(refreshStatus);
    header = new HeaderPanel(Translation.get("gb.status"), "health_16x16.png");
    setLayout(new BorderLayout(Utils.MARGIN, Utils.MARGIN));
    add(header, BorderLayout.NORTH);
    add(centerPanel, BorderLayout.CENTER);
    add(controls, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) GridLayout(java.awt.GridLayout) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable)

Example 9 with JTable

use of javax.swing.JTable in project binnavi by google.

the class CViewSearcherDialog method createGui.

/**
   * Creates the GUI of the dialog.
   */
private void createGui() {
    setLayout(new BorderLayout());
    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel lbl = new JLabel("Address" + ":");
    lbl.setBorder(new EmptyBorder(5, 5, 5, 5));
    panel.add(lbl, BorderLayout.WEST);
    m_offsetField.setSize(400, 20);
    final ActionListener listener = new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            search();
        }
    };
    m_offsetField.addActionListener(listener);
    panel.add(m_offsetField, BorderLayout.CENTER);
    panel.add(new JButton(CActionProxy.proxy(new SearchAction(this))), BorderLayout.EAST);
    add(panel, BorderLayout.NORTH);
    m_table = new JTable(tableModel);
    m_table.addMouseListener(m_listener);
    add(new JScrollPane(m_table), BorderLayout.CENTER);
    add(new CPanelTwoButtons(CActionProxy.proxy(new InternalActionListener()), "OK", "Cancel"), BorderLayout.SOUTH);
    setSize(500, 300);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) CPanelTwoButtons(com.google.security.zynamics.zylib.gui.CPanelTwoButtons) EmptyBorder(javax.swing.border.EmptyBorder)

Example 10 with JTable

use of javax.swing.JTable 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)

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