(Container mainPane)
| 258 | } |
| 259 | |
| 260 | protected void onCreateWindow(Container mainPane) { |
| 261 | mainPane.setLayout(new BorderLayout()); |
| 262 | |
| 263 | GraphPanel graphPanel = new GraphPanel(); |
| 264 | |
| 265 | mainPane.add(graphPanel, BorderLayout.CENTER); |
| 266 | |
| 267 | JPanel pane = new JPanel(); |
| 268 | pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS)); |
| 269 | pane.setBorder(new EmptyBorder(4, 4, 4, 4)); |
| 270 | |
| 271 | serialRates = new JComboBox<>(); |
| 272 | for (String serialRateString : serialRateStrings) serialRates.addItem(serialRateString + " " + tr("baud")); |
| 273 | |
| 274 | serialRates.setMaximumSize(serialRates.getMinimumSize()); |
| 275 | |
| 276 | pane.add(Box.createHorizontalGlue()); |
| 277 | pane.add(Box.createRigidArea(new Dimension(8, 0))); |
| 278 | pane.add(serialRates); |
| 279 | |
| 280 | mainPane.add(pane, BorderLayout.SOUTH); |
| 281 | |
| 282 | textField = new JTextField(40); |
| 283 | // textField is selected every time the window is focused |
| 284 | addWindowFocusListener(new WindowAdapter() { |
| 285 | @Override |
| 286 | public void windowGainedFocus(WindowEvent e) { |
| 287 | textField.requestFocusInWindow(); |
| 288 | } |
| 289 | }); |
| 290 | |
| 291 | // Add cut/copy/paste contextual menu to the text input field. |
| 292 | JPopupMenu menu = new JPopupMenu(); |
| 293 | |
| 294 | Action cut = new DefaultEditorKit.CutAction(); |
| 295 | cut.putValue(Action.NAME, tr("Cut")); |
| 296 | menu.add(cut); |
| 297 | |
| 298 | Action copy = new DefaultEditorKit.CopyAction(); |
| 299 | copy.putValue(Action.NAME, tr("Copy")); |
| 300 | menu.add(copy); |
| 301 | |
| 302 | Action paste = new DefaultEditorKit.PasteAction(); |
| 303 | paste.putValue(Action.NAME, tr("Paste")); |
| 304 | menu.add(paste); |
| 305 | |
| 306 | textField.setComponentPopupMenu(menu); |
| 307 | |
| 308 | sendButton = new JButton(tr("Send")); |
| 309 | |
| 310 | JPanel lowerPane = new JPanel(); |
| 311 | lowerPane.setLayout(new BoxLayout(lowerPane, BoxLayout.X_AXIS)); |
| 312 | lowerPane.setBorder(new EmptyBorder(4, 4, 4, 4)); |
| 313 | |
| 314 | noLineEndingAlert = new JLabel(I18n.format(tr("You've pressed {0} but nothing was sent. Should you select a line ending?"), tr("Send"))); |
| 315 | noLineEndingAlert.setToolTipText(noLineEndingAlert.getText()); |
| 316 | noLineEndingAlert.setForeground(pane.getBackground()); |
| 317 | Dimension minimumSize = new Dimension(noLineEndingAlert.getMinimumSize()); |
nothing calls this directly
no test coverage detected