private void updateLoadNames() { log.debug("Update load names"); panelLoads.removeAll(); if (_track != null) { // set radio button loadNameAll.setSelected(_track.getLoadOption().equals(Track.ALL_LOADS)); loadNameInclude.setSelected(_track.getLoadOption().equals(Track.INCLUDE_LOADS)); loadNameExclude.setSelected(_track.getLoadOption().equals(Track.EXCLUDE_LOADS)); pLoadControls.setVisible(!loadNameAll.isSelected()); if (!loadNameAll.isSelected()) { int x = 0; int y = 0; // vertical position in panel int numberOfLoads = getNumberOfCheckboxesPerLine() / 2 + 1; for (String loadName : _track.getLoadNames()) { JLabel load = new JLabel(); load.setText(loadName); addItemTop(panelLoads, load, x++, y); // limit the number of loads per line if (x > numberOfLoads) { y++; x = 0; } } revalidate(); } } else { loadNameAll.setSelected(true); } panelLoads.repaint(); panelLoads.revalidate(); }
private void checkForErrors() { if (_track.getLoadOption().equals(Track.INCLUDE_LOADS) && _track.getLoadNames().length == 0 || _track.getShipLoadOption().equals(Track.INCLUDE_LOADS) && _track.getShipLoadNames().length == 0) { JOptionPane.showMessageDialog( this, Bundle.getMessage("ErrorNeedLoads"), Bundle.getMessage("ErrorNoLoads"), JOptionPane.ERROR_MESSAGE); } }