Solved

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

Posted on 2004-08-01
5
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

635 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