Laxman More
Laxman More

Reputation: 307

How to make JFrame or JPanel Scrollable

i have added multiple component on JPanel & then i add JPanel on JFrame.

how to make window scrollable ?

so i can add more component at that frame or window .

Upvotes: 4

Views: 15097

Answers (2)

Josh M
Josh M

Reputation: 11937

Before adding your JPanel, put in a JScrollPane first:

JPanel panel = ...;
JScrollPane scroll = new JScrollPane(panel);
frame.add(scroll, ...);

Upvotes: 10

piet.t
piet.t

Reputation: 11911

Just putting your JPanel in a JScrollPane and adding this to the JFrame should do the trick....

Upvotes: 3

Related Questions