Code example for JList

Methods: getSelectedValue

0
        infoButton.setToolTipText("Show script engine details");
        infoButton.setIcon(loadIcon("/org/esa/beam/scripting/visat/icons/help-browser-16.png"));
        infoButton.addActionListener(new ActionListener() {
            @Override 
            public void actionPerformed(ActionEvent e) {
                final Item item = (Item) list.getSelectedValue();
                showEngineDetails(list, item.scriptEngineFactory);
            } 
        }); 
        final JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        toolBar.add(infoButton);
 
        JPanel titlePanel = new JPanel(new BorderLayout(16, 0));
        titlePanel.add(new JLabel("Language:"), BorderLayout.WEST);
        titlePanel.add(toolBar, BorderLayout.EAST);
 
        JPanel contentPanel = new JPanel(new BorderLayout());
        contentPanel.add(titlePanel, BorderLayout.NORTH);
        contentPanel.add(new JScrollPane(list), BorderLayout.CENTER);
Connect your IDE to all the code out there  Get Codota for Java