Java swing GUI tutorial #4: JScrollPane

preview_player
Показать описание
If you have any question, leave it in comment section below. Also, suggestions are highly recommended.
Рекомендации по теме
Комментарии
Автор

I have had this issue for a long time, and because of your tutorial my problem was solved. Thank you!

xavierlancione
Автор

Just add panel on scrollpane in same way as shown here (just pass panel instead label). Also, note that vertical and horizontal scrollbars will appear only if size of panel exceeds size of JFrame.

OverG
Автор

Thank you so much, my problem is solved!

ThuyNguyen-buge
Автор

How do I change the slider in jscroll pane

emadaljumaily
Автор

if its scrolling using scroll in mouse is it also be scrolled using touchscreen monitors? or laptop? without really touching the actual scrollbar?

baso
Автор

Hm...I really don't know what could be a problem. Feel free to sent me your code in inbox.

OverG
Автор

Thanks so much bro, can you help me if I will be in trouble about Java coding....
and this video was great in fact this hole video series is great

gauravbhati
Автор

how do i put a scrollpane for the panel on which i am drawing some rectangles and circles which tend to go beyond the specified size of the screen

darshikbs
Автор

Where is JFrame instantiated in this example? I see that the class extends JFrame, but I don't see where a JFrame object is created. Thanks.

Jonayk
Автор

JPanel panel = new JPanel();
JFrame frame = new JFrame();
frame.add(panel);
JScrollPane c = new JScrollPane(panel);
MyComponent());

frame.setSize(1000, 800);
frame.setVisible(true);
This is what i wrote in main. and my paint method is in a different class named MyComponent, hence getContentPane. Withis, I am unable to get the scroll and my content goes out of the window.

darshikbs
Автор

Whoa two thousand twelve When all I could do was balance the on and off button on the lights

KpC
Автор

I get
Exception in thread "main"
at Source)
at Source)
at Source)
at Source)

computerchemistry
Автор

You are adding panel on frame, then you are adding panel on scrollpane and then you are adding MyComponent panel on frame. You never added scrollpane to frame. To fix that add MyComponent panel on scrollpane and then add scrollpane on frame.

OverG
Автор

Maybe you are giving instructions to a non created object.

araipi