Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • 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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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