Java Code Examples for javax.swing.JScrollPane#add()
The following examples show how to use
javax.swing.JScrollPane#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PainelSelecaoCor.java From brModelo with GNU General Public License v3.0 | 5 votes |
@Override public void buildChooser() { setLayout(new BorderLayout());// GridLayout(0, 1)); if (!itens.isEmpty()) { JScrollPane jsp = new javax.swing.JScrollPane(); lst = new JList(itens.toArray(new Legenda.ItemDeLegenda[]{})); add(jsp, BorderLayout.EAST); jsp.add(lst); jsp.setViewportView(lst); lst.setModel(new javax.swing.AbstractListModel() { @Override public int getSize() { return itens.size(); } @Override public Object getElementAt(int i) { return itens.get(i); } }); lst.addListSelectionListener( e -> { if (e == null || lst.getSelectedIndex() < 0) { return; } Legenda.ItemDeLegenda r = itens.get(lst.getSelectedIndex()); getColorSelectionModel().setSelectedColor(r.getCor()); }); lst.setCellRenderer(new JListItemParaItemLegenda(false)); } }
Example 2
Source File: SamlMain.java From SAMLRaider with MIT License | 5 votes |
private void initializeUI(){ setLayout(new BorderLayout(0, 0)); JSplitPane splitPaneMain = new JSplitPane(); splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT); add(splitPaneMain, BorderLayout.CENTER); JPanel panelTop = new JPanel(); splitPaneMain.setLeftComponent(panelTop); panelTop.setLayout(new BorderLayout(0, 0)); JSplitPane splitPaneTop = new JSplitPane(); splitPaneTop.setResizeWeight(0.3); panelTop.add(splitPaneTop); panelAction = new SamlPanelAction(controller); splitPaneTop.setLeftComponent(panelAction); panelInformation = new SamlPanelInfo(); splitPaneTop.setRightComponent(panelInformation); JPanel panelText = new JPanel(); splitPaneMain.setRightComponent(panelText); panelText.setLayout(new BorderLayout(0, 0)); textArea = new JTextArea(); textArea.setText("<SAMLRaiderFailureInInitialization></SAMLRaiderFailureInInitialization>"); scrollPane = new JScrollPane(textArea); scrollPane.add(textArea); panelText.add(scrollPane, BorderLayout.CENTER); scrollPane.setViewportView(textArea); this.invalidate(); this.updateUI(); }
Example 3
Source File: WrapEditorComponentTest.java From netbeans with Apache License 2.0 | 4 votes |
public Component createEditor(JEditorPane j) { JScrollPane result = new JScrollPane(); result.add(j); return result; }
Example 4
Source File: TlsDebugPanel.java From zap-extensions with Apache License 2.0 | 4 votes |
public TlsDebugPanel(ExtensionTlsDebug extension) { super(); this.extension = extension; this.setIcon(TLSDEBUG_ICON); this.setDefaultAccelerator( this.extension .getView() .getMenuShortcutKeyStroke(KeyEvent.VK_D, KeyEvent.ALT_DOWN_MASK, false)); this.setLayout(new BorderLayout()); JPanel panelContent = new JPanel(new GridBagLayout()); this.add(panelContent, BorderLayout.NORTH); panelContent.setBackground(new Color(UIManager.getColor("TextField.background").getRGB())); 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( 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); }