Inheritance diagram for TrashElement::
Public Methods | |
TrashElement () | |
void | keyPressed () |
void | animationStep () |
boolean | continueAnimation () |
|
00018 { 00019 int marginLF = 0; 00020 int marginUP = ImageElement.componentSize().height / 2; 00021 int marginRG = KeyComponent.componentSize().width / 2; 00022 int marginDW = 0; 00023 int machineW = 81; 00024 int machineH = 65; 00025 00026 setSize(marginLF+machineW+marginRG, marginUP+machineH+marginDW); 00027 setMachineImage(Images.trash, marginLF, marginUP, machineW, machineH); 00028 00029 _input = createInputSocket(marginLF+26, 0); 00030 _key = createKeyComponent(marginLF+machineW-marginRG-2, marginUP + 5); 00031 } |
|
Reimplemented from AnimatedMachine.
00035 { 00036 if(_working) return; 00037 00038 if(_input.empty()) return; 00039 00040 _working = true; 00041 _nSteps = 0; 00042 _key.startAnimation(); 00043 } |
|
Reimplemented from AnimatedMachine.
00047 { 00048 Point p = _input.getLocation(); 00049 p.translate(0, 5); 00050 _nSteps++; 00051 _input.setLocation(p); 00052 repaint(); 00053 00054 if(_nSteps >= 4) { 00055 _input.removeElement(); 00056 p.translate(0, -5 * _nSteps); 00057 _input.setLocation(p); 00058 _working = false; 00059 } 00060 } |
|
Reimplemented from AnimatedMachine.
00064 { 00065 return _working; 00066 } |