Creates the status bar. @param rtext The parent application. @param defaultMessage The default status message for this status bar. @param showRowColumn If true, the row/column of the caret are displayed. @param newRow The initial value of the row that is displayed. @param newColumn The initial valu
(RText rtext, String defaultMessage, boolean showRowColumn, int newRow, int newColumn, boolean overwriteModeEnabled)
| 87 | * indicator ("OVR") is enabled. |
| 88 | */ |
| 89 | public StatusBar(RText rtext, String defaultMessage, boolean showRowColumn, |
| 90 | int newRow, int newColumn, boolean overwriteModeEnabled) { |
| 91 | |
| 92 | super(defaultMessage); |
| 93 | this.rtext = rtext; |
| 94 | |
| 95 | ResourceBundle msg= ResourceBundle.getBundle(StatusBar.class.getName()); |
| 96 | |
| 97 | // Initialize private variables. |
| 98 | fileSaveSuccessfulText = msg.getString("FileSaveSuccessful"); |
| 99 | openedFileText = msg.getString("OpenedFile"); |
| 100 | selectionLengthText = msg.getString("SelectionLength"); |
| 101 | selectionLengthAndLineBreakCountText = |
| 102 | msg.getString("SelectionLengthWithLineBreakCount"); |
| 103 | selectionLengthAndLineBreakCountPluralText = |
| 104 | msg.getString("SelectionLengthWithLineBreakCountPlural"); |
| 105 | initRowColumnTextStuff(msg); |
| 106 | row = newRow; |
| 107 | column = newColumn; // DON'T call setRowAndColumn() yet! |
| 108 | rowAndColumnIndicator = new JLabel(); |
| 109 | rowColumnIndicatorVisible = !showRowColumn; // So next line works. |
| 110 | setRowColumnIndicatorVisible(showRowColumn); |
| 111 | readOnlyIndicator = createLabel(msg, "ReadOnlyIndicator"); |
| 112 | capsLockIndicator = createLabel(msg, "CapsLockIndicator"); |
| 113 | overwriteModeIndicator = createLabel(msg, "OverwriteModeIndicator"); |
| 114 | overwriteModeIndicator = createLabel(msg, "OverwriteModeIndicator"); |
| 115 | selectionLengthIndicator = new JLabel(); |
| 116 | |
| 117 | // Make the layout such that different items can be different sizes. |
| 118 | GridBagConstraints c = new GridBagConstraints(); |
| 119 | c.fill = GridBagConstraints.BOTH; |
| 120 | |
| 121 | // Create a label showing the selection length |
| 122 | c.weightx = 0; |
| 123 | selectionLengthPanel = new StatusBarPanel(new BorderLayout(), |
| 124 | selectionLengthIndicator); |
| 125 | addStatusBarComponent(selectionLengthPanel, c); |
| 126 | |
| 127 | // Create a Read Only indicator. |
| 128 | c.weightx = 0.0; |
| 129 | readOnlyPanel = new StatusBarPanel(new BorderLayout(), |
| 130 | readOnlyIndicator); |
| 131 | readOnlyIndicator.setEnabled(false); |
| 132 | addStatusBarComponent(readOnlyPanel, c); |
| 133 | |
| 134 | // Create a Caps lock indicator. |
| 135 | c.weightx = 0.0; |
| 136 | capsLockPanel = new StatusBarPanel(new BorderLayout(), |
| 137 | capsLockIndicator); |
| 138 | // On Mac OS X at least, the OS doesn't support getLockingKeyState(). |
| 139 | try { |
| 140 | capsLockIndicator.setEnabled(Toolkit.getDefaultToolkit(). |
| 141 | getLockingKeyState(KeyEvent.VK_CAPS_LOCK)); |
| 142 | } catch (UnsupportedOperationException e) { |
| 143 | capsLockIndicator.setText("-"); |
| 144 | setCapsLockIndicatorEnabled(false); |
| 145 | } |
| 146 | addStatusBarComponent(capsLockPanel, c); |
nothing calls this directly
no test coverage detected