novusZ
novusZ

Reputation: 27

How can I create Scroll at Java?

Now I study about GUI (awt&swing) in java. But I don't know how can I make scroll bar. I try to find about that matter but still i don't get it. Could you give me simple explanation and example to create it.

Thank you . I am sorry for my bad English.

Upvotes: 0

Views: 73

Answers (2)

Sanjaya Liyanage
Sanjaya Liyanage

Reputation: 4746

here is a example for swing scroll bar

and here is an example for awt scroll bar

Upvotes: 0

christopher
christopher

Reputation: 27336

Java offers the JScrollPane object for this sort of thing. Here is the documentation.

Here is a tutorial provided by Oracle on how to use them.

Example

JTextArea t = new JTextArea("This is some text");
JScrollPane s = new JScrollPane(t);
this.add(s); // Adds the scollpane to the parent container.

Upvotes: 3

Related Questions