Jay
Jay

Reputation: 2107

Adding JScrollPane to JSplitPane

Come to a bit of a mind block here: I need to turn the image into a JScrollPane. Should be easy but I'm a bit lost.

JSplitPane pane1;

pane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, 
    new JLabel("hi"), 
    (new JLabel(new ImageIcon(image))));

Upvotes: 0

Views: 883

Answers (1)

Reimeus
Reimeus

Reputation: 159874

You could do:

pane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JLabel("hi"),
             (new JScrollPane(new JLabel(new ImageIcon(image)))));

Upvotes: 5

Related Questions