Solved

split pane problem

Posted on 2001-08-29
12
201 Views
Last Modified: 2010-08-05
Hi,
I have a JSpiltpane  with horizontal orientation

I have set oneTouchExpandable property of splitpane to true

But When the user presses the down arrow control
I still want a minimum size of the bottom component
to be seen.

How do I do this
because right now clicking on the down arrow
hides the entire bottom component

some code will be helpful

0
Comment
Question by:sanjay_thakur
12 Comments
 
LVL 6

Expert Comment

by:kotan
Comment Utility
You have a lot of question in "unlockedq" status.
Are you going to do the same on this question?
   
Questions Asked : 39
Last 10 Grades Given : B B B B B B B B B A
Question Grading Record : 16 Answers Graded / 16 Answers Received

We only help those people are responsible
0
 
LVL 4

Author Comment

by:sanjay_thakur
Comment Utility
hey
I am not the only one who is using this account
There is a whole group .
I hope you can understand  now why it is like this

Anyways I have asked every one to grade the questions
and to be responsible.

Thanks for the consideration anyway

0
 
LVL 4

Expert Comment

by:sdussinger
Comment Utility
If that's the case, maybe it would be a good idea to create your own account here. That way you wouldn't get lumped in with your irresponsible peers...

As for the question, use the following subclass for your split panes:

class MySplitPane extends javax.swing.JSplitPane
{
    private int bottomMinHeight = 100;
   
    public MySplitPane () { super (); }
   
    public int getBottomMinHeight ()
    {
        return (bottomMinHeight);
    }
   
    public void setBottomMinHeight (int height)
    {    
        bottomMinHeight = height >= 0 ? height : 0;
    }
   
    public void setDividerLocation (int loc)
    {
        if (loc > getHeight () - getDividerSize () - getBottomMinHeight ())
            super.setDividerLocation (getHeight () - getDividerSize () - getBottomMinHeight ());
        else
            super.setDividerLocation (loc);
    }
}


This sets a default of 100 pixels as the minimum height for the bottom pane.

You can change this minimum height by calling the setBottomMinHeight () method.

HTH

--Steve
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
So do u use ee as your business's help desk?
0
 
LVL 4

Author Comment

by:sanjay_thakur
Comment Utility
for objects,
No but what do you expect from a bunch of students.

I just helped them by giving them the access.

I have already said I will work it up.

Is little bit consideration too much to ask for?

0
 
LVL 4

Author Comment

by:sanjay_thakur
Comment Utility
for sdussigner
Hi, I am able to keep a minimum size for split pane but it has changed somethings

1) I had set divider size to some int value
like splitpane.setDividerSize(divSize);

by when the screen initially shows up i think
it still takes the default size of the divider
only if I click on the divider I get the size
which I have set.

How do I enforce a minimum size for the divider?

2) when I use the arrow buttons.it somehow
doesnot go to the previous divider location
I mean whenevr I click the up arrow it completely
hides the top component no matter
where the divider is.

Ideally when you click the up arrow it goes back
to the previous divider location

I tried using  splitPane.setLastDividerLocation(value);
but doesnot work

Any help ?

















0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 4

Author Comment

by:sanjay_thakur
Comment Utility
for sdussigner
Hi, I am able to keep a minimum size for split pane but it has changed somethings

1) I had set divider size to some int value
like splitpane.setDividerSize(divSize);

but when the screen initially shows up i think
it still takes the default size of the divider
only if I click on the divider I get the size
which I have set.

How do I enforce a minimum size for the divider?

2) when I use the arrow buttons.it somehow
doesnot go to the previous divider location
I mean whenever I click the up arrow it completely
hides the top component no matter
where the divider is.

Ideally when you click the up arrow it goes back
to the previous divider location

I tried using  splitPane.setLastDividerLocation(value);
but doesnot work

Any help ?

p.s:has this anything to do with restricting
the size of the bottom component















0
 
LVL 4

Expert Comment

by:sdussinger
Comment Utility
1) I can't duplicate this. When I set the divider size to 30, it showed up on the screen immediately.

2) The problem here is that the code needed to do this would interfere with the dragging of the divider. The code to handle the moving of the divider is in the Swing L&F code itself. This code doesn't indicate to the JSplitPane whether the moving is being done by dragging or by clicking on the butons. If we put the code in here to handle the click case, then the drag case would break, since we can't tell them apart.  I put the code in to test it, and the click case works, but the drag case fails horribly.

The only other solution is to subclass the L&F code to get the behavior, but this would be a lot of work for potentially little gain...

--Steve
0
 
LVL 4

Author Comment

by:sanjay_thakur
Comment Utility
Hi steve
Sorry for replying late

I am not able to set the divider to the
size I need.

My question is if the components (top and bottom component)
have a box layout and the maximum size is
set to the screensize

then It will affect the divider's size.
Is there any way to define a minimum size for the divider

I dont think ther is an API.Is there any workaround?




0
 
LVL 4

Expert Comment

by:sdussinger
Comment Utility
In the MySplitPane class, override getDividerSize ().

public void getDividerSize () { return (30); }

This worked for me (of course, calling setDividerSize on the split pane worked for me, as well :-))...

HTH

--Steve
0
 
LVL 4

Accepted Solution

by:
sdussinger earned 15 total points
Comment Utility
I really need to proof my stuff, before I post it.

Of course the getDividerSize method in the previous needs to return an int, not be void...

public int getDividerSize () { return (30); }

--Steve
0
 
LVL 4

Author Comment

by:sanjay_thakur
Comment Utility
Thanks.
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
allStar challenge 1 41
Java Message handling in Service Layer 3 37
Java passing arguments (type error) 2 33
Problem to start Neon 20 51
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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

15 Experts available now in Live!

Get 1:1 Help Now