use of jmri.jmrit.operations.trains.tools.ShowCarsInTrainAction in project JMRI by JMRI.
the class TrainConductorFrame method initComponents.
private void initComponents(Train train) {
super.initComponents();
if (train != null) {
setTitle(Bundle.getMessage("TitleTrainConductor") + " (" + train.getName() + ")");
}
// build menu
JMenuBar menuBar = new JMenuBar();
if (train != null) {
JMenu toolMenu = new JMenu(Bundle.getMessage("MenuTools"));
toolMenu.add(new ShowCarsInTrainAction(Bundle.getMessage("MenuItemShowCarsInTrain"), train));
menuBar.add(toolMenu);
}
setJMenuBar(menuBar);
// NOI18N
addHelpMenu("package.jmri.jmrit.operations.Operations_Trains", true);
initMinimumSize(new Dimension(Control.panelWidth500, Control.panelHeight500));
}
use of jmri.jmrit.operations.trains.tools.ShowCarsInTrainAction in project JMRI by JMRI.
the class TrainIcon method showPopUp.
/**
* Pop-up only if right click and not dragged return true if a popup item is
* set
*/
@Override
public boolean showPopUp(JPopupMenu popup) {
if (_train != null) {
// first action is either "Move" or "Terminate" train
String actionText = (_train.getCurrentLocation() == _train.getTrainTerminatesRouteLocation()) ? Bundle.getMessage("Terminate") : Bundle.getMessage("Move");
popup.add(new AbstractAction(actionText) {
@Override
public void actionPerformed(ActionEvent e) {
_train.move();
}
});
popup.add(makeTrainRouteMenu());
popup.add(new TrainConductorAction(Bundle.getMessage("TitleTrainConductor"), _train));
popup.add(new ShowCarsInTrainAction(Bundle.getMessage("MenuItemShowCarsInTrain"), _train));
if (!isEditable()) {
popup.add(new AbstractAction(Bundle.getMessage("SetX&Y")) {
@Override
public void actionPerformed(ActionEvent e) {
if (!_train.setTrainIconCoordinates()) {
JOptionPane.showMessageDialog(null, Bundle.getMessage("SeeOperationsSettings"), Bundle.getMessage("SetX&YisDisabled"), JOptionPane.ERROR_MESSAGE);
}
}
});
}
}
popup.add(new ThrottleAction(Bundle.getMessage("Throttle")));
popup.add(makeLocoIconMenu());
if (!isEditable()) {
getEditor().setRemoveMenu(this, popup);
}
return true;
}
Aggregations