Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: A question on GUI
|
Posted: Mar 17, 2002 2:18 PM
|
|
> Is JradioButton different from normal radio buttons? > I think i am using the normal radio buttons?.
You appear to be using Checkboxes. A group of check boxes allows you to check zero to all available options, where as a group of radio buttons lets you choose just one option. I guess it depends upon what kind of multiple choice questions you have; some allow multiple answers, some only allow one answer. ...Ah ha, I've just looked at the documentation for CheckBoxGroup and it appears that Sun is at fault! It has the behavior of a radio group. So they are just confusing the nomenclature. This appears to be a mistake in AWT that was corrected in Swing (which has JCheckBox and JRadioButton, instead of using checkboxes as radio buttons). Oh well. I would still use JRadioButton where I want radio buttons and JCheckBox where I want checkboxes, just to keep the code and concepts clear.
> All questions on one form because as this is my first > GUI experience I am making things easy for myself and > hence all on one page otherwise i dont mind questions > at a time.
I think it will be more difficult to try and lay out so many controls on one pane. You will probably even have to make it scrollable. Having a simple layout with controls that are updated to reflect the current question is much easier to implement.
> Why Vectors, not ArrayList? because had enough of > arrays in my life and want to experience LinkedLists > or vectors and hence i chose the later.
An ArrayList and a Vector both implement the List interface (Vector was retrofitted to it), which is what you'd most likely be using. Also, if you are using the List interface and are really enamored of linked lists, then you would instantiate a LinkedList object and use that. The point is that the Vector has been kept for backward compatibility, but it is recommended that you use List (with one of its implementations, such as ArrayList or LinkedList) for new development. Finally, for your application, ArrayList is probably better than LinkedList because you will probably not be adding and removing Question items in random locations in the list; you will more likely fill the list once, then navigate through it. For such a small collection, it hardly matters, though, since the performance difference would be imperceptible.
> Why the list of quiz question STATIC? as you have > guessed I want to create a Question class and then > have a question list containing instance of that > class.
That doesn't answer the question of why it is static. Maybe you are not clear on the meaning of static. Look a few days back for a post where I explained that and posted a little sample program to illustrate the difference between static and instance variables. A static variable is one single variable that is shared for every instance of the class. I think if you have a Quiz class, that each instance of it should be able to maintain its own list of Questions, therefore the collection should not be static.
|
|