Solved

Making my JDesktopPane scrollable

Posted on 2003-11-17
2
1,356 Views
Last Modified: 2007-12-19
Greetings.  I'm creating an application that takes an MDI approach, so I've implemented JDesktopPane and have created JInternalFrame's as the interior windows.  I'd like to make this scrollable so that when any of the interior windows is clipped, appropriate scroll-bars are displayed.  I've done some research on this, and from what I've seen most people accomplish this by creating a subclass of JDesktopPane (call it, say, JScrollableDesktopPane) and have this subclass implement the Scrollable interface.

Well, I've tried this, and I can't seem to get it to work.  I think I'm just unclear as to how I'm supposed to use this JScrollableDesktopPane once I've made an instance of it.  Here's what I'm currently trying, and is not working:

1) Create an instance of JScrollableDesktopPane (which is just JDesktopPane that implements Scrollable)
2) Create an instance of JScrollPane, passing my JScrollableDesktopPane in
3) Setting my main JFrame's content pane (setContentPane) to the instance of JScrollPane

Am I completely off here, or am I on the right track.  Any advice is greatly appreciated!

-Rick
0
Comment
Question by:slikrik98
2 Comments
 
LVL 9

Accepted Solution

by:
yongsing earned 350 total points
Comment Utility
Here's an article on how to add scroll bars to the desktop pane:

http://www.javaworld.com/javaworld/jw-05-2001/jw-0525-mdi.html
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights  challenge 17 59
nestparen challenge 4 55
pairs challenge 5 44
wordmultiple challenge 12 89
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

771 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

10 Experts available now in Live!

Get 1:1 Help Now