(Editor eddie)
| 145 | } |
| 146 | |
| 147 | public EditorHeader(Editor eddie) { |
| 148 | this.editor = eddie; // weird name for listener |
| 149 | |
| 150 | if (pieces == null) { |
| 151 | pieces = new Image[STATUS.length][WHERE.length]; |
| 152 | menuButtons = new Image[STATUS.length]; |
| 153 | for (int i = 0; i < STATUS.length; i++) { |
| 154 | for (int j = 0; j < WHERE.length; j++) { |
| 155 | String path = "tab-" + STATUS[i] + "-" + WHERE[j]; |
| 156 | pieces[i][j] = Theme.getThemeImage(path, this, PIECE_WIDTH, |
| 157 | PIECE_HEIGHT); |
| 158 | } |
| 159 | String path = "tab-" + STATUS[i] + "-menu"; |
| 160 | menuButtons[i] = Theme.getThemeImage(path, this, PIECE_HEIGHT, |
| 161 | PIECE_HEIGHT); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | if (backgroundColor == null) { |
| 166 | backgroundColor = |
| 167 | Theme.getColor("header.bgcolor"); |
| 168 | textColor[SELECTED] = |
| 169 | Theme.getColor("header.text.selected.color"); |
| 170 | textColor[UNSELECTED] = |
| 171 | Theme.getColor("header.text.unselected.color"); |
| 172 | } |
| 173 | |
| 174 | addMouseListener(new MouseAdapter() { |
| 175 | public void mousePressed(MouseEvent e) { |
| 176 | int x = e.getX(); |
| 177 | int y = e.getY(); |
| 178 | |
| 179 | if ((x > menuLeft) && (x < menuRight)) { |
| 180 | popup.show(EditorHeader.this, x, y); |
| 181 | |
| 182 | } else { |
| 183 | int numTabs = editor.getTabs().size(); |
| 184 | for (int i = 0; i < numTabs; i++) { |
| 185 | if ((x > tabLeft[i]) && (x < tabRight[i])) { |
| 186 | editor.selectTab(i); |
| 187 | repaint(); |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | }); |
| 193 | } |
| 194 | |
| 195 | |
| 196 | public void paintComponent(Graphics screen) { |
nothing calls this directly
no test coverage detected