List of usage examples for javax.swing JScrollPane setFont
@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.") public void setFont(Font font)
From source file:org.zaproxy.zap.extension.quickstart.QuickStartPanel.java
private void initialize() { this.setIcon(new ImageIcon(BreakPanel.class.getResource("/resource/icon/16/147.png"))); // 'lightning' icon this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false)); this.setMnemonic(Constant.messages.getChar("quickstart.panel.mnemonic")); this.setLayout(new BorderLayout()); JPanel panelContent = new JPanel(new GridBagLayout()); JScrollPane jScrollPane = new JScrollPane(); jScrollPane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11)); jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jScrollPane.setViewportView(panelContent); this.add(jScrollPane, BorderLayout.CENTER); panelContent.setBackground(Color.white); panelContent.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); /*/* w ww . ja va 2s .c o m*/ * Layout: * Col 0 1 2 3 4 * Row+----------------------+----------------------+----------------------+----------------------+----------------------+ * 0 | Top welcome message | zap128x128.png | * 1 | URL: | [ Url field ] | | * 2 | | [ Attack button ] | [ Stop button ] | padding | | * 3 | Progress: | Progress details | | * | Bottom message | * | Show at start: | [x] | | | | * +----------------------+----------------------+----------------------+----------------------+----------------------+ */ panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.topmsg")), LayoutHelper.getGBC(0, 0, 4, 1.0D, new Insets(5, 5, 5, 5))); if (Constant.isDevBuild()) { panelContent.add( new JLabel(new ImageIcon(QuickStartPanel.class .getResource("/org/zaproxy/zap/extension/quickstart/resources/zap128x128dark.png"))), LayoutHelper.getGBC(4, 0, 1, 0.0D, 0.0D, GridBagConstraints.NORTH)); } else { panelContent.add( new JLabel(DisplayUtils.getScaledIcon( new ImageIcon(SearchPanel.class.getResource("/resource/zap128x128.png")))), LayoutHelper.getGBC(4, 0, 1, 0.0D, 0.0D, GridBagConstraints.NORTH)); } panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.url")), LayoutHelper.getGBC(0, 1, 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( 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, 1, 3, 0.25D)); panelContent.add(this.getAttackButton(), LayoutHelper.getGBC(1, 2, 1, 0.0D)); panelContent.add(this.getStopButton(), LayoutHelper.getGBC(2, 2, 1, 0.0D)); panelContent.add(new JLabel(""), LayoutHelper.getGBC(3, 2, 1, 0.75D, 0.0D)); // Padding to right of buttons progressLabel = new JLabel( Constant.messages.getString("quickstart.progress." + AttackThread.Progress.notstarted.name())); panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.progress")), LayoutHelper.getGBC(0, 3, 1, 0.0D, new Insets(5, 5, 5, 5))); panelContent.add(this.progressLabel, LayoutHelper.getGBC(1, 3, 3, 0.0D)); panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.proxymsg")), LayoutHelper.getGBC(0, 4, 5, 1.0D, new Insets(5, 5, 5, 5))); if (Control.getSingleton().getExtensionLoader().getExtension("ExtensionPlugNHack") != null) { // Plug-n-Hack extension has been installed - this makes configuration much easier :) if (DesktopUtils.canOpenUrlInBrowser()) { panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitm")), LayoutHelper.getGBC(0, 6, 1, 0.0D, new Insets(5, 5, 5, 5))); panelContent.add(this.getConfButton(), LayoutHelper.getGBC(1, 6, 1, 0.0D)); panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitmalt")), LayoutHelper.getGBC(0, 7, 1, 0.0D, new Insets(5, 5, 5, 5))); } else { panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitmurl")), LayoutHelper.getGBC(0, 7, 1, 0.0D, new Insets(5, 5, 5, 5))); } panelContent.add(this.getConfField(), LayoutHelper.getGBC(1, 7, 3, 0.25D)); } else { panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.helpmsg")), LayoutHelper.getGBC(0, 5, 5, 1.0D, new Insets(5, 5, 5, 5))); } panelContent.add(new JLabel(""), LayoutHelper.getGBC(0, 10, 4, 1.D, 1.0D)); // Padding at bottom this.setMode(Control.getSingleton().getMode()); }
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 ww . j av a 2s . co m*/ 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); }