Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

arranging image icon and JScrollPane horizontally and more...

Hi!

I am trying to arrange image icon and JScrollPane horizontally. This is a sample site.

http://webdev.apl.jhu.edu/~rbe/java/Homework5/index.html

****************************************
    JLabel explanatoryArea = new JLabel("This is a explanatory area.");
    scrollPane = new JScrollPane(explanatoryArea);
    scrollPane.setPreferredSize(new Dimension(50, 60));
    container.add(scrollPane, BorderLayout.NORTH);

***********************************
Also, if I want my text start from left top corner in the scrollpane, how do I do it?
I don't think JLabel is the way...

thanks,
0
dkim18
Asked:
dkim18
  • 2
  • 2
1 Solution
 
Tommy BraasCommented:
You probably want to look into JTextArea.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
0
 
dkim18Author Commented:
This question is not about JTextArea, but arranging icon and jscrollpane just like sample.
(if you resize the sample wizard, you will know it is scrollpane.)
0
 
Tommy BraasCommented:
Look into the various layout managers.

The dialog showing in the example I would have made out of 2 JPanels. 1st panel at top with the icon and text using FlowLayout. 2nd panel at bottom, Flowlayout again. Using BorderLayout for the main panel. JLabel is an excellent way of showing an image icon.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now