Aug 22, 2014

SWING JScrollPane (JAVA GUI)





This post about scroll.

We need scrollbar when making chat or communication program.

We can easily add scrollbar using JScrollPane.

Just add JScrollPane and paste to text-window.

My case paste to JEditorPane commText.


And go to source.

  1.         JScrollPane scrollPane = new JScrollPane(commText);
  2.         scrollPane.setBounds(1210471389);
  3.         frame.getContentPane().add(scrollPane);
Look at Line 1.

JScrollPane include JEditorPane commText.

And Line 2 is JScrollPane's size.

The size bigger then JEditorPane's size.

Okay, run to source.

You can see this picture.


You don't see Scrollbar .

If you add text more

You can see Scrollbar.


No comments:

Post a Comment