class ChapGUI
extends javax.swing.JFrame
The GUI was created with, and is maintained by, the Eclipse WindowBuilder. All methods and data are declared static because it only makes sense to have one main GUI per application, and making them static avoids the problem of having to pass a reference to the GUI instance in other classes that need to reference the main GUI.
Copyright (c) 2018
Note that the Eclipse Window Builder has trouble with complex, dynamic GUIs so that
one should first build the GUI, then modify the code by hand to use
the definitions in ASTUtils.ASTStyle. The Window Builder start/stop hiding tags can be used to
surround code that the Window Builder parser has trouble handling.
The start hiding tag is //$hide>>$
while the stop
hiding tag is //$hide<<$
. For example,
//$hide>>$
code to be hidden
//$hide<<$
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Modifier | Constructor and Description |
---|---|
protected |
ChapGUI()
Create the GUI frame.
|
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
getAboutCommand()
Gets the command that represents the About menu item.
|
protected static java.lang.String |
getConvertCommand()
Gets the command that represents the Convert button.
|
protected static java.lang.String |
getConvMenuCommand()
Gets the command that represents a Conversions menu item.
|
protected static ChapMenuItems.ConversionType |
getConvType()
Gets the type of conversion to be performed (cross-multiply, HMS/DMS, deg C/F).
|
protected static java.lang.String |
getExitCommand()
Gets the command that represents the Exit menu item.
|
protected static double |
getFromDenom()
Gets the "from" denominator for a cross multiplication.
|
protected static java.lang.String |
getFromFormat()
Gets the "from" format for displaying results.
|
protected static java.lang.String |
getFromUnits()
Gets the "from" units.
|
protected static java.lang.String |
getInstructionsCommand()
Gets the command that represents the Instructions menu item.
|
protected static java.awt.event.ActionListener |
getMenuListener()
Gets the listener for the menu items
|
protected static jll.celcalc.ASTUtils.ASTPrt |
getPrtInstance()
Gets the ASTPrt instance for this application's scrollable text pane area.
|
protected static java.lang.String |
getResults()
Gets the results label value from the GUI.
|
protected static java.lang.String |
getSwapCommand()
Gets the command that represents the Swap Units button
|
protected static javax.swing.JTextPane |
getTextPane()
Gets the scrollable text pane area for this GUI.
|
protected static double |
getToDenom()
Gets the "to" denominator for a cross multiplication.
|
protected static java.lang.String |
getToFormat()
Gets the "to" format for displaying results.
|
protected static java.lang.String |
getToUnits()
Gets the "to" units.
|
protected static java.lang.String |
getUserInput()
Gets the data that the user entered in the GUI.
|
protected static void |
printlnCond()
Routines to handle sending output text to the scrollable
output area.
|
protected static void |
printlnCond(java.lang.String txt)
Routines to handle sending output text to the scrollable
output area.
|
protected static void |
printlnCond(java.lang.String txt,
boolean centerTxt)
Routines to handle sending output text to the scrollable
output area.
|
protected static void |
saveFromToValues(java.lang.String FromUnits,
double FromDenom,
java.lang.String FromFormat,
java.lang.String ToUnits,
double ToDenom,
java.lang.String ToFormat,
ChapMenuItems.ConversionType ConvType)
Saves the various from/to conversion related items in the appropriate GUI variables.
|
protected static void |
setResults(java.lang.String results)
Sets the results label in the GUI.
|
protected static void |
showAboutBox()
Shows the About Box.
|
protected static void |
swapUnits()
Swaps the conversion related information and clears the results label in the GUI.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected static java.awt.event.ActionListener getMenuListener()
protected static jll.celcalc.ASTUtils.ASTPrt getPrtInstance()
protected static javax.swing.JTextPane getTextPane()
protected static void saveFromToValues(java.lang.String FromUnits, double FromDenom, java.lang.String FromFormat, java.lang.String ToUnits, double ToDenom, java.lang.String ToFormat, ChapMenuItems.ConversionType ConvType)
FromUnits
- units to convert fromFromDenom
- the 'from' denominator for cross-multiplyingFromFormat
- the format to use when displaying the "from" valueToUnits
- units to convert toToDenom
- the "to" denominator for cross-multiplyingToFormat
- the format to use when displaying the "to" valueConvType
- the type of conversion required (e.g., cross-multiply)protected static void swapUnits()
protected static ChapMenuItems.ConversionType getConvType()
protected static double getFromDenom()
protected static java.lang.String getFromFormat()
protected static java.lang.String getFromUnits()
protected static java.lang.String getResults()
protected static double getToDenom()
protected static java.lang.String getToFormat()
protected static java.lang.String getToUnits()
protected static java.lang.String getUserInput()
It is up to the calling routine to perform any error checking.
protected static void setResults(java.lang.String results)
results
- the conversion results to be displayed in the GUIprotected static java.lang.String getConvertCommand()
protected static java.lang.String getSwapCommand()
protected static java.lang.String getConvMenuCommand()
protected static java.lang.String getExitCommand()
protected static java.lang.String getInstructionsCommand()
protected static java.lang.String getAboutCommand()
protected static void showAboutBox()
protected static void printlnCond()
protected static void printlnCond(java.lang.String txt)
txt
- string to be printedprotected static void printlnCond(java.lang.String txt, boolean centerTxt)
txt
- string to be printedcenterTxt
- true if the text is to be centered