Re: Gui Question
- From: "Bjorn Abelli" <bjorn_abelli@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Mar 2006 14:44:01 +0200
"IanH" wrote...
I do have some questions
1. Do I need to use the following code to declare instances of the
objects?
SalariedEmployee salariedEmployee = new SalariedEmployee
HourlyEmployee hourlyEmployee = new HourlyEmployee
CommissionEmployee commissionEmployee = new CommissionEmployee
BasePlusCommissionEmployee basePlusCommissionEmployee = new
BasePlusCommissionEmployee
You'll need to do it somewhere to have any instances to play with, just as
in the PayableInterfaceTest your teacher has provided.
2. the combobox on the interface currently doesn't have any action
attached to it. Can i use it to specify the type of employee to create.
Sure you can, if that's what you want.
As this seems to be a school assignment, you could take the easy way out,
and that is to
- have JTextFields for all attributes in the classes (those needed
in the constructors in each class).
- use the JComboBox "passively" just to choose which type of instance
you want to create,
- use a JButton (with an associated ActionListener) in order to:
o. instantiate from the chosen class
(get selected value from the JComboBox),
o. store the instance in an ArrayList,
o. and put the output in a JTextArea
(similar to what's printed from the PayableInterfaceTest)
My guess is that you will have another assignment to follow, where you will
be able to retrieve the data from the already created employees...
BTW, have you tested the classes you already have against the
PayableInterfaceTest? It won't work unless you add the operation
getPaymentAmount in the class Emplyoee...
And how does the interface MyPanel come into the assignment? What does that
look like? Why must Employee implement that?
// Bjorn A
.
- References:
- Gui Question
- From: IanH
- Re: Gui Question
- From: Rhino
- Re: Gui Question
- From: IanH
- Re: Gui Question
- From: Rhino
- Re: Gui Question
- From: IanH
- Re: Gui Question
- From: Rhino
- Re: Gui Question
- From: IanH
- Gui Question
- Prev by Date: Re: help needed - decompiling
- Next by Date: Timer as an inner class
- Previous by thread: Re: Gui Question
- Next by thread: Re: Gui Question
- Index(es):