001package jmri.jmrit.operations.setup;
002
003import java.awt.Frame;
004import java.awt.event.ActionEvent;
005
006import javax.swing.AbstractAction;
007
008/**
009 * Swing action to load the options frame.
010 *
011 * @author Bob Jacobsen Copyright (C) 2001
012 * @author Daniel Boudreau Copyright (C) 2010
013 */
014public class OptionAction extends AbstractAction {
015
016    public OptionAction() {
017        super(Bundle.getMessage("TitleOptions"));
018    }
019
020    OptionFrame f = null;
021
022    @Override
023    public void actionPerformed(ActionEvent e) {
024        if (f == null || !f.isVisible()) {
025            f = new OptionFrame();
026            f.initComponents();
027        }
028        f.setExtendedState(Frame.NORMAL);
029        f.setVisible(true); // this also brings the frame into focus
030    }
031}
032
033