Class PsPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Panel
-
- jv.object.PsPanel
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, PsUpdateIf
- Direct Known Subclasses:
- MyClass_IP, PdArray_IP, PdColor_IP, PdVector_IP, PgAxes_CP, PgBndPolygon_IP, PgCatenoid_CP, PgCircle_CP, PgCircleF_CP, PgCubeSet_TP, PgCurveF_CP, PgDomain_CP, PgDomainDescr_IP, PgElementSet_BP, PgElementSet_TP, PgFunction_CP, PgGenusSurface_CP, PgGraph_CP, PgGraphF_CP, PgHelicoid_CP, PgLantern_CP, PgMaxPrinciple_CP, PgParmCurve_CP, PgParmSurface_CP, PgPlotF_CP, PgPointF_CP, PgPointSet_IP, PgPointSet_LP, PgPointSet_MP, PgPointSet_VP, PgRuler_CP, PgSegmentF_CP, PgSmallCubes_CP, PgSmallTetrahedra_CP, PgSphere_CP, PgSurface_CP, PgSurfaceOfRotation_CP, PgSurfacePair_IP, PgTetraSet_TP, PgTexture_IP, PgTube_CP, PgVectorField_IP, PgWeierstrassDescr_IP, PiArray_IP, PiImageSource_IP, PiVector_IP, PjProject_IP, PjWorkshop_IP, PnBandEigenSolver_IP, PnEnergyMinimizer_IP, PnJacobi_IP, PsAnimation_IP, PsAuthorInfo_IP, PsCategoryList_IP, PsGeometryInfo_IP, PsJavaView_IP, PsJvzConfig_IP, PsPdfConfig_IP, PsTabPanel, PsToolbar, PsToolbarItem, PuBoolean_IP, PuColorBar_IP, PuColorPicker, PuComplexFunction_IP, PuDouble_IP, PuEnum_IP, PuFunction_IP, PuHistogram_IP, PuInteger_IP, PuIntervalDescr_IP, PuProgressBar_IP, PvCamera_IP, PvDisplay_IP, PvImageDisplay_IP, PvLight_IP
public class PsPanel extends java.awt.Panel implements PsUpdateIf
Default base class for info panels, and often used instead ofPanel. Implements the update mechanism and simplifies setting of layouts. Each non-gui class may have associated inspectors derived from PsPanel.Subclasses must call the
init()method in each constructor and eachinit()method must callsuper.init()at first.public class myClass extends mySuperClass public myClass() { ... if (getClass() == myClass.class) init(); } public void init() { super.init(); ... }Only this ensures that the init() method is called. Otherwise even the init() methods of the superclasses will not be called.The default font of this class is
PsConfig.FONT_TEXT.Class contains several static methods to simplify the updating of GUI widgets. These methods first check if the GUI is already in the requested state, and invoke the GUI methods only if the widget status must be changed.
- See Also:
- Serialized Form
- Author:
- Konrad Polthier
- Version:
- 28.08.18, 3.00 revised (ur) removed deprecated code to achieve Java 9 compatibility.
28.09.10, 2.91 revised (fk) Removed redundant interface Serializable as already defined by Component.
13.02.04, 2.90 revised (kp) Vertical inset size implemented to save screen space.
11.08.03, 2.80 revised (kp) New constructor provides better similarity with java.awt.Panel.
25.07.03, 2.70 revised (kp) Utility methods for changing status of widgets made public.
23.07.02, 2.50 revised (kp) Add several static methods to update widgets only if the contents has changed.
12.07.02, 2.40 revised (kp) Vector panel added.
12.11.00, 2.30 revised (kp) Drawing of background image implemented.
10.08.00, 2.02 revised (kp) Static constants _LAYOUT removed.
10.08.00, 2.01 revised (kp) Methods fillBottom(), add(Component), setLayout(LayoutManager) removed.
10.08.00, 2.00 revised (kp) No longer special handling for GridBagLayout, instance variables removed.
20.03.00, 1.20 revised (kp) Constructor changed to different instanceOf method.
23.01.99, 1.10 revised (kp) Initialization with setParent instead of update.
00.00.97, 1.00 created (kp)
-
-
Field Summary
Fields Modifier and Type Field and Description static intBORDER_GROOVEstatic intBORDER_LINEstatic intBORDER_LINETOPstatic intBORDER_NONEstatic intBORDER_SUNKstatic java.lang.StringBOUNDARYName of default boundary panel under which panel is registered in panel list.static java.lang.StringBOUNDARY_EXTFile name suffix of boundary panel class to name of base class.static java.lang.StringCONFIGName of default control panel under which panel is registered in panel list.static java.lang.StringCONFIG_EXTFile name suffix of control panel class to name of base class.static java.lang.StringINFOName of default info panel under which panel is registered in panel list.static java.lang.StringINFO_EXTIdentifier of class extension characterizing info panels.static java.lang.StringLABELName of default font panel under which panel is registered in panel list.static java.lang.StringLABEL_EXTFile name suffix of font panel class to name of base class.static java.lang.StringMATERIALName of default material panel under which panel is registered in panel list.static java.lang.StringMATERIAL_EXTFile name suffix of material panel class to name of base class.static intORIENT_GUIDEVertical handle of toolbar.static intORIENT_HORIZONTALDefault horizontal orientation of lines.static intORIENT_VERTICALVertical orientation of lines.static java.lang.StringTEXTUREName of default texture panel under which panel is registered in panel list.static java.lang.StringTEXTURE_EXTFile name suffix of texture panel class to name of base class.static java.lang.StringVECTORName of default vector panel under which panel is registered in panel list.static java.lang.StringVECTOR_EXTFile name suffix of vector panel class to name of base class.
-
Constructor Summary
Constructors Constructor and Description PsPanel()Constructor of panel withPsStackLayout(1)as default layout manager.PsPanel(java.awt.LayoutManager mgr)Constructor of panel with given layout manager.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description java.awt.PaneladdLabelComponent(java.lang.String label, java.awt.Component comp)Add a label and a component in a horizontal panel with GridLayout(1, 2).java.awt.CanvasaddLine(int size)Add a horizontal line with specified thickness as separator.java.awt.CanvasaddLine(int size, int orient)Add a horizontal line with specified thickness as separator.java.awt.LabeladdSubTitle(java.lang.String title)Add subtitle to panel in subheader font and return label.java.awt.TextFieldaddTextField(java.lang.String label, int length)Add a label and textField in a horizontal panel with GridLayout(1, 2).java.awt.LabeladdTitle(java.lang.String title)Create main title to panel in header font and add to panel.static voiddrawBorder(java.awt.Component comp, java.awt.Graphics g, int borderType)Deprecated.use static void PsPanel.drawBorder(Graphics, borderType, Rectangle);voiddrawBorder(java.awt.Graphics g, int borderType)Draw border around this panel.static voiddrawBorder(java.awt.Graphics g, int borderType, java.awt.Rectangle rectangle)Draw a rectangle into the given graphics context.static voiddrawBorder(java.awt.Graphics g, int borderType, java.awt.Rectangle rectangle, java.awt.Color color)Draw a rectangle into the given graphics context with given color.voiddrawText(java.awt.Graphics g, java.awt.Point point, java.lang.String string)Draw text at specified position.PsUpdateIfgetFather()Get the parent of this panel which receives update events.java.awt.InsetsgetInsets()OverwriteContainer.getInsets()to create a border measured in pixels around this panel.java.lang.StringgetLanguage()Deprecated.Method is no longer used to decide about recreation of panel.intgetPanelVersion()Get panel version of this panel to compare with panel version of PsConfig for decision if panel needs to be recreated.java.awt.DimensiongetPreferredSize()Get the assigned preferred size, or whatever super provides.java.awt.LabelgetTitle()Get the main title label, ornullof no title exists.java.awt.LabelgetTitle(java.lang.String title)Create a new main title label with given string and standard font.java.awt.LabelgetTitle(java.lang.String title, java.awt.Font font)Create a new main title label with given string and font.booleanhasTitle()Check whether panel has a main title label.voidinit()Provides layout and adds internal components.booleaninstanceOf(java.lang.String aClassName)Deprecated.use "if (getClass() == PsObject.class)" insteadvoidpaint(java.awt.Graphics g)Callsuper.paint(g)and draw border around panel.voidremoveTitle()Remove label of panel title from this panel.static booleanselect(java.awt.Choice widget, int index)Update the selected index of a choice if the new index is different from the current selection of the widget.voidsetBackColor(java.awt.Color col)Assigned explicit background color such that container is not transparent.voidsetBorderType(int borderType)Set border of panel which is automatically drawn.static booleansetEnabled(java.awt.Component widget, boolean bEnable)Assure that a component is enabled if requested.voidsetImage(java.awt.Image image)Image to be shown in the background of the canvas and set layout to null.voidsetInsetSize(int size)Set the global inset size.voidsetInsetSizeHorizontal(int size)Set the vertical inset size to be used at top and bottom of this panel.voidsetInsetSizeVertical(int size)Set the vertical inset size to be used at top and bottom of this panel.static booleansetLabel(java.awt.Button widget, java.lang.String text)Set the label of a button if it is different from the current label.static booleansetLabel(java.awt.Checkbox widget, java.lang.String text)Set the label of a checkbox if it is different from the current label.voidsetOutOfDate(boolean state)Mark this panel as being not synchronized with the correct data of its parent.voidsetParent(PsUpdateIf parent)Set parent of this panel which receives update events.voidsetPreferredSize(int width, int height)Assigned preferred size.static booleansetSelectedCheckbox(java.awt.CheckboxGroup widget, java.awt.Checkbox checkbox)In a checkbox group selected a checkbox if it is different from the current selection of the widget.static booleansetState(java.awt.Checkbox widget, boolean bState)Assure that a checkbox has same state than corresponding boolean flag.static booleansetText(java.awt.Label widget, java.lang.String text)Update the content of a label if the new content is different from the current content of the widget.static booleansetText(java.awt.TextComponent widget, java.lang.String text)Update the content of a text field if the new content is different from the current content of the widget.voidsetTitle(java.lang.String title)Set string of main title of panel but do not add title to panel.voidsetVisible(boolean flag)OverrideComponent.setVisible(boolean)to give panel a chance to update its content when is becomes visible.voidupdate(java.awt.Graphics g)OverrideComponent.update(Graphics)to avoid clearing the component if an image is available.booleanupdate(java.lang.Object event)Update this objects whenever parent or a child has changed, and continue update sequence.-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jv.object.PsUpdateIf
getName
-
-
-
-
Field Detail
-
BOUNDARY_EXT
public static final java.lang.String BOUNDARY_EXT
File name suffix of boundary panel class to name of base class.- See Also:
- Constant Field Values
-
BOUNDARY
public static final java.lang.String BOUNDARY
Name of default boundary panel under which panel is registered in panel list.- See Also:
- Constant Field Values
-
CONFIG_EXT
public static final java.lang.String CONFIG_EXT
File name suffix of control panel class to name of base class.- See Also:
- Constant Field Values
-
CONFIG
public static final java.lang.String CONFIG
Name of default control panel under which panel is registered in panel list.- See Also:
- Constant Field Values
-
INFO_EXT
public static final java.lang.String INFO_EXT
Identifier of class extension characterizing info panels.- See Also:
- Constant Field Values
-
INFO
public static final java.lang.String INFO
Name of default info panel under which panel is registered in panel list.- See Also:
- Constant Field Values
-
LABEL_EXT
public static final java.lang.String LABEL_EXT
File name suffix of font panel class to name of base class.- See Also:
- Constant Field Values
-
LABEL
public static final java.lang.String LABEL
Name of default font panel under which panel is registered in panel list.- See Also:
- Constant Field Values
-
MATERIAL_EXT
public static final java.lang.String MATERIAL_EXT
File name suffix of material panel class to name of base class.- See Also:
- Constant Field Values
-
MATERIAL
public static final java.lang.String MATERIAL
Name of default material panel under which panel is registered in panel list.- See Also:
- Constant Field Values
-
TEXTURE_EXT
public static final java.lang.String TEXTURE_EXT
File name suffix of texture panel class to name of base class.- See Also:
- Constant Field Values
-
TEXTURE
public static final java.lang.String TEXTURE
Name of default texture panel under which panel is registered in panel list.- See Also:
- Constant Field Values
-
VECTOR_EXT
public static final java.lang.String VECTOR_EXT
File name suffix of vector panel class to name of base class.- See Also:
- Constant Field Values
-
VECTOR
public static final java.lang.String VECTOR
Name of default vector panel under which panel is registered in panel list.- See Also:
- Constant Field Values
-
BORDER_NONE
public static final int BORDER_NONE
- See Also:
- Constant Field Values
-
BORDER_LINE
public static final int BORDER_LINE
- See Also:
- Constant Field Values
-
BORDER_SUNK
public static final int BORDER_SUNK
- See Also:
- Constant Field Values
-
BORDER_GROOVE
public static final int BORDER_GROOVE
- See Also:
- Constant Field Values
-
BORDER_LINETOP
public static final int BORDER_LINETOP
- See Also:
- Constant Field Values
-
ORIENT_HORIZONTAL
public static final int ORIENT_HORIZONTAL
Default horizontal orientation of lines.- See Also:
- Constant Field Values
-
ORIENT_VERTICAL
public static final int ORIENT_VERTICAL
Vertical orientation of lines.- See Also:
- Constant Field Values
-
ORIENT_GUIDE
public static final int ORIENT_GUIDE
Vertical handle of toolbar.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PsPanel
public PsPanel()
Constructor of panel withPsStackLayout(1)as default layout manager.
-
PsPanel
public PsPanel(java.awt.LayoutManager mgr)
Constructor of panel with given layout manager. Provides better similarity with java.awt.Panel.- Since:
- JavaView 2.90.000
- Version:
- 11.08.03, 1.00 created (kp)
-
-
Method Detail
-
init
public void init()
Provides layout and adds internal components.
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
Get the assigned preferred size, or whatever super provides.- Overrides:
getPreferredSizein classjava.awt.Container- Since:
- JavaView 3.13.001
- Version:
- 28.03.04, 1.00 created (kp)
-
setPreferredSize
public void setPreferredSize(int width, int height)Assigned preferred size.- Since:
- JavaView 3.13.001
- Version:
- 28.03.04, 1.00 created (kp)
-
setBackColor
public void setBackColor(java.awt.Color col)
Assigned explicit background color such that container is not transparent.- Since:
- JavaView 3.13.001
- Version:
- 28.03.04, 1.00 created (kp)
-
getPanelVersion
public int getPanelVersion()
Get panel version of this panel to compare with panel version of PsConfig for decision if panel needs to be recreated. Used, for example, when language of fonts have changed.- Since:
- JavaView 4.00.008
- Version:
- 12.11.12, 1.00 created (kp)
-
getLanguage
public java.lang.String getLanguage()
Deprecated. Method is no longer used to decide about recreation of panel.Get language used in this panel.- See Also:
getPanelVersion()- Version:
- 12.11.12, 2.00 revised (kp) Method deprecated, use getPanelVersion.
-
setImage
public void setImage(java.awt.Image image)
Image to be shown in the background of the canvas and set layout to null. Currently, this should only be used if no components are added to panel.Functionality might be moved into separate class in some future version.
- Version:
- 12.11.00, 1.00 created (kp)
-
setVisible
public void setVisible(boolean flag)
OverrideComponent.setVisible(boolean)to give panel a chance to update its content when is becomes visible. Parent of panel usually does not update panel if panel is hidden. TODO: should update only if panel is marked OUTOFDATE.- Overrides:
setVisiblein classjava.awt.Component
-
getFather
public PsUpdateIf getFather()
Get the parent of this panel which receives update events. The methodsetParentallows to set this parent.- Specified by:
getFatherin interfacePsUpdateIf- Returns:
- parent parent of this panel
- See Also:
getFather()
-
setParent
public void setParent(PsUpdateIf parent)
Set parent of this panel which receives update events.The method
getFatherallows to retrieve this parent.- Specified by:
setParentin interfacePsUpdateIf- Parameters:
parent- parent of this panel- See Also:
getFather()
-
update
public boolean update(java.lang.Object event)
Update this objects whenever parent or a child has changed, and continue update sequence. Method is usually invoked from the parent or children, i.e. inner components.- Specified by:
updatein interfacePsUpdateIf- Parameters:
event- carries a lot of information- Returns:
- true if event has been handled, otherwise false
- See Also:
PsObject,PsUpdateIf.getFather(),PsUpdateIf.setParent(PsUpdateIf)- Version:
- 11.08.03, 1.10 revised (kp) Allow event==this which does noting special.
-
instanceOf
public final boolean instanceOf(java.lang.String aClassName)
Deprecated. use "if (getClass() == PsObject.class)" insteadReturn true if string is exact classname of current instance. Even if string denotes a super class method returnsfalse. This method is different from Java operatorinstanceofwhich is true even if current instance is subclass of class 'aClassName'.- Parameters:
aClassName- name of class without package identifiers- Returns:
- true if current object is exact instance of class
-
getInsets
public java.awt.Insets getInsets()
OverwriteContainer.getInsets()to create a border measured in pixels around this panel. The border is either uniformly determined by setInsetSize(int) or by, additionally, specifying a vertical inset size using setInsetSizeVertical(int).- Overrides:
getInsetsin classjava.awt.Container- See Also:
setInsetSize(int),setInsetSizeVertical(int),setBorderType(int)
-
setInsetSize
public void setInsetSize(int size)
Set the global inset size. This call resets a previous vertical inset size to the new global inset size.
-
setInsetSizeHorizontal
public void setInsetSizeHorizontal(int size)
Set the vertical inset size to be used at top and bottom of this panel. Setting the global inset size with setInsetSize(int) at a later stage will overwrite this setting.- Since:
- JavaView 3.09.002
- Version:
- 13.02.04, 1.00 created (kp)
-
setInsetSizeVertical
public void setInsetSizeVertical(int size)
Set the vertical inset size to be used at top and bottom of this panel. Setting the global inset size with setInsetSize(int) at a later stage will overwrite this setting.- Since:
- JavaView 3.09.002
- Version:
- 13.02.04, 1.00 created (kp)
-
getTitle
public java.awt.Label getTitle()
Get the main title label, ornullof no title exists.- Version:
- 07.08.99, 1.00 created (kp)
-
getTitle
public java.awt.Label getTitle(java.lang.String title)
Create a new main title label with given string and standard font.- Since:
- JavaView 3.96.022
- Version:
- 17.06.06, 1.00 created (kp)
-
getTitle
public java.awt.Label getTitle(java.lang.String title, java.awt.Font font)Create a new main title label with given string and font. Font identifier is obtained, for example, from font IDsPsConfig.FONT_HEADER2via PsConfig.getFont(fontID).- Since:
- JavaView 3.96.022
- Version:
- 17.06.06, 1.00 created (kp)
-
hasTitle
public boolean hasTitle()
Check whether panel has a main title label.
-
removeTitle
public void removeTitle()
Remove label of panel title from this panel.- Version:
- 28.12.01, 1.00 created (kp)
-
setTitle
public void setTitle(java.lang.String title)
Set string of main title of panel but do not add title to panel. For compatibility, the method creates a new title with default font, if not available.- Version:
- 19.10.12, 2.10 revised (kp) Switch back to void return since compatibility issue.
17.06.06, 2.00 revised (kp) Method now returns the title label.
-
addTitle
public java.awt.Label addTitle(java.lang.String title)
Create main title to panel in header font and add to panel.
-
addSubTitle
public java.awt.Label addSubTitle(java.lang.String title)
Add subtitle to panel in subheader font and return label. Each invocation of this method will create and add a new subtitle.
-
addLine
public java.awt.Canvas addLine(int size)
Add a horizontal line with specified thickness as separator.- Parameters:
size- thickness of line
-
addLine
public java.awt.Canvas addLine(int size, int orient)Add a horizontal line with specified thickness as separator.- Parameters:
size- thickness of line
-
addTextField
public java.awt.TextField addTextField(java.lang.String label, int length)Add a label and textField in a horizontal panel with GridLayout(1, 2). This is a convenient method to reduce the code in inspectors.- Parameters:
label- label shown to the left of the text fieldlength- length of the text field- Returns:
- TextField component
-
setText
public static boolean setText(java.awt.TextComponent widget, java.lang.String text)Update the content of a text field if the new content is different from the current content of the widget. This method is a shortcut and intended to be used in nearly all panels.See additional comments in PsPanel#setEnabled(Component, boolean).
- Parameters:
widget- the gui element which shall be updatedtext- the new text of the text field- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.40
- Version:
- 31.03.20, 2.10 revised (kp) Use of java.awt.Component#getPeer() disabled since no longer in Java 9.
21.11.18, 2.01 revised (kp) Using preprocessor directives 1.1 compatible version re-activated to allow built-process,
while default setting is Java 9 compatible.
28.08.18, 2.00 revised (ur) removed deprecated code to achieve Java 9 compatibility.
31.07.04, 1.50 revised (kp) Superclass changed to TextComponent from TextField.
23.07.02, 1.00 created (kp)
-
setText
public static boolean setText(java.awt.Label widget, java.lang.String text)Update the content of a label if the new content is different from the current content of the widget. This method is a shortcut and intended to be used in nearly all panels.See additional comments in PsPanel#setEnabled(Component, boolean).
- Parameters:
widget- the gui element which shall be updatedtext- the new text of the label- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.30
- Version:
- 23.07.02, 1.00 created (kp)
-
select
public static boolean select(java.awt.Choice widget, int index)Update the selected index of a choice if the new index is different from the current selection of the widget. This method is a shortcut and intended to be used in nearly all panels.See additional comments in PsPanel#setEnabled(Component, boolean).
- Parameters:
widget- the gui element which shall be updatedindex- the new selected index of the choice- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.30
- Version:
- 23.07.02, 1.00 created (kp)
-
setSelectedCheckbox
public static boolean setSelectedCheckbox(java.awt.CheckboxGroup widget, java.awt.Checkbox checkbox)In a checkbox group selected a checkbox if it is different from the current selection of the widget. This method is a shortcut and intended to be used in nearly all panels.See additional comments in PsPanel#setEnabled(Component, boolean).
- Parameters:
widget- the gui element which shall be updatedcheckbox- the new selected checkbox- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.30
- Version:
- 23.07.02, 1.00 created (kp)
-
setState
public static boolean setState(java.awt.Checkbox widget, boolean bState)Assure that a checkbox has same state than corresponding boolean flag. If state of checkbox is equal to the requested new state then do nothing.See additional comments in PsPanel#setEnabled(Component, boolean).
- Parameters:
widget- CheckboxbState- Requested new state of the checkbox- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.30
- Version:
- 23.07.02, 1.00 created (kp)
-
setLabel
public static boolean setLabel(java.awt.Button widget, java.lang.String text)Set the label of a button if it is different from the current label. If label of button is equal to the requested new label then do nothing.See additional comments in PsPanel#setEnabled(Component, boolean).
- Parameters:
widget- Buttontext- new label of the widget- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.30
- Version:
- 23.07.02, 1.00 created (kp)
-
setLabel
public static boolean setLabel(java.awt.Checkbox widget, java.lang.String text)Set the label of a checkbox if it is different from the current label. If label of checkbox is equal to the requested new label then do nothing.See additional comments in PsPanel#setEnabled(Component, boolean).
- Parameters:
widget- Checkboxtext- new label of the widget- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.30
- Version:
- 23.07.02, 1.00 created (kp)
-
setEnabled
public static boolean setEnabled(java.awt.Component widget, boolean bEnable)Assure that a component is enabled if requested. If state of component is equal to the requested new state then do nothing.Note: never call one of the static helper methods from an overwritten method with the same name. For example, if MyLabel extends Label and MyLabel#setEnabled(boolean) exists. Then an invocation of PsPanel.setEnabled(this, boolean) in MyLabel#setEnabled would lead to loop since PsPanel.setEnabled calls MyLabel#setEnabled.
- Parameters:
widget- ComponentbEnable- Requested new state of the component- Returns:
trueif the value has been update in this method.- Since:
- JavaView 2.30
- Version:
- 23.07.02, 1.00 created (kp)
-
addLabelComponent
public java.awt.Panel addLabelComponent(java.lang.String label, java.awt.Component comp)Add a label and a component in a horizontal panel with GridLayout(1, 2). This is a convenient method to reduce the code in inspectors.- Parameters:
label- text shown to the left of the componentcomp- component shown to the right of the label- Returns:
- panel showing label and component
-
drawText
public void drawText(java.awt.Graphics g, java.awt.Point point, java.lang.String string)Draw text at specified position.
-
drawBorder
public static void drawBorder(java.awt.Graphics g, int borderType, java.awt.Rectangle rectangle)Draw a rectangle into the given graphics context.- See Also:
drawBorder(Graphics, int, Rectangle, Color)- Version:
- 02.02.02, 1.00 created (kp)
-
drawBorder
public static void drawBorder(java.awt.Graphics g, int borderType, java.awt.Rectangle rectangle, java.awt.Color color)Draw a rectangle into the given graphics context with given color.- Since:
- JavaView 2.47
- See Also:
drawBorder(Graphics, int, Rectangle)- Version:
- 08.12.02, 1.00 created (kp)
-
drawBorder
public void drawBorder(java.awt.Graphics g, int borderType)Draw border around this panel.
-
drawBorder
public static void drawBorder(java.awt.Component comp, java.awt.Graphics g, int borderType)Deprecated. use static void PsPanel.drawBorder(Graphics, borderType, Rectangle);Draw border around panel. Method calls PsPanel.drawBorder(g, borderType, new Rectangle(comp.getSize()));
-
setBorderType
public void setBorderType(int borderType)
Set border of panel which is automatically drawn. IfborderType==PsPanel.BORDER_NONEdrawing is disabled, otherwise the borderType is set and drawing is enabled.- Parameters:
borderType- type of border, for possible values see PsPanel.- See Also:
paint(Graphics)
-
setOutOfDate
public void setOutOfDate(boolean state)
Mark this panel as being not synchronized with the correct data of its parent. Usually, this method is invoked whenever a parent changes but this panel is temporarily not visible. In this case the next invocation of this paint(Graphics) method will at first update this panel with new data from its parent by calling this.update(m_parent).- Version:
- 21.01.01, 1.00 revised (kp)
21.01.01, 1.00 created (kp)
-
paint
public void paint(java.awt.Graphics g)
Callsuper.paint(g)and draw border around panel. If this panel is out of date, then this panel is first synchronized with new data from its parent by calling this.update(m_parent).If this panel has an image then the image is drawn before super.paint(Graphics) is called.
- Overrides:
paintin classjava.awt.Container- See Also:
setBorderType(int)- Version:
- 12.11.06, 1.60 revised (kp) If image exists still clear panel with background color
since image may be semi-transparent.
21.01.01, 1.50 revised (kp) Synchronize with parent if out of date.
12.11.00, 1.10 revised (kp) Drawing of background image added.
-
update
public void update(java.awt.Graphics g)
OverrideComponent.update(Graphics)to avoid clearing the component if an image is available.- Overrides:
updatein classjava.awt.Container
-
-
"