use of javax.swing.JMenuBar in project JMRI by JMRI.
the class ConfigBaseStationFrame method addHelpMenu.
/**
* Add a standard help menu, including window specific help item.
*
* @param ref JHelp reference for the desired window-specific help page
* @param direct true if the help menu goes directly to the help system,
* e.g. there are no items in the help menu
*
* WARNING: BORROWED FROM JmriJFrame.
*/
@Override
public void addHelpMenu(String ref, boolean direct) {
// only works if no menu present?
JMenuBar bar = getJMenuBar();
if (bar == null) {
bar = new JMenuBar();
}
// add Window menu
// * GT 28-AUG-2008 Added window menu
bar.add(new WindowMenu(this));
// add Help menu
jmri.util.HelpUtil.helpMenu(bar, ref, direct);
setJMenuBar(bar);
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class ConfigBaseStationFrame method buildMenu.
private void buildMenu() {
JMenu fileMenu = new JMenu(Bundle.getMessage("MenuFile"));
//fileMenu.add(new LoadVSDFileAction(Bundle.getMessage("MenuItemLoadVSDFile")));
//fileMenu.add(new StoreXmlVSDecoderAction(Bundle.getMessage("MenuItemSaveProfile")));
//fileMenu.add(new LoadXmlVSDecoderAction(Bundle.getMessage("MenuItemLoadProfile")));
JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
//editMenu.add(new VSDPreferencesAction(Bundle.getMessage("MenuItemEditPreferences")));
//fileMenu.getItem(1).setEnabled(false); // disable XML store
//fileMenu.getItem(2).setEnabled(false); // disable XML load
menuList = new ArrayList<JMenu>(3);
menuList.add(fileMenu);
menuList.add(editMenu);
this.setJMenuBar(new JMenuBar());
this.getJMenuBar().add(fileMenu);
this.getJMenuBar().add(editMenu);
//this.addHelpMenu("package.jmri.jmrit.vsdecoder.swing.ManageLocationsFrame", true); // NOI18N
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class DebuggerFrame method initComponents.
@Override
public void initComponents() {
nf = java.text.NumberFormat.getInstance();
nf.setMinimumFractionDigits(1);
nf.setMaximumFractionDigits(1);
nf.setGroupingUsed(false);
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
// add panes in the middle
JPanel p, p1;
// Time inputs
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
p.add(new JLabel("Time measurements: "));
timep.initComponents();
JScrollPane sc = new JScrollPane(timep);
p.add(sc);
// add id field at bottom
JPanel p5 = new JPanel();
p5.setLayout(new FlowLayout());
p5.add(new JLabel("Id: "));
p5.add(id);
p.add(p5);
getContentPane().add(p);
getContentPane().add(new JSeparator());
// x, y, z results
p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
p.add(new JLabel("Results:"));
p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JLabel("X:"));
p1.add(x);
p.add(p1);
p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JLabel("Y:"));
p1.add(y);
p.add(p1);
p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JLabel("Z:"));
p1.add(z);
p.add(p1);
p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JLabel("Code:"));
p1.add(code);
p.add(p1);
getContentPane().add(p);
getContentPane().add(new JSeparator());
// add controls at bottom
p = new JPanel();
mode = new JComboBox<String>(new String[] { "From time fields", "from X,Y,Z fields", "from time file", "from X,Y,Z file" });
p.add(mode);
p.setLayout(new FlowLayout());
doButton = new JButton("Do Once");
doButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
doOnce();
}
});
p.add(doButton);
getContentPane().add(p);
// start working
Distributor.instance().addReadingListener(this);
Distributor.instance().addMeasurementListener(this);
// add file menu
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
menuBar.add(fileMenu);
fileMenu.add(new jmri.jmrix.rps.swing.CsvExportAction("Export Readings as CSV..."));
fileMenu.add(new jmri.jmrix.rps.swing.CsvExportMeasurementAction("Export Measurements as CSV..."));
setJMenuBar(menuBar);
// add help
addHelpMenu("package.jmri.jmrix.rps.swing.debugger.DebuggerFrame", true);
// prepare for display
pack();
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class ItemPalette method makeMenus.
private void makeMenus(Editor editor) {
if (!jmri.util.ThreadingUtil.isGUIThread())
log.error("Not on GUI thread", new Exception("traceback"));
JMenuBar menuBar = new JMenuBar();
JMenu findIcon = new JMenu(Bundle.getMessage("findIconMenu"));
menuBar.add(findIcon);
JMenuItem editItem = new JMenuItem(Bundle.getMessage("editIndexMenu"));
editItem.addActionListener(new ActionListener() {
Editor editor;
@Override
public void actionPerformed(ActionEvent e) {
ImageIndexEditor ii = ImageIndexEditor.instance(editor);
ii.pack();
ii.setVisible(true);
}
ActionListener init(Editor ed) {
editor = ed;
return this;
}
}.init(editor));
findIcon.add(editItem);
findIcon.addSeparator();
JMenuItem openItem = new JMenuItem(Bundle.getMessage("openDirMenu"));
openItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DirectorySearcher.instance().openDirectory();
}
});
findIcon.add(openItem);
JMenuItem searchItem = new JMenuItem(Bundle.getMessage("searchFSMenu"));
searchItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jmri.jmrit.catalog.DirectorySearcher.instance().searchFS();
}
});
findIcon.add(searchItem);
setJMenuBar(menuBar);
addHelpMenu("package.jmri.jmrit.display.ItemPalette", true);
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class WarrantFrame method makeMenus.
private void makeMenus() {
setTitle(Bundle.getMessage("TitleWarrant", _warrant.getDisplayName()));
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu(Bundle.getMessage("MenuFile"));
fileMenu.add(new jmri.configurexml.SaveMenu());
menuBar.add(fileMenu);
setJMenuBar(menuBar);
addHelpMenu("package.jmri.jmrit.logix.CreateEditWarrant", true);
}
Aggregations