Package fr.formiko.views.gui2d
Class FOptionPane
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
fr.formiko.views.gui2d.FOptionPane
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
Personalised JDialog.
Used to get a save name, get a creature id, get a food quantity etc.
Used to get a save name, get a creature id, get a food quantity etc.
- Author:
- Hydrolien
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FButton
private FButton
private boolean
private FIntField
private int
private FSlider
private FTextField
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor that use main frame as owner.FOptionPane
(Frame owner) Main constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComboBox
(String[] content) Add a combo box.void
Add an editable text field.void
addIntField
(int min, int max, int value) Add an editable int field.void
Add a not OK Button.void
Add an OK Button.void
addSlider
(int min, int max, int value) Add a slider.void
addSliderAndIntField
(int min, int max, int value) Add a slider & an int field.void
Add an non-editable text field.static void
print an alerte box.void
build()
After have use all setter set visible.void
Close the FOptionPane.Return the content of the text field.int
boolean
void
Action of a not OK Button.static String
Print a question box.static boolean
questionYN
(String popUpMessage) Print a yes/no question box.static boolean
questionYN
(String popUpMessage, boolean important) Print a yes/no question box.static boolean
questionYN
(String popUpMessage, boolean important, fr.formiko.usual.CheckFunction cf) Print a yes/no question box.void
setGreyOthers
(boolean greyOthers) void
setReturnValue
(int returnValue) static int
showConfirmDialog
(Frame parentComponent, String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a yes/no question box.static void
showMessageDialog
(Frame parentComponent, Component content, String message) Print a message.Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
Methods inherited from class java.awt.Window
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, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
Methods inherited from class java.awt.Container
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
Methods inherited from class java.awt.Component
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, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
textField
-
comboBox
-
slider
-
intField
-
returnValue
private int returnValue -
bOk
-
bNotOk
-
greyOthers
private boolean greyOthers
-
-
Constructor Details
-
FOptionPane
Main constructor.- Parameters:
owner
- Frame that own this
-
FOptionPane
public FOptionPane()Constructor that use main frame as owner.
-
-
Method Details
-
build
public void build()After have use all setter set visible. -
getReturnValue
public int getReturnValue() -
setReturnValue
public void setReturnValue(int returnValue) -
isGreyOthers
public boolean isGreyOthers() -
setGreyOthers
public void setGreyOthers(boolean greyOthers) -
addOKButton
public void addOKButton()Add an OK Button.
It will set return value to 1 -
addNotOKButton
public void addNotOKButton()Add a not OK Button.
It will set return value to 0 -
onNotOkButtonPress
public void onNotOkButtonPress()Action of a not OK Button. -
disposeFOptionPane
public void disposeFOptionPane()Close the FOptionPane. -
addText
Add an non-editable text field.- Parameters:
content
- default content
-
addField
Add an editable text field.- Parameters:
content
- default content
-
addIntField
public void addIntField(int min, int max, int value) Add an editable int field.- Parameters:
min
- the min valuemax
- the max valuevalue
- default value
-
addComboBox
Add a combo box.- Parameters:
content
- content of the combo box
-
addSlider
public void addSlider(int min, int max, int value) Add a slider.- Parameters:
min
- the min valuemax
- the max valuevalue
- the curent value
-
addSliderAndIntField
public void addSliderAndIntField(int min, int max, int value) Add a slider & an int field.
The 2 are connected.- Parameters:
min
- the min valuemax
- the max valuevalue
- the curent value
-
getContent
Return the content of the text field. -
alerte
print an alerte box.- Parameters:
popUpMessage
- message of the popUp
-
question
Print a question box.- Parameters:
popUpMessage
- message of the popUp- Returns:
- user answer
-
questionYN
public static boolean questionYN(String popUpMessage, boolean important, fr.formiko.usual.CheckFunction cf) Print a yes/no question box.- Parameters:
popUpMessage
- message of the popUpimportant
- some gui action will be done if truecf
- a checkBox item that launch a function if checked- Returns:
- answer.
-
questionYN
Print a yes/no question box.- Parameters:
popUpMessage
- message of the popUpimportant
- some gui action will be done if true- Returns:
- answer.
-
questionYN
Print a yes/no question box.- Parameters:
popUpMessage
- message of the popUp- Returns:
- answer.
-
showConfirmDialog
public static int showConfirmDialog(Frame parentComponent, String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a yes/no question box.- Parameters:
parentComponent
- the owner of thismessage
- message of the popUpcf
- a checkBox item that launch a function if checked- Returns:
- answer.
-
showMessageDialog
Print a message.- Parameters:
parentComponent
- the owner of thiscontent
- content of thismessage
- message of the popUp
-