Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Works just fine here. I used the <a href="http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/SplitPaneDemoProject/src/components/SplitPaneDemo.java" rel="nofollow">SplitPaneDemo.java</a> file for this <a href="http://sscce.org/" rel="nofollow">SSCCE</a>, and stripped away all the unnecessary stuff</p> <pre><code>import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import java.awt.BorderLayout; public class SplitPaneDemo extends JPanel { private JList&lt;String&gt; list; private String[] imageNames = { "Bird", "Cat", "Dog", "Rabbit", "Pig", "dukeWaveRed", "kathyCosmo", "lainesTongue", "left", "middle", "right", "stickerface"}; public SplitPaneDemo() { setLayout( new BorderLayout( ) ); list = new JList&lt;&gt;(imageNames); list.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); list.setSelectedIndex( 0 ); add( new JScrollPane(list) ); } /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("SplitPaneDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SplitPaneDemo splitPaneDemo = new SplitPaneDemo(); frame.getContentPane().add(splitPaneDemo); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload