/** * Override the base class method to catch any events. * * @param e The action event. */ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); try { if (cmd.equals(CMD_BARBSIZE)) { setFlowScale(GuiUtils.getBoxValue((JComboBox) e.getSource())); } else if (cmd.equals(CMD_INTERVAL)) { setVerticalInterval(GuiUtils.getBoxValue((JComboBox) e.getSource())); } else { super.actionPerformed(e); } } catch (NumberFormatException nfe) { userErrorMessage("Incorrect number format"); } }
/** * Make the control widgets * * @param controlWidgets list of control widgets * @throws RemoteException Java RMI error * @throws VisADException VisAD Error */ public void getControlWidgets(List controlWidgets) throws VisADException, RemoteException { super.getControlWidgets(controlWidgets); JComponent barbSizeBox = GuiUtils.wrap( GuiUtils.createValueBox( this, CMD_BARBSIZE, (int) flowScaleValue, Misc.createIntervalList(1, 10, 1), true)); // make possible another component(s) to put on same line w barbSizeBox JComponent extra = doMakeExtraComponent(); JComponent rightPanel = GuiUtils.leftCenter( ((extra != null) ? (JComponent) GuiUtils.hflow(Misc.newList(barbSizeBox, extra)) : (JComponent) barbSizeBox), GuiUtils.filler()); controlWidgets.add(new WrapperWidget(this, GuiUtils.rLabel("Windbarb size: "), rightPanel)); }
/** Method called after initialization. */ public void initDone() { super.initDone(); setFlowScale(flowScaleValue); setVerticalInterval(verticalIntervalValue); }