Start or end blocking. @param block should blocking be started or ended
(boolean block)
| 51 | * @param block should blocking be started or ended |
| 52 | */ |
| 53 | public void block(boolean block) { |
| 54 | if (block) { |
| 55 | if (blockCount == 0) { |
| 56 | setVisible(true); |
| 57 | |
| 58 | setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); |
| 59 | |
| 60 | FocusManager.getCurrentManager().addKeyEventDispatcher(blockKeys); |
| 61 | } |
| 62 | blockCount++; |
| 63 | } else { |
| 64 | blockCount--; |
| 65 | if (blockCount == 0) { |
| 66 | FocusManager.getCurrentManager().removeKeyEventDispatcher(blockKeys); |
| 67 | |
| 68 | setCursor(Cursor.getDefaultCursor()); |
| 69 | |
| 70 | setVisible(false); |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Test if this glasspane is blocked. |
no test coverage detected