List of usage examples for javax.swing JScrollPane setViewportView
public void setViewportView(Component view)
From source file:org.zaproxy.zap.extension.customFire.CustomFireDialog.java
private JPanel getTechPanel() { //if (techPanel == null) { techPanel = new JPanel(new GridBagLayout()); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setViewportView(getTechTree()); scrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); techPanel.add(scrollPane, LayoutHelper.getGBC(0, 0, 1, 1, 1.0D, 1.0D)); //}//w w w. jav a2 s. co m return techPanel; }
From source file:org.zaproxy.zap.extension.customFire.CustomFireDialog.java
/** * Not used as of now// ww w . j a v a 2 s .c o m * @return JPanel */ private JPanel getScriptPanel() { //if (sPanel == null) { sPanel = new JPanel(new GridBagLayout()); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setViewportView(getSTree()); scrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED)); sPanel.add(scrollPane, LayoutHelper.getGBC(0, 0, 1, 1, 1.0D, 1.0D)); //} return sPanel; }
From source file:org.zaproxy.zap.extension.customFire.TechnologyTreePanel.java
public TechnologyTreePanel(String nameRootNode) { setLayout(new BorderLayout()); techToNodeMap = new HashMap<>(); techTree = new JCheckBoxScriptsTree() { private static final long serialVersionUID = 1L; @Override/*ww w .ja v a2 s . c o m*/ protected void setExpandedState(TreePath path, boolean state) { // Ignore all collapse requests; collapse events will not be fired if (state) { super.setExpandedState(path, state); } } }; // Initialise the structure based on all the tech we know about TechSet ts = new TechSet(Tech.builtInTech); Iterator<Tech> iter = ts.getIncludeTech().iterator(); DefaultMutableTreeNode root = new DefaultMutableTreeNode(nameRootNode); Tech tech; DefaultMutableTreeNode parent; DefaultMutableTreeNode node; while (iter.hasNext()) { tech = iter.next(); if (tech.getParent() != null) { parent = techToNodeMap.get(tech.getParent()); } else { parent = null; } if (parent == null) { parent = root; } node = new DefaultMutableTreeNode(tech.getUiName()); parent.add(node); techToNodeMap.put(tech, node); } techTree.setModel(new DefaultTreeModel(root)); techTree.expandAll(); techTree.setCheckBoxEnabled(new TreePath(root), false); reset(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(techTree); scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); add(scrollPane, BorderLayout.CENTER); }
From source file:org.zaproxy.zap.extension.encoder2.EncodeDecodeDialog.java
private void addField(JPanel parent, int index, JComponent c, String title) { final java.awt.GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0;// w ww.j av a2s . c o m gbc.gridy = index; gbc.insets = new java.awt.Insets(1, 1, 1, 1); gbc.anchor = java.awt.GridBagConstraints.NORTHWEST; gbc.fill = java.awt.GridBagConstraints.BOTH; gbc.weightx = 0.5D; gbc.weighty = 0.5D; final JScrollPane jsp = new JScrollPane(); jsp.setViewportView(c); jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jsp.setBorder(BorderFactory.createTitledBorder(null, title, TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); parent.add(jsp, gbc); }
From source file:org.zaproxy.zap.extension.encoder2.EncodeDecodeDialog.java
/** * This method initializes jPanel//from w w w.jav a 2 s.c o m * * @return javax.swing.JPanel */ private JPanel getJTabbed() { if (jPanel == null) { /* jPanel = new JPanel(); jPanel.setPreferredSize(new java.awt.Dimension(800,600)); jPanel.setLayout(new GridBagLayout()); */ // jPanel is the outside one jPanel = new JPanel(); jPanel.setPreferredSize(new java.awt.Dimension(800, 600)); jPanel.setLayout(new GridBagLayout()); jTabbed = new JTabbedPane(); jTabbed.setPreferredSize(new java.awt.Dimension(800, 500)); final JPanel jPanel1 = new JPanel(); jPanel1.setLayout(new GridBagLayout()); final JPanel jPanel2 = new JPanel(); //jPanel2.setPreferredSize(new java.awt.Dimension(800,500)); jPanel2.setLayout(new GridBagLayout()); final JPanel jPanel3 = new JPanel(); //jPanel3.setPreferredSize(new java.awt.Dimension(800,500)); jPanel3.setLayout(new GridBagLayout()); final JPanel jPanel4 = new JPanel(); jPanel4.setLayout(new GridBagLayout()); // 3 tabs - Encode, Decode, Hash?? addField(jPanel1, 1, getBase64EncodeField(), Constant.messages.getString("enc2.label.b64Enc")); addField(jPanel1, 2, getUrlEncodeField(), Constant.messages.getString("enc2.label.urlEnc")); addField(jPanel1, 3, getAsciiHexEncodeField(), Constant.messages.getString("enc2.label.asciiEnc")); addField(jPanel1, 4, getHTMLEncodeField(), Constant.messages.getString("enc2.label.HTMLEnc")); addField(jPanel1, 5, getJavaScriptEncodeField(), Constant.messages.getString("enc2.label.JavaScriptEnc")); addField(jPanel2, 1, getBase64DecodeField(), Constant.messages.getString("enc2.label.b64Dec")); addField(jPanel2, 2, getUrlDecodeField(), Constant.messages.getString("enc2.label.urlDec")); addField(jPanel2, 3, getAsciiHexDecodeField(), Constant.messages.getString("enc2.label.asciiDec")); addField(jPanel2, 4, getHTMLDecodeField(), Constant.messages.getString("enc2.label.HTMLDec")); addField(jPanel2, 5, getJavaScriptDecodeField(), Constant.messages.getString("enc2.label.JavaScriptDec")); addField(jPanel3, 1, getSha1HashField(), Constant.messages.getString("enc2.label.sha1Hash")); addField(jPanel3, 2, getMd5HashField(), Constant.messages.getString("enc2.label.md5Hash")); addField(jPanel4, 1, getIllegalUTF82ByteField(), Constant.messages.getString("enc2.label.illegalUTF8.2byte")); addField(jPanel4, 2, getIllegalUTF83ByteField(), Constant.messages.getString("enc2.label.illegalUTF8.3byte")); addField(jPanel4, 3, getIllegalUTF84ByteField(), Constant.messages.getString("enc2.label.illegalUTF8.4byte")); jTabbed.addTab(Constant.messages.getString("enc2.tab.encode"), jPanel1); jTabbed.addTab(Constant.messages.getString("enc2.tab.decode"), jPanel2); jTabbed.addTab(Constant.messages.getString("enc2.tab.hash"), jPanel3); jTabbed.addTab(Constant.messages.getString("enc2.tab.illegalUTF8"), jPanel4); final java.awt.GridBagConstraints gbc1 = new GridBagConstraints(); gbc1.gridx = 0; gbc1.gridy = 1; gbc1.insets = new java.awt.Insets(1, 1, 1, 1); gbc1.anchor = java.awt.GridBagConstraints.NORTHWEST; gbc1.fill = java.awt.GridBagConstraints.BOTH; gbc1.weightx = 1.0D; gbc1.weighty = 0.25D; final java.awt.GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.gridx = 0; gbc2.gridy = 2; gbc2.insets = new java.awt.Insets(1, 1, 1, 1); gbc2.anchor = java.awt.GridBagConstraints.NORTHWEST; gbc2.fill = java.awt.GridBagConstraints.BOTH; gbc2.weightx = 1.0D; gbc2.weighty = 1.0D; final JScrollPane jsp = new JScrollPane(); jsp.setViewportView(getInputField()); jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jsp.setBorder(BorderFactory.createTitledBorder(null, Constant.messages.getString("enc2.label.text"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); //addField(jPanel, 1, getInputField(), "Text to be encoded/decoded/hashed"); //addField(jPanel, 2, jTabbed, "Text to be encoded/decoded/hashed"); jPanel.add(jsp, gbc1); jPanel.add(jTabbed, gbc2); jPanel2.requestFocus(); } return jPanel; }
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)); /*//from w w w . ja v a 2s . c om * 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(// www .j av a2s.c o 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); }
From source file:org.zaproxy.zap.extension.viewstate.HttpPanelViewStateView.java
private JPanel getContainerPanel() { if (container == null) { container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); JScrollPane cScroll = new JScrollPane(); cScroll.setName(CAPTION_NAME);/*from w w w. j av a2 s . c o m*/ cScroll.setViewportView(getHexTableBody()); // Outer scroll size constraints container.setPreferredSize(new Dimension(0, 100)); // Setup text field for ViewState info vsInfoTxt = new JFormattedTextField(); vsInfoTxt.setEditable(false); vsInfoTxt.setBackground(Color.decode("#D6D9DF")); vsInfoTxt.setFont(FontUtils.getFont("Courier", Font.BOLD)); // Add to container container.add(cScroll); container.add(vsInfoTxt); } return container; }
From source file:org.zaproxy.zap.view.TechnologyTreePanel.java
public TechnologyTreePanel(String nameRootNode) { setLayout(new BorderLayout()); techToNodeMap = new HashMap<>(); techTree = new JCheckBoxTree() { private static final long serialVersionUID = 1L; @Override// w w w. ja v a 2s.c o m protected void setExpandedState(TreePath path, boolean state) { // Ignore all collapse requests; collapse events will not be fired if (state) { super.setExpandedState(path, state); } } }; // Initialise the structure based on all the tech we know about TechSet ts = new TechSet(Tech.builtInTech); Iterator<Tech> iter = ts.getIncludeTech().iterator(); DefaultMutableTreeNode root = new DefaultMutableTreeNode(nameRootNode); Tech tech; DefaultMutableTreeNode parent; DefaultMutableTreeNode node; while (iter.hasNext()) { tech = iter.next(); if (tech.getParent() != null) { parent = techToNodeMap.get(tech.getParent()); } else { parent = null; } if (parent == null) { parent = root; } node = new DefaultMutableTreeNode(tech.getUiName()); parent.add(node); techToNodeMap.put(tech, node); } techTree.setModel(new DefaultTreeModel(root)); techTree.expandAll(); techTree.setCheckBoxEnabled(new TreePath(root), false); reset(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(techTree); scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); add(scrollPane, BorderLayout.CENTER); }
From source file:pcgen.gui2.dialog.AboutDialog.java
/** * Build up a scrollable list of monkeys, given the monkey names. * @param monkeys The names of the monkeys * @return A JScrollPane to display the monkeys. *///from w ww. j a va 2 s . c o m private JScrollPane buildMonkeyList(String monkeys) { JTextArea textArea = new JTextArea(); JScrollPane scroller = new JScrollPane(); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); textArea.setEditable(false); textArea.setText(monkeys); scroller.setViewportView(textArea); textArea.setCaretPosition(0); return scroller; }