0

I have a Java Swing program with a dialog that i want to design in a better way. A window in the program has a button where user needs to click that button to open a small dialog to select a couple of customers names then save his selection where then i do some action on that selection in the main window.

The problem is in designing that small dialog. The user can do 2 actions inside it :

  1. Enable the customers' names he wants to use.
  2. Select a customer name to edit or delete it from the database.

Here is the initial dialog design :

------------------------------> enter image description here

My initial thinking to accomplish this is :

  1. To enable a name to use it in the main window user has to tick its selection box (i.e. Name 3).
  2. To edit or delete a name user has to highlight the label of the name itself then click the Edit button. So highlighting a name will not tick(enable) it (i.e. Name 2).

My 2 questions are :

  1. Will the user be familiar with this behavior(He can do two actions on each list item).
  2. In Java Swing should i use a JList of (JCheckBox + JLabel) items to accomplish this, or use a JTable ?
Brad
  • 4,457
  • 10
  • 56
  • 93
  • For question one, why don't you just have some friends unfamiliar with programming test it out and get some opinions. For the second question, a list seems suitable. No point in table for just one column. – Paul Samsotha Jan 28 '14 at 07:05
  • @peeskillet ... Question 1: I have already done that, and it was a confusing thing for them :) ... Question 2: Checking if a JCheckBox list item is enabled/disabled or highlighted is complicated. When i highlight an item it automatically enables it which is not what i wanted. – Brad Jan 28 '14 at 07:11
  • Maybe use a `CardLayout`. Have a different list for each `JPanel` in the `CardLayout`. Each list will be for different purpose. The initial list, you disable it. It can by just a view only list. When the use clicks the edit button, it will switch panels to a the list that a user can edit. Have all the lists share the same model. Does that make sense to you? – Paul Samsotha Jan 28 '14 at 07:18
  • 1
    I'd be concerned about mixing responsibilities. Either allow the user to be able to select a series of users OR manage them. The context is important at this point. It's not to say that you couldn't re-use the same UI and supply different actions based on that context though – MadProgrammer Jan 28 '14 at 07:39
  • `JList` & `JTable` approaches are examined [here](http://stackoverflow.com/q/21358240/230513). – trashgod Jan 28 '14 at 07:50
  • @peeskillet ... It is a nice suggestion, but i think that will not be user friendly behavior ! – Brad Jan 28 '14 at 15:19
  • @MadProgrammer .. Actually i agree with you. I didn't want to use 2 different dialogs, but if i have no other user-friendly solution then i will have to use 2 dialogs. – Brad Jan 28 '14 at 15:21

2 Answers2

0

The simplest way in my opinion is to put access to the actions you want to do just at the side of each name. To be more clear, here's a picture taken from the phpmyadmin software (see below).

You can do something like the "Action" column of the picture ! it's very intuitive and fits very good your need (phpmyadmin helps managing databases, and it's close to what you are doing)

phpMyAdmin (http://www.pc6.com/up/2011-6/201163162941.jpg)

Peter Lang
  • 54,264
  • 27
  • 148
  • 161
Hichamov
  • 636
  • 6
  • 8
  • http://stackoverflow.com/questions/19766/how-do-i-make-a-list-with-checkboxes-in-java-swing , this should be interesting to do it. – Hichamov Feb 18 '14 at 11:50
  • Thanks, but don't you think this won't be user-friendly for the user ? – Brad Feb 19 '14 at 09:31
  • I think that it is pretty intuitive, this is used in lots of existing software, especially database management systems (which is pretty close to what you are doing). You can also use buttons (in pen shape and gear shape) and avoid the checkboxs – Hichamov Feb 19 '14 at 12:00
  • It would be a rather good idea to do some mock ups and take advice from friends (you show it them and ask them what they understand of it, without you explaining to them anything). A simple free and fast way to do mockups : https://moqups.com/ (in case you never heard of it ! hope I am helping – Hichamov Feb 19 '14 at 12:02
  • 1
    another option : http://www.pc6.com/up/2011-6/201163162941.jpg (it's phpmyadmin) try to do something like the 'Action' column in the image ;) – Hichamov Feb 19 '14 at 12:05
  • The sample of phpmyadmin is very nice, and i have already thought about it. I will use a JTable in that case. – Brad Feb 19 '14 at 19:28
  • Very good then ! I'll be happy to help if you need to discuss it even more – Hichamov Feb 19 '14 at 19:59
  • Thanks a lot :) .. Please just edit your answer with the phpmyadmin answer so i can tick it as the right answer. The answer you have written is not even clear to me :) – Brad Feb 20 '14 at 04:16
0

Maybe you can split the list?

+---------------------------------------------------+
|  Available users            Selected users        |
|  +------------------+       +------------------+  |
|  | Name 1           |       | Name 3           |  |
|  | Name 2           |  [>]  |                  |  |
|  |                  |  [<]  |                  |  |
|  |                  |       |                  |  |
|  +------------------+       +------------------+  |
|  [Add]           [Edit] [Delete]                  |
+---------------------------------------------------+
|  [Import][Export]                  [OK] [Cancel]  |
+---------------------------------------------------+
  • Buttons > and < are used to move users between lists.
  • Multi-select left and right to allow adding/removing more than one user at once.
  • Double-click should also move one entry.
  • Selection only allowed in left or right list (selecting left automatically removes selection right)
    This would allow to use the Edit/Delete button for both.
    Buttons only enabled when exactly one item is selected.
  • Add button adds the user in the left list and automatically selects it afterwards
  • OK is only enabled when at least one user is used.
Peter Lang
  • 54,264
  • 27
  • 148
  • 161