001package jmri.jmrit.sample.swing; 002 003 004import javax.swing.*; 005 006 007/** 008 * Sample config pane; all it does is show a label. 009 * <p> 010 * This works with the Start Up pane in Preferences 011 * to add this "Open Sample Pane" via Perform action and 012 * Add button to main window options. 013 * 014 * @author Bob Jacobsen Copyright 2018 015 * @since 4.13.4 016 */ 017public class SampleConfigPane extends jmri.util.swing.JmriPanel { 018 019 /** 020 * Provide a recommended title for an enclosing frame. 021 */ 022 @Override 023 public String getTitle() { 024 return "Sample Pane"; // for I18N, use e.g. Bundle.getMessage("MenuItemSample"); 025 } 026 027 /** 028 * Provide menu items 029 */ 030 //@Override 031 //public List<JMenu> getMenus() { return null; } 032 033 public SampleConfigPane() { 034 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); 035 } 036 037 /** 038 * 2nd stage of initialization, invoked after the constructor is complete. 039 */ 040 @Override 041 public void initComponents() { 042 JLabel label = new JLabel("Some GUI elements ..."); 043 this.add(label); 044 } 045 046 /** 047 * 3rd stage of initialization, invoked after Swing components exist. 048 */ 049 @Override 050 public void initContext(Object context) { 051 } 052 053 /** {@inheritDoc} */ 054 @Override 055 public void dispose() { 056 } 057 058 /** 059 * Nested class to create one of these using old-style defaults. 060 */ 061 static public class Default extends jmri.util.swing.JmriNamedPaneAction { 062 063 public Default() { 064 super("Open Sample Pane", // eventually Bundle.getMessage("MenuItemSampleConfig"), for I18N 065 new jmri.util.swing.sdi.JmriJFrameInterface(), 066 SampleConfigPane.class.getName()); 067 } 068 } 069}