How to best design the UI?

Posted on 2003-11-18
Medium Priority
Last Modified: 2011-04-14
Hi all..

I have a project and I really need your help..

This program is to help the action desk handle complaints..

The first user interface will allow its user to specify his position..it will have two buttons (manager/employee)..

when the employee click on employee..an interface will appear and the employee will have to specify his name, id, and the problem details..he will also choose the complaint type (software/hardware) [two radio buttons]..and then send it to the manager by clicking [send] button..

After that the manager will enter his window..and he will have a list of technicians names to assign each compalint to a technician using automatic complaint number..
also the manager will be able to see (number, id, type, technicain name, date and status) for each complaint..and specify details

The program will have to show the date and calculate complaint number automatically..

Im thinking of having two lists..the manager will choose the complaint number from the first one..and choose a technician name to assign..and then all the other information will appear in a text area..

I want to ask about the best way in which I could design the manager interface and its different options..How will the manager be able to choose a complaint number, assign a technician to it..and show all the mentioned information..

Is there any other better way..? and how can I calculate the complaint number and date automatically?

waiting..and sorry if the question is too long

Question by:swet
  • 5
  • 4

Expert Comment

ID: 9771776
You could actually handle the interface changing, (from manager to employee and back,) using a drop-down box with three choices:

Select Role

And then in a separate JPanel, you could populate the inputs of a manager and an employee pane based upone the valueChanged() event which gets spawned every time the value of the drop-down box changes.  The only trick is that you'd probably want to eliminate the "Select Role" option the moment they select one of the roles, or at least ignore it when the valueChanged() event shoots off.

As for the two lists, I'd also reccoment a drop down box.  It's small, succinct, and easy to dynamically populate, which will be good once technicians join and leave the company.  You can keep the list of them in a database, for example.

Speaking of databases, I assume you're using one to store the Action Desk complaints.  In that case, you can just create a column that automatically increments a number for you to designate the complaint number.

The last issue is the date.  That's actually trivial.  Just look up in the API java.util.Calendar.  The code to generate a date looks like this, more or less, depending on what format you want:

Calendar now = Calendar.newInstance();
int year = now.get( Calendar.YEAR );
int month = now.get( Calendar.MONTH );
int day = now.get( Calendar.DAY );

System.out.println( "Date is:\t" + month + "/" + day + "/" + year );

Author Comment

ID: 9771840
thanks very much..

but can you help me with some simple codes to use the drop-down box?

what do I have to do..Do I have to create three classes or only one..

I'm afriad I can't do it :(

and what is more..is that we havn't studied data bases yet..My teacher advised me to use vector..but Im still confused..

waiting to hear from you...


Expert Comment

ID: 9771859
Ah.  I just found it.  You want to register your Drop-Down List, ( with Select Role, Employee, and Manager, ) with the Listener Interface:


It has the one method:

valueChanged( ListSelectionEvent e )

Usually you actually have to register the Listener with your list's ListSelectionModel, which is easy enough to get:

ListSelectionModel myModel = myList.getSelectionModel();
myModel.addListSelectionListener( myListener );
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 9771889

So..when I will start my project..how many interfaces will I need..Will I need one for the drop down box, one for the manager, and one for the employee?

when I will select from the list say Manager..what will happened..will another window appear?

thanks in advance

Accepted Solution

SuperKarateMonkey earned 480 total points
ID: 9771970
Ah, I see where your skill level is now:

OK, first of all, bookmark this web page:


You should consider this the Holy Grail of java reference.  It has EVERY class you could ever worry about, and every method of every class.  This assumes you're working in J2SDK 1.4.2, of course, (you can see from the URL.)  If you're using a different JDK, just alter the URL, so if you're using 1.3.1, then make your URL:


etc. etc. etc...

Now, I'm not going to write your code for you, (this is class, you need to learn for yourself,) but I'll skeleton it out, which should provide some help.  Assuming you're using swing to create your GUI, you'll need to work with the javax.swing package:

1.  Create a JFrame

2.  Create 2 JPanels, add them to the JFrame, a small one, (30% of the JFrame,) on the left, and the bigger one on the right.

3.  Create a JList to add to the first JPanel on the left.  There are a 4 constructors.  Use the one:

JList( Vector listData )

A Vector is like an array, only it's resizable, and will automatically resize itself when you add more objects to it.  So you work with a vector like this:

Vector v = new Vector();
v.add( "Four" );
v.add( "Score" );
v.add( "And" );
v.add( "Seven" );
v.add( "Years" );
v.add( "Ago..." );

for( int i = 0; i < v.size(); i++ )
  System.out.println( (String)(v.get(i)) + " " );

This would print out:

Four Score And Seven Years Ago...

Anyway, that's a bit of overkill.  Point is, you can dynamically resize a Vector.

4.  Get the ListSelectionModel from the JList, register the ListSelectionListener to it.

5.  For the listener, write the code to populate the right hand JPanel whenever the valueChanged event fires off, with AI to determine what the resultant value is.  You might want to ignore the change if it returns to "Select One," or you might want to simply delete "Select One" from the list the first time the list changes, since at that point they've picked a horse.

That's about it for the skeleton code.  That should be enough for your to get started.

You might also want to look in the Sun's Swing Tutorial, located at:


Good luck.

Expert Comment

ID: 9772015
As for your specific questions, you need to be careful with terminology.  I'm not sure what you mean by "interfaces."  It doesn't sound like you're referring to the java definition of an interface, but rather UI components, (which is what you should call them:  UI Components.)

You'll need two completely separate routines to create the two UI's, one for the manager part and one for the employee part.  Probably the best way to handle that is to create them both, and add them both to two different JPanels, (making for a total of three:  The selector panel, the manager panel, and the employee panel.)  Then, when the selection of the list changes, you can just add the JPanel wholesale to the section on the right.  If it changes again, you just remove the entire panel that's currently there, and add the other one.  You'll need to explicitly keep track of which one is added, so that when you submit your data it doesn't use values from an irrelevant JPanel Component, but that's easily enough done.

Author Comment

ID: 9772016

thanks alot..

as you see..I'm just a begginer..

your explaination has helped me alot..

but I have a question..Do you mean that when I choose say (manager) from the left list..the right panel will show me the options of the manager?

Author Comment

ID: 9772038

Oh..thanks alot..

now I will try doing it :)

Expert Comment

ID: 9772061
OK.  Don't forget to close out the question when you finish, and good luck. :)

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month16 days, 20 hours left to enroll

864 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