Solved

How do I make a component visible in the left lower corner of a JScrollPane?

Posted on 2004-08-01
5
215 Views
Last Modified: 2010-03-31
I created some JScrollPane's with widened scrollbars to dimension space for a button on the lower right corner.
Now I need to add a second button. As the corner object has to be a Component, I can't put a JPanel with 2 buttons
in there.
So the second button goes to the other corner:

        scrollPane.setCorner(ScrollPaneConstants.LOWER_RIGHT_CORNER, firstButton);
        scrollPane.setCorner(ScrollPaneConstants.LOWER_LEFT_CORNER, secondButton);

As I don't really need a row header in there, how do I make that button visible
and how do I dimension space for it?

;JOOP!
0
Comment
Question by:sciuriware
  • 3
  • 2
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 11691299
A JPanel is a subclass of Component so it can be used.
0
 
LVL 24

Author Comment

by:sciuriware
ID: 11691331
You're right, but in this case it doesn't work: however big the space in the corner, you'll see only 1 button.
Maybe there's a simple solution to it, but as the vertical scrollbar must be widened to "elderly-people-with-sight-problems"
measures, I'd prefer the button on the left.
Any suggestion?

;JOOP!
0
 
LVL 24

Author Comment

by:sciuriware
ID: 11691479
     setRowHeaderView(rowHeader = new JLabel());
      rowHeader.setPreferredSize(new Dimension(width, Integer.MAX_VALUE));

does the job!

;JOOP!
0
 
LVL 92

Expert Comment

by:objects
ID: 11691508
good stuff :)
0
 
LVL 24

Author Comment

by:sciuriware
ID: 11691524
I'm not sure and I don't have the time, but I guess setting a fixed size on the JPanel would at least
have done something useful.
So, because I forgot that implication, you are getting your points.
;JOOP!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

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

10 Experts available now in Live!

Get 1:1 Help Now