1 | package org.honours.gui;
|
---|
2 |
|
---|
3 | import java.awt.event.KeyEvent;
|
---|
4 | import java.awt.event.KeyListener;
|
---|
5 |
|
---|
6 | import org.expeditee.gui.DisplayIO;
|
---|
7 | import org.expeditee.gui.Frame;
|
---|
8 | import org.expeditee.gui.FrameGraphics;
|
---|
9 | import org.expeditee.gui.FrameKeyboardActions;
|
---|
10 | import org.honours.actions.MiscActions;
|
---|
11 | import org.honours.collection.Collection;
|
---|
12 |
|
---|
13 | public class KeyboardActions implements KeyListener{
|
---|
14 |
|
---|
15 | private static KeyboardActions _instance = null;
|
---|
16 |
|
---|
17 | private KeyboardActions(){}
|
---|
18 |
|
---|
19 | public static KeyboardActions getInstance(){
|
---|
20 | if(_instance == null)
|
---|
21 | _instance = new KeyboardActions();
|
---|
22 |
|
---|
23 | return _instance;
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public void keyPressed(KeyEvent e) {
|
---|
28 |
|
---|
29 | int keyCode = e.getKeyCode();
|
---|
30 | Frame currFrame = DisplayIO.getCurrentFrame();
|
---|
31 | Collection coll = Collection.findCollection(currFrame);
|
---|
32 |
|
---|
33 | if(coll != null){
|
---|
34 | //If F9 (Audience Mode button) has been pressed.
|
---|
35 | if(keyCode == KeyEvent.VK_F9){
|
---|
36 |
|
---|
37 | if(FrameGraphics.isAudienceMode()){
|
---|
38 | //turn off display of toolbar.
|
---|
39 | HonoursFrameIO.DISPLAY_TOOLBAR = false;
|
---|
40 | MiscActions.ToggleToolbar();
|
---|
41 |
|
---|
42 |
|
---|
43 | }else{
|
---|
44 | HonoursFrameIO.DISPLAY_TOOLBAR = true;
|
---|
45 | MiscActions.ToggleToolbar();
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | }
|
---|
50 | FrameKeyboardActions.getInstance().keyPressed(e);
|
---|
51 | }
|
---|
52 |
|
---|
53 | @Override
|
---|
54 | public void keyReleased(KeyEvent e) {
|
---|
55 | FrameKeyboardActions.getInstance().keyReleased(e);
|
---|
56 |
|
---|
57 | }
|
---|
58 |
|
---|
59 | @Override
|
---|
60 | public void keyTyped(KeyEvent e) {
|
---|
61 | FrameKeyboardActions.getInstance().keyTyped(e);
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | }
|
---|