Search in sources :

Example 76 with JSplitPane

use of javax.swing.JSplitPane in project sonarqube by SonarSource.

the class ScannerReportViewerApp method initialize.

/**
   * Initialize the contents of the frame.
   */
private void initialize() {
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception e) {
    // If Nimbus is not available, you can set the GUI to another look and feel.
    }
    frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    splitPane = new JSplitPane();
    frame.getContentPane().add(splitPane, BorderLayout.CENTER);
    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setPreferredSize(new Dimension(500, 7));
    splitPane.setRightComponent(tabbedPane);
    componentDetailsTab = new JScrollPane();
    tabbedPane.addTab("Component details", null, componentDetailsTab, null);
    componentEditor = new JEditorPane();
    componentDetailsTab.setViewportView(componentEditor);
    sourceTab = new JScrollPane();
    tabbedPane.addTab("Source", null, sourceTab, null);
    sourceEditor = createSourceEditor();
    sourceEditor.setEditable(false);
    sourceTab.setViewportView(sourceEditor);
    textLineNumber = createTextLineNumber();
    sourceTab.setRowHeaderView(textLineNumber);
    highlightingTab = new JScrollPane();
    tabbedPane.addTab("Highlighting", null, highlightingTab, null);
    highlightingEditor = new JEditorPane();
    highlightingTab.setViewportView(highlightingEditor);
    symbolTab = new JScrollPane();
    tabbedPane.addTab("Symbol references", null, symbolTab, null);
    symbolEditor = new JEditorPane();
    symbolTab.setViewportView(symbolEditor);
    coverageTab = new JScrollPane();
    tabbedPane.addTab("Coverage", null, coverageTab, null);
    coverageEditor = new JEditorPane();
    coverageTab.setViewportView(coverageEditor);
    duplicationTab = new JScrollPane();
    tabbedPane.addTab("Duplications", null, duplicationTab, null);
    duplicationEditor = new JEditorPane();
    duplicationTab.setViewportView(duplicationEditor);
    testsTab = new JScrollPane();
    tabbedPane.addTab("Tests", null, testsTab, null);
    testsEditor = new JEditorPane();
    testsTab.setViewportView(testsEditor);
    issuesTab = new JScrollPane();
    tabbedPane.addTab("Issues", null, issuesTab, null);
    issuesEditor = new JEditorPane();
    issuesTab.setViewportView(issuesEditor);
    measuresTab = new JScrollPane();
    tabbedPane.addTab("Measures", null, measuresTab, null);
    measuresEditor = new JEditorPane();
    measuresTab.setViewportView(measuresEditor);
    scmTab = new JScrollPane();
    tabbedPane.addTab("SCM", null, scmTab, null);
    scmEditor = new JEditorPane();
    scmTab.setViewportView(scmEditor);
    treeScrollPane = new JScrollPane();
    treeScrollPane.setPreferredSize(new Dimension(200, 400));
    splitPane.setLeftComponent(treeScrollPane);
    componentTree = new JTree();
    componentTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("empty") {

        {
        }
    }));
    treeScrollPane.setViewportView(componentTree);
    componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    componentTree.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();
            if (node == null) {
                // Nothing is selected.
                return;
            }
            frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
            updateDetails((Component) node.getUserObject());
            frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    });
    frame.pack();
}
Also used : JScrollPane(javax.swing.JScrollPane) LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) JTabbedPane(javax.swing.JTabbedPane) TreeSelectionListener(javax.swing.event.TreeSelectionListener) Dimension(java.awt.Dimension) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Cursor(java.awt.Cursor) IOException(java.io.IOException) JTree(javax.swing.JTree) JFrame(javax.swing.JFrame) JEditorPane(javax.swing.JEditorPane) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) JSplitPane(javax.swing.JSplitPane) Component(org.sonar.scanner.protocol.output.ScannerReport.Component)

Example 77 with JSplitPane

use of javax.swing.JSplitPane in project zaproxy by zaproxy.

the class CustomScanDialog method getCustomPanel.

private JPanel getCustomPanel() {
    if (customPanel == null) {
        customPanel = new JPanel(new GridBagLayout());
        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        scrollPane.setViewportView(getRequestField());
        JPanel buttonPanel = new JPanel(new GridBagLayout());
        getRequestField().addCaretListener(new CaretListener() {

            @Override
            public void caretUpdate(CaretEvent event) {
                setFieldStates();
            }
        });
        // Spacer
        buttonPanel.add(new JLabel(""), LayoutHelper.getGBC(0, 0, 1, 0.5));
        buttonPanel.add(getAddCustomButton(), LayoutHelper.getGBC(1, 0, 1, 1, 0.0D, 0.0D, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, new Insets(5, 5, 5, 5)));
        // Spacer
        buttonPanel.add(new JLabel(""), LayoutHelper.getGBC(2, 0, 1, 0.5));
        // Spacer
        buttonPanel.add(new JLabel(""), LayoutHelper.getGBC(0, 1, 1, 0.5));
        buttonPanel.add(getRemoveCustomButton(), LayoutHelper.getGBC(1, 1, 1, 1, 0.0D, 0.0D, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, new Insets(5, 5, 5, 5)));
        // Spacer
        buttonPanel.add(new JLabel(""), LayoutHelper.getGBC(2, 1, 1, 0.5));
        JScrollPane scrollPane2 = new JScrollPane(getInjectionPointList());
        scrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        buttonPanel.add(new JLabel(Constant.messages.getString("ascan.custom.label.vectors")), LayoutHelper.getGBC(0, 2, 3, 0.0D, 0.0D));
        buttonPanel.add(scrollPane2, LayoutHelper.getGBC(0, 3, 3, 1.0D, 1.0D));
        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPane, buttonPanel);
        splitPane.setDividerLocation(550);
        customPanel.add(splitPane, LayoutHelper.getGBC(0, 0, 1, 1, 1.0D, 1.0D));
        customPanel.add(customPanelStatus, LayoutHelper.getGBC(0, 1, 1, 1, 1.0D, 0.0D));
        customPanel.add(getDisableNonCustomVectors(), LayoutHelper.getGBC(0, 2, 1, 1, 1.0D, 0.0D));
    }
    return customPanel;
}
Also used : JScrollPane(javax.swing.JScrollPane) CaretEvent(javax.swing.event.CaretEvent) JPanel(javax.swing.JPanel) CaretListener(javax.swing.event.CaretListener) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JSplitPane(javax.swing.JSplitPane)

Example 78 with JSplitPane

use of javax.swing.JSplitPane in project zaproxy by zaproxy.

the class AlertPanel method getSplitPane.

private JSplitPane getSplitPane() {
    if (splitPane == null) {
        splitPane = new JSplitPane();
        splitPane.setName("AlertPanels");
        splitPane.setDividerSize(3);
        splitPane.setDividerLocation(400);
        splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
        // Add toolbar
        JPanel panel = new JPanel();
        panel.setLayout(new GridBagLayout());
        panel.add(this.getPanelToolbar(), LayoutHelper.getGBC(0, 0, 1, 0.0D));
        panel.add(getPaneScroll(), LayoutHelper.getGBC(0, 1, 1, 1.0D, 1.0D));
        splitPane.setLeftComponent(panel);
        splitPane.setRightComponent(getAlertViewPanel());
        splitPane.setPreferredSize(new Dimension(100, 200));
    }
    return splitPane;
}
Also used : JPanel(javax.swing.JPanel) GridBagLayout(java.awt.GridBagLayout) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 79 with JSplitPane

use of javax.swing.JSplitPane in project zaproxy by zaproxy.

the class WorkbenchPanel method createStatusPanelsSplit.

/**
	 * Creates a split pane between the {@code status} area (bottom component) and {@code work} area or a split between
	 * {@code work} and {@code select} areas (top component), if the layout is {@link Layout#EXPAND_SELECT EXPAND_SELECT} or
	 * {@link Layout#EXPAND_STATUS EXPAND_STATUS}, respectively.
	 * 
	 * @return a {@code JSplitPane} between the {@code status} area and other areas
	 */
private JSplitPane createStatusPanelsSplit() {
    JSplitPane splitVert = new JSplitPane();
    splitVert.setDividerLocation(restoreDividerLocation(DIVIDER_VERTICAL, 300));
    splitVert.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new DividerResizedListener(DIVIDER_VERTICAL));
    splitVert.setDividerSize(3);
    splitVert.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitVert.setResizeWeight(0.5D);
    switch(layout) {
        case EXPAND_SELECT:
            splitVert.setTopComponent(getPaneWork());
            break;
        case EXPAND_STATUS:
        default:
            splitVert.setTopComponent(createSelectPanelsSplit());
            break;
    }
    splitVert.setBottomComponent(getPaneStatus());
    splitVert.setContinuousLayout(false);
    splitVert.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    return splitVert;
}
Also used : JSplitPane(javax.swing.JSplitPane)

Example 80 with JSplitPane

use of javax.swing.JSplitPane in project zaproxy by zaproxy.

the class WorkbenchPanel method splitResponsePanelWithWorkTabbedPanel.

private void splitResponsePanelWithWorkTabbedPanel(int orientation) {
    responseTabbedPanel.removeAll();
    String name = showTabNames ? responsePanel.getName() : "";
    responseTabbedPanel.addTab(name, DisplayUtils.getScaledIcon(responsePanel.getIcon()), responsePanel);
    getPaneWork().removeAll();
    JSplitPane split = new JSplitPane(orientation);
    split.setDividerSize(3);
    split.setResizeWeight(0.5D);
    split.setContinuousLayout(false);
    split.setDoubleBuffered(true);
    split.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    split.setRightComponent(responseTabbedPanel);
    split.setLeftComponent(getTabbedWork());
    getPaneWork().add(split);
    getPaneWork().validate();
}
Also used : JSplitPane(javax.swing.JSplitPane)

Aggregations

JSplitPane (javax.swing.JSplitPane)109 BorderLayout (java.awt.BorderLayout)69 JPanel (javax.swing.JPanel)64 JScrollPane (javax.swing.JScrollPane)54 Dimension (java.awt.Dimension)40 JLabel (javax.swing.JLabel)31 JButton (javax.swing.JButton)17 JTextArea (javax.swing.JTextArea)16 FlowLayout (java.awt.FlowLayout)15 Insets (java.awt.Insets)15 GridBagLayout (java.awt.GridBagLayout)14 GridBagConstraints (java.awt.GridBagConstraints)13 JTable (javax.swing.JTable)13 Container (java.awt.Container)10 GridLayout (java.awt.GridLayout)10 ArrayList (java.util.ArrayList)10 BoxLayout (javax.swing.BoxLayout)10 JComponent (javax.swing.JComponent)10 JTabbedPane (javax.swing.JTabbedPane)10 EmptyBorder (javax.swing.border.EmptyBorder)10