ImageIcon snapshotIcon = new ImageIcon(url);
url = PropUtils.getResourceOrFileOrURL(this, totalScenarioIconName);
ImageIcon totalScenarioIcon = new ImageIcon(url);
timeWrapToggle = new JToggleButton(totalScenarioIcon, timeWrap);
timeWrapToggle.setSelectedIcon(snapshotIcon);
timeWrapToggle.setActionCommand(SCENARIO_MODE_CMD);
timeWrapToggle.addActionListener(this);
timeWrapToggle.setToolTipText("Wrap Scenario Time Scale");
// jtb.add(timeWrapToggle);
innerBox.add(timeWrapToggle);
} catch (MalformedURLException murle) {
Debug.error("ScenarioGraphicLoader " + getName() + ":"
+ murle.getMessage());
} catch (NullPointerException npe) {
Debug.error("ScenarioGraphicLoader " + getName() + ":"
+ npe.getMessage());
}
timerControl = new TimerControlButtonPanel(this);
// jtb.add(timerControl);
innerBox.add(timerControl);
rightBox.add(innerBox);
pcs.addPropertyChangeListener(TIMER_RUNNING_STATUS, timerControl);
String runningStatus = timer.isRunning() ? (getClockDirection() > 0 ? TIMER_FORWARD
: TIMER_BACKWARD)
: TIMER_STOPPED;
pcs.firePropertyChange(TIMER_RUNNING_STATUS, null, runningStatus);
timerRateControl = new TimerRateComboBox(this);
timerRateControl.setToolTipText("Change clock rate for Scenario");
Iterator it = timerRates.iterator();
while (it.hasNext()) {
TimerRateHolder trh = (TimerRateHolder) it.next();
timerRateControl.add(trh.label, trh.clock, trh.pace);
}
int si = timerRates.size() / 2;
if (si > 0) {
timerRateControl.setSelectedIndex(si);
}
// jtb.add(timerRateControl);
rightBox.add(timerRateControl);
timeSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 0);
timeSliderSupport = new TimeSliderSupport(timeSlider, this, startTime, endTime);
// jtb.add(timeSlider);
leftBox.add(timeSlider);
timeLabel = new JLabel(" ", SwingConstants.CENTER);
java.awt.Font defaultFont = timeLabel.getFont();
timeLabel.setFont(new java.awt.Font(defaultFont.getName(), defaultFont.getStyle(), 10));
// jtb.add(timeLabel);
leftBox.add(timeLabel);
URL url = ScenarioGraphicLoader.class.getResource("path.png");
ImageIcon icon = new ImageIcon(url);
JToggleButton modeButton = new JToggleButton(icon, mode == TOTAL_SCENARIO_MODE);
modeButton.setToolTipText((mode == TOTAL_SCENARIO_MODE ? "Hide"
: "Show")
+ " scenario paths on " + getName());
modeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JToggleButton jtb = (JToggleButton) ae.getSource();
boolean sel = jtb.isSelected();
setMode((sel ? TOTAL_SCENARIO_MODE : SNAPSHOT_SCENARIO_MODE));
jtb.setToolTipText((sel ? "Hide" : "Show")
+ " scenario paths on " + getName());
manageGraphics();
}
});
bigBox.add(modeButton);
bigBox.add(leftBox);
bigBox.add(rightBox);
jtb.add(bigBox);
return jtb;
}