Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

split pane problem

Posted on 2001-08-29
12
Medium Priority
?
252 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
[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
12 Comments
 
LVL 6

Expert Comment

by:kotan
ID: 6438997
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
ID: 6439018
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
ID: 6439029
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Expert Comment

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

Author Comment

by:sanjay_thakur
ID: 6441349
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
ID: 6441912
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
 
LVL 4

Author Comment

by:sanjay_thakur
ID: 6441917
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
ID: 6442011
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
ID: 6454020
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
ID: 6454337
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 60 total points
ID: 6454345
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
ID: 6454655
Thanks.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
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…
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 about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

719 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