File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Opinions on Three Different Approaches Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Opinions on Three Different Approaches" Watch "Opinions on Three Different Approaches" New topic

Opinions on Three Different Approaches

David Dickinson
Ranch Hand

Joined: Nov 11, 2004
Posts: 66

I'm looking for opinions regarding the different approaches I explain below. Technical opinions are welcome but i'm particuarly looking for HCI opinions.

I have a JTable which displays information from an ArrayList of Objects.

I need to have a few options which edit the contents of these table, remove row, add row, modify row.

I have been experimenting with a few options and have narrowed it down to the following:

  • Popup Menu with remove/modify options, activated by right clicking on the table and the "highlighted" row will be the row altered. Add row would probably need to be implemented outside of the popup menu.
  • Three buttons below table, whichever row is selected when the remove/modify button is clicked is altered.
  • Buttons appear within the table rows, a new column is added which holds buttons. A little repetitive though if a large number of rows exists.

  • I'd appreciate some advice/opinions.

    Stuart Gray
    Ranch Hand

    Joined: Apr 21, 2005
    Posts: 410
    I would personally use option B. A would be a nice option if rows can be added anywhere: for example, if clicking on a row and choosing Add would insert the new row before the selected row.
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand

    Joined: Jul 11, 2001
    Posts: 15302

    I would do A and B and also add the ability to do these actions with keystrokes.

    GenRocket - Experts at Building Test Data
    Steven Bell
    Ranch Hand

    Joined: Dec 29, 2004
    Posts: 1071
    I would also vote for option B. As a bonus it would allow for multiple row removal in a single action, if you decided to allow that.

    I was just looking at add/remove, for modify why not just let the rows be editable and have an update button. This would allow for multiple row updates also.
    [ April 21, 2005: Message edited by: Steven Bell ]
    Stuart Gray
    Ranch Hand

    Joined: Apr 21, 2005
    Posts: 410
    Of course, it also depends on how often the user will carry out each action. For example, if they are likely to be removing rows very often, they are going to get very annoyed with:

    1. click on row
    2. Move mouse to bottom of screen
    3. Click Remove
    4. Move mouse back up to next row

    But if they only remove rows once in a while then I think that would be acceptable.
    David Dickinson
    Ranch Hand

    Joined: Nov 11, 2004
    Posts: 66
    I've been thinking about these approaches and wonder if the following would be the best solution...

    The concept is based around option A above.

    User clicks a row with the left mouse button to select the row (right mouse button doesn't select in tables, if you know if this can be altered please say). When the right mouse button is clicked the drop down list is as follows..
    - Add
    - Remove
    - Modify

    -Add opens a dialog box accepting the neccessary values, when ok is selected the new row is placed at the bottom of the table.
    -Remove displays a confirmation dialog then deletes the selected row if yes selected.
    -Modify opens a dialog asking for the new values for the selected row then updates object.

    I don't think its ideal, but its fairly neat and tidy. Would it be worthwhile combining this with a button below the table which is used to update any changed rows.

    Does anyone know if its possible for the RMB to select a row before opening the popup menu?

    Added: This is a university project and is aimed as a demonstration of ability not to be used as a long term system.

    Thank-you for your responses.
    [ April 21, 2005: Message edited by: David Dickinson ]
    Stuart Gray
    Ranch Hand

    Joined: Apr 21, 2005
    Posts: 410
    The only thing about that which would concern me: if you are entering a lot of data, you want to keep your hands on the keyboard. Having extra dialogs etc come up make you reach for the mouse and break your flow of work. Keyboard shortcuts (as mentioned by an earlier poster) should definitely be implemented in this case IMHO.
    I agree. Here's the link:
    subject: Opinions on Three Different Approaches
    It's not a secret anymore!