0

I am creating an IMDB application which displays and organizes movies found on you computer (by looking up the metadata via an IMDB API).

In my search panel I want to give the user the option of looking for movies that were released in a specific range of years (e.g. between 1990 and 2005). Currently I use for this two JSpinners, one for the minimum year and one for the maximum year and use cross validation to check whether maxYear >= minYear && minYear <= maxYear However I don't think this is very user-friendly.

What I would like is a JSlider with two knobs, one for min and one for max. Is this possible? Do you have any other ideas on how to make this interface more user-friendly?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Héctor van den Boorn
  • 1,218
  • 13
  • 32
  • `maxYear >= minYear` means the same as `minYear <= maxYear` so in `maxYear >= minYear && minYear <= maxYear` you are checking same condition twice. Only one condition is enough. – Pshemo Mar 28 '13 at 16:55

2 Answers2

1

You could have two JTextFields, and just let the user type the minimum and maximum years.

Otherwise, two JSpinners is another choice. Developing a custom component that your users have never seen is not user friendly.

You can cross connect the two JSpinners so that it's impossible for the user to enter a minimum year greater than a maximum year. I've not done this, so I don't have a code example to show you.

Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111
  • You just recommended using the exact same thing he said he's actually using :/ – asermax Mar 28 '13 at 16:57
  • @asermax: The OP said he was checking. I suggested enforcing. In other words, programatically changing the minimum year when the maximum year is changed, and vice versa. – Gilbert Le Blanc Mar 28 '13 at 16:59
1

This looks promising: Creating a Java Swing range slider

And here's another example that I think came from the old Tame examples: MThumbSlider

splungebob
  • 5,357
  • 2
  • 22
  • 45