| 39 | import GraphServer.Constants; |
| 40 | |
| 41 | public class GlobalScreen extends JPanel implements ActionListener, StartStopPanel |
| 42 | { |
| 43 | private Graphwar graphwar; |
| 44 | |
| 45 | private JLabel[] backgroundImages; |
| 46 | |
| 47 | private String message; |
| 48 | private int messageX; |
| 49 | private boolean showMessage; |
| 50 | |
| 51 | private GraphButton createButton; |
| 52 | private GraphButton gameRoomButton; |
| 53 | private GraphButton backButton; |
| 54 | private JTextField chatField; |
| 55 | private GraphTextBox chatBox; |
| 56 | private GlobalPlayerBoard playerBoard; |
| 57 | private RoomBoard roomBoard; |
| 58 | |
| 59 | private JLabel[] backgroundsCreate; |
| 60 | private JTextField nameFieldCreate; |
| 61 | private JTextField portFieldCreate; |
| 62 | private GraphButton yesButtonCreate; |
| 63 | private GraphButton noButtonCreate; |
| 64 | private boolean createVisible; |
| 65 | |
| 66 | private JLabel[] backgroundsShowMessage; |
| 67 | private GraphButton okButton; |
| 68 | private JLabel messageLabel; |
| 69 | private boolean showMessageVisible; |
| 70 | |
| 71 | private static Font font = new Font("Sans", Font.BOLD, 12); |
| 72 | |
| 73 | public GlobalScreen(Graphwar graphwar, String confFile) throws InterruptedException, IOException |
| 74 | { |
| 75 | super(); |
| 76 | |
| 77 | this.graphwar = graphwar; |
| 78 | |
| 79 | this.setLayout(null); |
| 80 | this.setBounds(0,0,Constants.WIDTH,Constants.HEIGHT); |
| 81 | |
| 82 | BufferedReader read = new BufferedReader(new InputStreamReader(graphwar.getClass().getResourceAsStream(confFile))); |
| 83 | |
| 84 | // Stack used to add components in reverse order, because swing draws components added first first |
| 85 | // and that is not intuitive to the way the data is read from the files |
| 86 | Stack<Component> components = new Stack<Component>(); |
| 87 | |
| 88 | ///// Main Screen ///////////// |
| 89 | |
| 90 | int numBackgroundImages = Integer.parseInt(GraphUtil.nextLine(read)); |
| 91 | backgroundImages = new JLabel[numBackgroundImages]; |
| 92 | |
| 93 | for(int i=0; i<numBackgroundImages; i++) |
| 94 | { |
| 95 | backgroundImages[i] = GraphUtil.makeBackgroundImage(graphwar, read); |
| 96 | components.push(backgroundImages[i]); |
| 97 | } |
| 98 |
nothing calls this directly
no outgoing calls
no test coverage detected