Package jmri.util.swing
package jmri.util.swing
Tools and utilities for doing a systematic reworking of the JMRI GUI.
The goal is to allow various GUI types to be available. Subpackages provide key implementation pieces:
jmri.util.swing.sdi- The traditional JMRI "single-document interface", where there are multiple independent windows
jmri.util.swing.mdi- A "multi-document interface", where a primary window contains multiple independent sub-windows
jmri.util.swing.multipane- A "multi-pane" or IDE-style interface", where each window is tiled with inter-related panes
WindowInterface reference handles the type-specific aspects.
JMRI Swing Usage Structure
JMRI GUI code starts asJmriPanel classes, which extends the Swing JPanel.
Managing the frames (windows) that enclose them is done automatically when they are
opened via the
JmriAbstractAction and
JmriNamedPaneAction action classes.
JmriNamedPaneAction is preferred because it defers loading of the referenced
panel class until the action is invoked, which can reduce JMRI startup time signficantly.
Generic creation of menus, toolbars and navigation trees from XML definition
files are provided by the
JMenuUtil, JToolBarUtil,
JTreeUtil classes
Related Documentation
For overviews, tutorials, examples, guides, and tool documentation, please see:- The JMRI Swing usage page.
- Wikipedia discussion of MDI and IDE interfaces.
- Since:
- 2.9.4
-
ClassDescriptionBeanSelectCreatePanel<E extends NamedBean>BeanSelectPanel<E extends NamedBean>Create a JPanel containing a NamedBeanComboBox.Creates a simple "indeterminate" busy spinner dialog...Abstract Color Chooser extension that presents the JMRI preset colors in as a Radio Button list with proper internationalization.Abstract Color Chooser extension that presents a swatch sample of the color and a button to set the color.Popup menu for displaying recently selected colors along with standard java colors.Abstract Color Chooser extension that presents the JMRI preset colors in a Combo Box with proper internationalization.Set ToolTips for ComboBox items Steve Young (c) 2019Creates a simple counting progress bar.Facial subclass for
DefaultMutableTreeNodeto limit linkage for i.e.Common utility to draw colored rectangular Image.Wraps an Exception and allows extra contextual information to be added, such as what was happening at the time of the Exception, and a hint as to what the user might do to correct the problem.Static methods to display an Exception Dialog.This utility class provides methods that initialise and return a JComboBox containing a specific sub-set of fonts installed on a users system.Common utility methods for working with GUI itemsCommon utility to draw a BufferedImage as background behind a JPanel.JCBHandle<T>Wrap an object for easier null handling in a JComboBox.A JCheckBox Tree adds checkboxes to each node of the tree.JCheckBoxTreeCellRenderer implements a TreeCellRenderer for JCheckBoxTreeCommon utility methods for working with JComboBoxes.JDialogListener can be used to link JDialog instances with Frames.A simple WindowInterface for a JFrame.Common utility methods for working with JMenus.Abstract base for actions that will work with multiple JMRI GUIs.Display the Java color chooser that includes a custom JMRI panel.Create a custom color chooser panel.JmriJOptionPane provides a set of static methods to display Dialogs and retrieve user input.Replacement for MouseAdaptor.Adaptor for MouseEvent.Replacement forMouseListener.Replacement forMouseMotionListener.Action that, when invoked, creates a JmriPanel from its class name and installs it in a given window.JPanel extension to handle automatic creation of window title and help reference.Utility class providing common methods for working withJSpinnercomponents in Swing.Common utility methods for working with JToolBars.Common utility methods for working with JTrees.Renderer to display multiple lines in a JTable cellClass representing a JPanel that can contain and display N items in a WrapLayout.A JTextField where the Insert key switches operation to and from overwrite mode.From an early Java example, later at http://www.oracle.com/technetwork/java/reftf-138955.html# Example: new JFormattedTextField(new jmri.util.swing.RegexFormatter("[A-Za-z]\\d*"));A class extending JPanels to have a image display in a panel, supports drag'n drop of image file can resize container can scale content to size respect aspect ratio by default (when resizing content) (overrides paintComponent for performances)JPanel extension to handle the Scrollable interface so it can behave well in a vertical JScrollPaneProvides a standard "search bar" for addition to other panels.Abstract Color Chooser extension that presents a split button to set the color.Status Bar A little status bar widget that can be put at the bottom of a panel.Default swing behaviour is to close a JCheckBoxMenuItem when clicked.UI for StayOpenCheckBoxItem or JCheckBoxMenuItem.Create a new TextAreaFIFO, an extended JTextArea Keeps message log windows to a reasonable length Scrolls down to last line of textarea by default Originally based on https://community.oracle.com/thread/1373400 Modified for JMRI by Steve Young (c) 2018Text by extension file filter.JPanel containing Extension of JCheckBox allowing a partial state to be displayed.Enum of TriStateJCheckBox state values.Extends ExceptionContext class for exceptions that are not expected, and therefore have no suggestions for the user.Extends JTextField to provide a data validation function and a colorization function.Utilities for displaying Validation Messages.Allows a JLabel to be displayed vertically, with a defined orientation.Interface for an object that can arrange for aJmriPanelto be displayed.Suggested location for subsequent panelsFlowLayout subclass that fully supports wrapping of components.Taken from http://www.stephenkelvin.de/XTableColumnModel/XTableColumnModelextends the DefaultTableColumnModel .