add ( )源码实例Demo

javax.swing.JScrollPane#add ( )源码实例Demo

下面列出了javax.swing.JScrollPane#add ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: brModelo   文件: PainelSelecaoCor.java
@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));
    }
}
 
源代码2 项目: SAMLRaider   文件: SamlMain.java
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();
}
 
源代码3 项目: netbeans   文件: WrapEditorComponentTest.java
public Component createEditor(JEditorPane j) {
    JScrollPane result = new JScrollPane();
    result.add(j);
    return result;
}
 
源代码4 项目: zap-extensions   文件: TlsDebugPanel.java
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);
}