Solved

arranging image icon and JScrollPane horizontally and more...

Posted on 2004-04-12
7
179 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
Comment Utility
You probably want to look into JTextArea.
0
 
LVL 30

Expert Comment

by:mayankeagle
Comment Utility
0
 

Author Comment

by:dkim18
Comment Utility
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
Comment Utility
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:mayankeagle
Comment Utility
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

744 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

8 Experts available now in Live!

Get 1:1 Help Now