Solved

arranging image icon and JScrollPane horizontally and more...

Posted on 2004-04-12
7
182 Views
Last Modified: 2010-03-31
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
Comment
Question by:dkim18
  • 2
  • 2
7 Comments
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 10810650
You probably want to look into JTextArea.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10810654
0
 

Author Comment

by:dkim18
ID: 10818052
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
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 125 total points
ID: 10818292
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 10820998
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JDeveloper 12c for 32 bit 4 71
Responding to Java JComponent extended classes's resize event 4 52
Strange loading of website behaviour 3 32
Java Timer (static) 9 36
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This video teaches viewers about errors in exception handling.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now