List of usage examples for javax.swing JScrollPane add
public Component add(String name, Component comp)
From source file:org.zaproxy.zap.extension.tlsdebug.TlsDebugPanel.java
@SuppressWarnings("deprecation") private void initialize() { this.setIcon(TLSDEBUG_ICON); this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, // TODO Remove warn suppression and use View.getMenuShortcutKeyStroke with // newer ZAP (or use getMenuShortcutKeyMaskEx() with Java 10+) Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | KeyEvent.ALT_DOWN_MASK, false)); this.setLayout(new BorderLayout()); JPanel panelContent = new JPanel(new GridBagLayout()); this.add(panelContent, BorderLayout.NORTH); panelContent.setBackground(Color.white); panelContent.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); panelContent.add(new JLabel(Constant.messages.getString("tlsdebug.label.url")), LayoutHelper.getGBC(0, 0, 1, 0.0D, new Insets(5, 5, 5, 5))); JPanel urlSelectPanel = new JPanel(new GridBagLayout()); JButton selectButton = new JButton(Constant.messages.getString("all.button.select")); selectButton.setIcon(/*from w w w . ja v a 2 s. c om*/ DisplayUtils.getScaledIcon(new ImageIcon(View.class.getResource("/resource/icon/16/094.png")))); // Globe // icon selectButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { NodeSelectDialog nsd = new NodeSelectDialog(View.getSingleton().getMainFrame()); SiteNode node = null; try { node = Model.getSingleton().getSession().getSiteTree() .findNode(new URI(getUrlField().getText(), false)); } catch (Exception e2) { // Ignore } node = nsd.showDialog(node); if (node != null && node.getHistoryReference() != null) { try { getUrlField().setText(node.getHistoryReference().getURI().toString()); } catch (Exception e1) { // Ignore } } } }); urlSelectPanel.add(this.getUrlField(), LayoutHelper.getGBC(0, 0, 1, 1.0D)); urlSelectPanel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D)); panelContent.add(urlSelectPanel, LayoutHelper.getGBC(1, 0, 3, 0.25D)); panelContent.add(this.getCheckButton(), LayoutHelper.getGBC(0, 1, 1, 0.0D)); JPanel outputPanel = new JPanel(new BorderLayout()); outputPanel.add(new JLabel(Constant.messages.getString("tlsdebug.label.console")), BorderLayout.NORTH); JScrollPane jScrollPane = new JScrollPane(); jScrollPane.add(getOutputArea(), LayoutHelper.getGBC(0, 0, 4, 1.D, 1.0D)); // Padding // at // bottom jScrollPane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11)); jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jScrollPane.setViewportView(getOutputArea()); outputPanel.add(jScrollPane, BorderLayout.CENTER); this.add(outputPanel, BorderLayout.CENTER); }