(MouseEvent e, boolean pressed)
| 205 | |
| 206 | |
| 207 | void updateMouse(MouseEvent e, boolean pressed) { |
| 208 | mouseState = NONE; |
| 209 | shiftDown = false; |
| 210 | |
| 211 | if (e != null) { |
| 212 | int mouseX = e.getX(); |
| 213 | shiftDown = e.isShiftDown(); |
| 214 | |
| 215 | if (mouseX > sizeW - buttonEach && mouseX < sizeW) { |
| 216 | mouseState = pressed ? COLLAPSE_PRESSED : COLLAPSE_ROLLOVER; |
| 217 | |
| 218 | } else if (message != null && !message.isEmpty()) { |
| 219 | if (sizeW - 2 * buttonEach < mouseX) { |
| 220 | mouseState = pressed ? CLIPBOARD_PRESSED : CLIPBOARD_ROLLOVER; |
| 221 | |
| 222 | } else if (url != null && mouseX > LEFT_MARGIN && mouseX < messageRight) { |
| 223 | mouseState = pressed ? URL_PRESSED : URL_ROLLOVER; |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | // only change on the rollover, no need to update on press |
| 229 | switch (mouseState) { |
| 230 | case CLIPBOARD_ROLLOVER: |
| 231 | case URL_ROLLOVER: |
| 232 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
| 233 | break; |
| 234 | case COLLAPSE_ROLLOVER: |
| 235 | setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
| 236 | break; |
| 237 | case NONE: |
| 238 | setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); |
| 239 | break; |
| 240 | } |
| 241 | repaint(); |
| 242 | } |
| 243 | |
| 244 | |
| 245 | static String findURL(String message) { |
no test coverage detected