Solved

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

Posted on 2004-08-01
5
225 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

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
github account with ecipse 1 42
stackato and cloud 4 73
servlet requestdispatcher include and forward differences 1 24
expectj telnet failing 5 26
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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:

895 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

15 Experts available now in Live!

Get 1:1 Help Now