Results 1 to 9 of 9
Thread: Creating Sliding Panels
- 07-11-2010, 10:26 AM #1
Member
- Join Date
- Jun 2010
- Location
- India
- Posts
- 8
- Rep Power
- 0
Creating Sliding Panels
The objective is to develop (using Java) a GUI component that acts like a multi-slider. The idea is to develop a GUI component (like a slider) which partitions a certain value (100 for example) into several partions where the borders in-between can be dragged to slide up/down to distribute the values of each compartment. The number of compartments should be flexible as well as text labels right-hand sided for each compartment. The numeric value for each compartment should also be visible.
See the attached pic as an example that partitions the value 11 into the parts 3,3,1,4 as an example. The user can slide each compartment's boundary to increase a certain value while the other one(s) decreases accordingly. The initial state should be an equal distribution and the user can drag each boundary to adjust values.
This Is What I want to create. But I dont have a lead.I am confused- should I look to create multiple panels based on input and then resize panels dynamically using mouse drag? Any kind of help will be greatful regarding this.. like how to approach the problem. Or if you have a class that can be helpful in this context.
SEE ATTACHED PIC FOR BETTER understanding .
- 07-11-2010, 10:49 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Have a look at the JSplitPane component. You can nest a few of them.
kind regards,
Jos
- 07-11-2010, 11:59 AM #3
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
Emm...
I dearly hope I got the question... Anyway...
You mean something like a sliding panel? When you can see always the limited number of components?
You can simply
1) create a JPanel panel with FlowLayout manager.
2) Put all panel components into a vector/List or something like that.
2.1) Add these components onto your panel
3) create two JButtons "Left" , "Right" or something
4) with these buttons control the panel components visibility
5) Then you can manipulate with components visibility
For example a little schema:
we have panel A which contains 10 components, visible components are limited with || we can see always 5 of them
Step 1:
panel A
===============
A B |C D E F G| H I J
=====visible======
buttons |<<| |>>|
Step 2 (Right button clicked):
panel A
===============
A B C|D E F G H|I J
===============
buttons |<<| |>>|
As you can see with this example we should make component C setVisible(false).
It is not a common swing task I guess so you'll have to try much to program it. But the idea is clear I hope ;)Last edited by Webuser; 07-11-2010 at 12:06 PM.
If my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 07-11-2010, 02:43 PM #4
Member
- Join Date
- Jun 2010
- Location
- India
- Posts
- 8
- Rep Power
- 0
@webuser srry u got it wrong.... I want the horizontal panels[how many is user given ]... now all panels can be resizable in the window using mouse to drag it by border. And when say one panel is expanding the other will automatically shrink to keep the total hieght of the panels same.
- 07-11-2010, 02:53 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
- 07-12-2010, 11:06 AM #6
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
- 07-12-2010, 11:30 AM #7
Member
- Join Date
- Jun 2010
- Location
- India
- Posts
- 8
- Rep Power
- 0
Thx man! I overlooked the JsplitPane..... I will try with that:D Never worked with this clas before though :p but thx for the info
- 07-12-2010, 12:16 PM #8
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
- 07-12-2010, 04:18 PM #9
Member
- Join Date
- Jun 2010
- Location
- India
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
Not understanding panels and layout?
By lost_soul in forum New To JavaReplies: 3Last Post: 04-09-2010, 04:31 PM -
Creating a time sliding window..urgent
By sm123 in forum New To JavaReplies: 1Last Post: 03-12-2010, 03:12 AM -
resizeable panels
By simo_mon in forum AWT / SwingReplies: 4Last Post: 07-29-2009, 01:45 AM -
Working with Labels on Panels.
By vargihate in forum AWT / SwingReplies: 2Last Post: 01-04-2008, 04:09 AM -
Need a tutorial for Studying about Panels
By ramachandran in forum New To JavaReplies: 1Last Post: 10-25-2007, 09:05 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks