Class Form
- All Implemented Interfaces:
Animation, Editable, StyleListener, Iterable<Component>
- Direct Known Subclasses:
Dialog
Top level component that serves as the root for the UI, this Container
subclass works in concert with the Toolbar to create menus. By default a
forms main content area (the content pane) is scrollable on the Y axis and has a com.codename1.ui.layouts.FlowLayout as is the default.
Form contains a title bar area which in newer application is replaced by the Toolbar.
Calling #add(com.codename1.ui.Component) or all similar methods on the Form
delegates to the contentPane so calling form.add(cmp) is equivalent to
form.getContentPane().add(cmp). Normally this shouldn't matter, however in some cases such as
animation we need to use the content pane directly e.g. form.getContentPane().animateLayout(200)
will work whereas form.animateLayout(200) will fail.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classIterates through the components on this form in traversal order. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIndicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of Codename One.Fields inherited from class Component
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSORModifier and TypeFieldDescriptionstatic final intAlignment to the baseline constraintstatic final intBox-orientation constant used to specify the bottom of a box.static final intBaseline resize behavior constant used to properly align components.static final intBaseline resize behavior constant used to properly align components.static final intBaseline resize behavior constant used to properly align components.static final intBaseline resize behavior constant used to properly align components.static final intIndicates a Component center alignmentstatic final intThe crosshair cursor type.static final intThe default cursorstatic final intUsed by getDragRegionStatus to indicate immediate dragabilitystatic final intUsed by getDragRegionStatus to indicate immediate dragabilitystatic final intUsed by getDragRegionStatus to indicate immediate dragabilitystatic final intUsed by getDragRegionStatus to indicate likely dragabilitystatic final intUsed by getDragRegionStatus to indicate likely dragabilitystatic final intUsed by getDragRegionStatus to indicate likely dragabilitystatic final intUsed by getDragRegionStatus to indicate no dragabilitystatic final intUsed by getDragRegionStatus to indicate limited dragabilitystatic final intUsed by getDragRegionStatus to indicate limited dragabilitystatic final intUsed by getDragRegionStatus to indicate limited dragabilitystatic final intThe east-resize cursor type.static final intThe hand cursor type.static final intBox-orientation constant used to specify the left side of a box.static final intThe move cursor type.static final intThe north-resize cursor type.static final intThe north-east-resize cursor type.static final intThe north-west-resize cursor type.static final intBox-orientation constant used to specify the right side of a box.static final intThe south-resize cursor type.static final intThe south-east-resize cursor type.static final intThe south-west-resize cursor type.static final intThe text cursor type.static final intBox-orientation constant used to specify the top of a box.static final intThe west-resize cursor type.static final intThe wait cursor type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidactionCommand(Command cmd) Invoked to allow subclasses of form to handle a command from one point rather than implementing many command instances.final voidaddCommand(Command cmd) Adds a command to the menu bar softkeys.voidaddCommand(Command cmd, int offset) Adds a command to the menu bar softkeys or into the menu dialog, this version of add allows us to place a command in an arbitrary location.voidA listener that is invoked when a command is clicked allowing multiple commands to be handled by a single blockvoidaddComponent(int index, Component cmp) Adds Component to the Form's Content PanevoidaddComponent(int index, Object constraints, Component cmp) Adds a Component to the ContainervoidaddComponent(Component cmp) Adds Component to the Form's Content PanevoidaddComponent(Object constraints, Component cmp) Adds a Component to the Container<C extends Component>
voidvoidaddGameKeyListener(int keyCode, ActionListener listener) Add a game key listener to the given gamekey for a callback when the key is releasedvoidaddKeyListener(int keyCode, ActionListener listener) Add a key listener to the given keycode for a callback when the key is releasedvoidThis listener is invoked when device orientation changes on devices that support orientation changevoidAdds a listener to be notified when the user has initiated a paste event.voidThis listener would be invoked when show is completedvoidThis listener is invoked when device size is changedbooleananimate()Allows the animation to reduce "repaint" calls when it returns false.voidanimateHierarchy(int duration) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animationvoidanimateHierarchyAndWait(int duration) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation.voidanimateHierarchyFade(int duration, int startingOpacity) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animationvoidanimateHierarchyFadeAndWait(int duration, int startingOpacity) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation.voidanimateLayout(int duration) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animationvoidanimateLayoutAndWait(int duration) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animation.voidanimateLayoutFade(int duration, int startingOpacity) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animationvoidanimateLayoutFadeAndWait(int duration, int startingOpacity) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animation.voidanimateUnlayout(int duration, int opacity, Runnable callback) This method is the exact reverse of animateLayout, when completed it leaves the container in an invalid state.voidanimateUnlayoutAndWait(int duration, int opacity) This method is the exact reverse of animateLayoutAndWait, when completed it leaves the container in an invalid state.voidprotected ComponentSubclasses can override this method to control the creation of the status bar component.voidIndicate that cmp would no longer like to receive animation eventsvoiddispatchCommand(Command cmd, ActionEvent ev) Dispatches a command via the standard form mechanism of firing a command eventvoidFires a paste event to the paste listeners.Returns the component on this form that is currently being edited, or null if no component is currently being edited.findNextFocusHorizontal(boolean right) This method returns the next focusable Component horizontallyfindNextFocusVertical(boolean down) This method returns the next focusable Component verticallyReturns the animation manager instance responsible for this form, this can be used to track/queue animationsIndicates the command that is defined as the back command out of this form.Indicates the command that is defined as the clear command in this form.getCommand(int index) Returns the command occupying the given indexintA helper method to check the amount of commands within the form menufinal FormReturns the Component Form or null if this Component is not added yet to a formintReturns the Component index in the ContainerThis method returns the Content pane instanceReturns the current virtual input device in the form.Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes.intgetDragRegionStatus(int x, int y) Indicates if the section within the X/Y area is a "drag region" where we expect people to drag or press in which case we can instantly start dragging making perceived performance faster.A text component that will receive focus and start editing immediately as the form is shownReturns the current focus component for this formgetFormLayeredPane(Class c, boolean top) Returns the layered pane for the class and if one doesn't exist a new one is created dynamically and returned.protected ContainerGets the form layered pane of the container without trying to create it.Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations.intIn some virtual keyboard implementations (notably iOS) this value is used to determine the height of the virtual keyboardThis method returns the layered pane of the Form, the layered pane is laid on top of the content pane and is created lazily upon calling this method the layer will be created.getLayeredPane(Class c, boolean top) Returns the layered pane for the class and if one doesn't exist a new one is created dynamically and returnedgetLayeredPane(Class c, int zIndex) Returns the layered pane for the class and if one doesn't exist a new one is created dynamically and returnedprotected ContainerGets the layered pane of the container without trying to create it.Returns the layout manager of the form's content pane.Returns the associated Menu Bar objectReturns the style of the menugetNextComponent(Component current) Gets the next component in focus traversal order.getPreviousComponent(Component current) Gets the previous component in focus traversal order.String[]A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder codeString[]This method is here to workaround an XMLVM array type bug where property types aren't identified properly, it returns the names of the types using the following type names: String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRendererClass[]Matches the property names method (see that method for further details).getPropertyValue(String name) Returns the current value of the property name, this method is used by the GUI builderThis method returns a rectangle defining the "safe" area of the display, which excludes areas on the screen that are covered by notches, task bars, rounded corners, etc.intScroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation modeintThe form itself shouldgetSoftButton(int offset) Returns the button representing the softbutton, this allows modifying softbutton attributes and behavior programmatically rather than by using the command API.final intReturns the number of buttons on the menu bar for use with getSoftButton()Gets the source command that was used to navigate to this form.getTabIterator(Component start) Returns an iterator that iterates over all of the components in this form, ordered by their tab index.Gets TextSelection support for this form.intDefault color for the screen tint when a dialog or a menu is showngetTitle()Returns the Form title textTitle area manipulation might break with future changes to Codename One and might damage themeing/functionality of the Codename One application in some platformsAllows modifying the title attributes beyond style (e.g. setting icon/alignment etc.)Returns the style of the titleGets the Form Toolbar if exists or nullThis property allows us to define a an animation that will draw the transition for entering this form.This property allows us to define a an animation that will draw the transition for exiting this form.This method should be used by the Component to retrieve the correct UIManager to work withbooleanAllows grabbing a flag that is used by convention to indicate that you are running an exclusive animation.final booleanhasMedia()Used by the implementation to prevent flickering when flushing the double bufferprotected voidThis method is only invoked when the underlying canvas for the form is hidden this method isn't called for form based events and is generally usable for suspend/resume based behaviorprotected voidAllows subclasses to disable the global toolbar for a specific form by overriding this methodprotected voidThis method initializes the Component defaults constantsbooleanEnable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)booleanIndicates whether focus should cycle within the formbooleanisDragRegion(int x, int y) Indicates if the section within the X/Y area is a "drag region" where we expect people to drag and never actually "press" in which case we can instantly start dragging making perceived performance faster.booleanChecks if the component is currently being edited.booleanChecks if custom cursors are enabled on this form.booleanIndicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of Codename One.booleanToggles the way the virtual keyboard behaves, enabling this mode shrinks the screen but makes editing possible when working with text fields that aren't in a scrollable container.booleanWhen set to true the physical back button will minimize the applicationbooleanIndicates whether the component should/could scroll by default a component is not scrollable.booleanIndicates whether the component should/could scroll on the X axisbooleanIndicates whether the component should/could scroll on the Y axisbooleanIndicate whether this component scroll is visiblebooleanReturns true if there is only one focusable member in this form.booleanIndicates that scrolling through the component should work as an animationvoidkeyPressed(int keyCode) If this Component is focused, the key pressed event will call this methodvoidkeyReleased(int keyCode) If this Component is focused, the key released event will call this methodvoidkeyRepeated(int keyCode) If this Component is focused, the key repeat event will call this method.protected voidlongKeyPress(int keyCode) If this Component is focused this method is invoked when the user presses and holds the keyvoidlongPointerPress(int x, int y) If this Component is focused this method is invoked when the user presses and holds the pointer on the Componentprotected voidCallback that's invoked by registerAnimated to let subclasses keep track of animation registration.protected voidonShow()Allows subclasses to bind functionality that occurs when a specific form or dialog appears on the screenprotected voidAllows subclasses to bind functionality that occurs when a specific form or dialog is "really" showing hence when the transition is totally complete (unlike onShow which is called on intent).voidThis method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.voidExposing the background painting for the benefit of animationsprotected voidPaints the UI for the scrollbars on the component, this will be invoked only for scrollable components.protected StringReturns a string representing the state of this component.voidpointerDragged(int[] x, int[] y) If this Component is focused, the pointer dragged event will call this methodvoidpointerDragged(int x, int y) If this Component is focused, the pointer dragged event will call this methodvoidpointerHover(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display.voidpointerHoverPressed(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display.voidpointerHoverReleased(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display.voidpointerPressed(int x, int y) If this Component is focused, the pointer pressed event will call this methodvoidpointerReleased(int x, int y) If this Component is focused, the pointer released event will call this methodvoidrefreshTheme(boolean merge) Makes sure the component is up to date with the current theme, ONLY INVOKE THIS METHOD IF YOU CHANGED THE THEME!final voidThe given component is interested in animating its appearance and will start receiving callbacks when it is visible in the form allowing it to animate its appearance.voidInvoke this to release the animation lock that was grabbed in grabAnimationLockvoidRemoves all Components from the Content PanevoidClear menu commands from the menu barvoidRemoves all Show Listeners from this FormvoidremoveCommand(Command cmd) Removes the command from the menu bar softkeysvoidA listener that is invoked when a command is clicked allowing multiple commands to be handled by a single blockvoidremoveComponent(Component cmp) Removes a component from the Form's Content Pane<C extends Component>
voidvoidremoveGameKeyListener(int keyCode, ActionListener listener) Removes a game key listener from the given game keycodevoidremoveKeyListener(int keyCode, ActionListener listener) Removes a key listener from the given keycodevoidThis listener is invoked when device orientation changes on devices that support orientation changevoidRemoves listener from being notified when the user has initiated a paste event.voidRemoves the show listenervoidRemove SizeChangedListenervoidreplace(Component current, Component next, Transition t) This method replaces the current Component with the next Component.voidreplaceAndWait(Component current, Component next, Transition t) This method replaces the current Component with the next Component.protected booleanresumeDragAfterScrolling(int x, int y) This method fixes this tensile drag issue.voidMakes sure the component is visible in the scroll if this container is scrollablevoidsetAllowEnableLayoutOnPaint(boolean allow) Enabling "layoutOnPaint" behaviour.voidsetAlwaysTensile(boolean alwaysTensile) Enable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)voidsetBackCommand(Command backCommand) Indicates the command that is defined as the back command out of this form.setBackCommand(String name, Image icon, ActionListener ev) Shorthand for#setBackCommand(com.codename1.ui.Command)that dynamically creates the command usingcom.codename1.ui.Image, com.codename1.ui.events.ActionListener).voidsetBgImage(Image bgImage) Sets the background image to show behind the formvoidsetClearCommand(Command clearCommand) Indicates the command that is defined as the clear command in this form.voidSets the current virtual input device for the form.voidsetCyclicFocus(boolean cyclicFocus) Indicates whether focus should cycle within the formvoidsetDefaultCommand(Command defaultCommand) Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes.voidsetEditOnShow(TextArea editOnShow) A text component that will receive focus and start editing immediately as the form is shownvoidsetEnableCursors(boolean e) Enable or disable custom cursors on this form.voidsetFocused(Component focused) Sets the focused component and fires the appropriate events to make it sovoidsetFocusScrolling(boolean focusScrolling) Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of Codename One.voidsetFormBottomPaddingEditingMode(boolean b) Toggles the way the virtual keyboard behaves, enabling this mode shrinks the screen but makes editing possible when working with text fields that aren't in a scrollable container.voidsetGlassPane(Painter glassPane) Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations.voidSets the layout manager responsible for arranging this containervoidsetMenuBar(MenuBar menuBar) Sets the associated MenuBar Object.voidsetMenuCellRenderer(ListCellRenderer menuCellRenderer) Determine the cell renderer used to render menu elements for themeing the look of the menu optionsvoidsetMenuTransitions(Transition transitionIn, Transition transitionOut) Sets the menu transitions for showing/hiding the menu, can be null...voidsetMinimizeOnBack(boolean minimizeOnBack) When set to true the physical back button will minimize the applicationvoidsetOverrideInvisibleAreaUnderVKB(int invisibleAreaUnderVKB) Overrides the invisible area under the virtual keyboard with a given value.setPropertyValue(String name, Object value) Sets a new value to the given property, returns an error message if failed and null if successful.voidsetRTL(boolean r) Is the component a bidi RTL componentvoidCauses the display safe area to be recalculated the next time the form list laid out.voidsetScrollable(boolean scrollable) The equivalent of calling both setScrollableY and setScrollableXvoidsetScrollableX(boolean scrollableX) Sets whether the component should/could scroll on the X axisvoidsetScrollableY(boolean scrollableY) Sets whether the component should/could scroll on the Y axisvoidsetScrollAnimationSpeed(int animationSpeed) Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation modevoidsetScrollVisible(boolean isScrollVisible) Set whether this component scroll is visiblevoidsetSmoothScrolling(boolean smoothScrolling) Indicates that scrolling through the component should work as an animationvoidsetSourceCommand(Command sourceCommand) Sets the source command that was used to navigate to this form.voidsetTintColor(int tintColor) Default color for the screen tint when a dialog or a menu is shownvoidSets the Form title to the given textvoidsetTitleComponent(Label title) Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.voidsetTitleComponent(Label title, Transition t) Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.voidSets the style of the title programmaticallyvoidsetToolbar(Toolbar toolbar) Sets the Form ToolbarvoidsetToolBar(Toolbar toolbar) Sets the Form ToolbarvoidsetTransitionInAnimator(Transition transitionInAnimator) This property allows us to define a an animation that will draw the transition for entering this form.voidsetTransitionOutAnimator(Transition transitionOutAnimator) This property allows us to define a an animation that will draw the transition for exiting this form.voidsetUIManager(UIManager uiManager) Allows replacing the UIManager in a component hierarchy to update the look and feel only to a specific hierarchyvoidsetVisible(boolean visible) Toggles visibility of the componentprotected booleanThis method returns the value of the theme constantpaintsTitleBarBooland it is invoked internally in the code.protected booleanIndicates whether this form wants to receive pointerReleased events for touch events that started in a different formvoidshow()Displays the current form on the screenvoidshowBack()Displays the current form on the screen, this version of the method is useful for "back" navigation since it reverses the direction of the transition.protected voidThis method is only invoked when the underlying canvas for the form is shown this method isn't called for form based events and is generally usable for suspend/resume based behaviorprotected voidsizeChanged(int w, int h) This method is only invoked when the underlying canvas for the form gets a size changed event.voidstopEditing(Runnable onFinish) Stops any active editing on the form.Methods inherited from class Container
add, add, add, add, add, add, addAll, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getGridPosX, getGridPosY, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isSelectableInteraction, isSurface, iterator, iterator, layoutContainer, morph, morphAndWait, paintComponentBackground, paintGlass, replace, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, setCellRenderer, setEnabled, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, updateTabIndicesModifier and TypeMethodDescriptionfinal ContainerSimpler version of addComponent that allows chaining the calls for shorter syntaxSimpler version of addComponent that allows chaining the calls for shorter syntaxSimpler version of addComponent that allows chaining the calls for shorter syntaxSimpler version of addComponent that allows chaining the calls for shorter syntaxSimpler version of addComponent that allows chaining the calls for shorter syntaxSimpler version of addComponent that allows chaining the calls for shorter syntaxIdentical to add(x).add(y) only with a shorter syntaxvoidapplyRTL(boolean rtl) Invokes apply/setRTL recursively on all the children components of this containerprotected DimensionCalculates the preferred size based on component content.protected voidremove this component and it's children from the painting queuevoidClears all client properties from this Componentprotected booleanIndicates that children's widths should be calculated as if this component weren't scrollable-X, even when the component is scrollable Y.protected booleanIndicates that children's widths should be calculated as if this component weren't scrollable-X, even when the component is scrollable X.booleanReturns true if the given component is within the hierarchy of this containercreateAnimateHierarchy(int duration) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation.createAnimateHierarchyFade(int duration, int startingOpacity) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation.createAnimateLayout(int duration) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animationcreateAnimateLayoutFade(int duration, int startingOpacity) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animationcreateAnimateLayoutFadeAndWait(int duration, int startingOpacity) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animation.protected MotioncreateAnimateMotion(int start, int destination, int duration) Creates a motion object for animation, allows subclasses to replace the motion type used in animations (currently defaults to ease-in).createAnimateUnlayout(int duration, int opacity, Runnable callback) This method is the exact reverse of createAnimateLayout, when animation is completed it leaves the container in an invalid state.createReplaceTransition(Component current, Component next, Transition t) This method creates an animation component that replaces the current Component with the next Component.protected voidInvoked on the focus component to let it know that drag has started on the parent container for the case of a component that doesn't support scrollingvoidPerforms a drop operation of the component at the given X/Y location in coordinate space, this method should be overriden by subclasses to perform all of the logic related to moving a component, by default this method does nothing and so dragging a component and dropping it has no effectstatic ContainerShort-hand for enclosing multiple components in a container typically a box layoutstatic ContainerShort-hand for enclosing a component within a ContainerfindDropTargetAt(int x, int y) Recursively searches the container hierarchy for a drop targetFinds the first focusable Component on this Containerprotected voidWhen working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly.voidFlushes ongoing replace operations to prevent two concurrent replace operations from colliding.voidA more powerful form of revalidate that recursively lays out the full hierarchyintReturns the gap to be left for the bottom scrollbar on the X axis.getChildrenAsList(boolean includeQueued) Gets the child components of this Container as a List.getClosestComponentTo(int x, int y) Very useful for touch events or drop events that need approximation more than accuracygetComponentAt(int index) Returns the Component at a given indexgetComponentAt(int x, int y) Returns a Component at coordinate (x, y).intReturns the number of componentsprotected intThis method should be implemented correctly by subclasses to make snap to grid functionality work as expected.protected intThis method should be implemented correctly by subclasses to make snap to grid functionality work as expected.intReturns the height for layout manager purposes, this takes scrolling into consideration unlike the getHeight method.intReturns the width for layout manager purposes, this takes scrolling into consideration unlike the getWidth method.Returns the lead component for this hierarchy if such a component is definedReturns the lead container thats handling the leading, this is useful for a container hierarchy where the parent container might not be the leadergetResponderAt(int x, int y) Returns the top-most component that responds to pointer events at absolute coordinate (x, y).Gets the Safe area "root" container for this container.intGets the Container scroll incrementvoidSame as setShouldCalcPreferredSize(true) but made accessible for layout managersbooleanIndicates whether component is enabled or disabled thus allowing us to prevent a component from receiving input events and indicate so visuallybooleanChecks if this container is a "safe area".booleanChecks if this container is a safe area root.protected booleanThis method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.booleanChecks if this container acts as a Material Design surface.iterator()Part of the Iterable interface allowing us to do a for-each loop on Containeriterator(boolean includeQueued) Obtains an iterator that iterates over the children of this container.voidPerforms the layout of the container if a layout is necessaryvoidMorph is similar to the replace functionality where a component might be replaced with a component that isn't within the container.voidmorphAndWait(Component source, Component destination, int duration) Morph is similar to the replace functionality where a component might be replaced with a component that isn't within the container.voidPaints this container background, skipping container background fill when fully obscured by children.protected voidThis method can be overriden by a component to draw on top of itself or its children after the component or the children finished drawing in a similar way to the glass pane but more refined per componentvoidreplace(Component current, Component next, Transition t, Runnable onFinish, int growSpeed) This method replaces the current Component with the next ComponentvoidreplaceAndWait(Component current, Component next, Transition t, boolean dropEvents) This method replaces the current Component with the next Component.voidreplaceAndWait(Component current, Component next, Transition t, int layoutAnimationSpeed) This method replaces the current Component with the next Component.voidRe-layout the container, this is useful when we modify the container hierarchy and need to redo the layoutvoidRevalidates the container before the next paint cycle.voidRevalidates the container in a way that doesn't conflict with running animations.voidsetCellRenderer(boolean cellRenderer) Used as an optimization to mark that this component is currently being used as a cell renderervoidsetEnabled(boolean enabled) This method will recursively set all the Container chidrens to be enabled/disabled.final voidsetLeadComponent(Component lead) Sets the lead component for this container, a lead component takes over the entire component hierarchy and receives all the events for the container hierarchy.voidsetSafeArea(boolean safeArea) Marks this container as a "safe area", meaning that it will automatically supply sufficient padding as necessary for its children to be laid out inside the safe area of the screen.voidsetSafeAreaRoot(boolean root) Set whether this container is a safe area root.voidsetScrollIncrement(int scrollIncrement) Determines the scroll increment size of this Container.voidsetShouldCalcPreferredSize(boolean shouldCalcPreferredSize) Indicates the values within the component have changed and preferred size should be recalculatedprotected voidsetShouldLayout(boolean layout) Flags this container to preform layoutintupdateTabIndices(int offset) Updates the tab indices in this container recursively.Methods inherited from class Component
addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAccessibilityText, getAllStyles, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEditable, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isSetCursorSupported, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, laidOut, onScrollX, onScrollY, onSetFocusable, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setRippleEffect, setSameHeight, setSameSize, setSameWidth, setScrollOpacityChangeSpeed, setScrollSize, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setUnselectedStyle, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContainsModifier and TypeMethodDescriptionvoidAdds a listener to the dragFinished eventvoidBroadcasts an event when dragging over a componentvoidBinds an action listener to drop events which are invoked when this component is dropped on a targetvoidRegisters interest in receiving callbacks for focus gained events, a focus event is invoked when the component accepts the focus.voidAdds a listener to the pointer eventvoidAdds a listener to the pointer eventvoidAdds a listener to the pointer eventvoidAdds a listener to the pointer eventvoidaddPullToRefresh(Runnable task) This method adds a refresh task to the Component, the task will be executed if the user has pulled the scroll beyond a certain height.voidRegisters interest in receiving callbacks for scroll gained events, a scroll event is invoked when the component is scrolled.voidAdds a listener to be notified when the state of this component is changed to and from initialized.voidManually announces text to native accessibility services, associating the announcement with this component when possible.voidbindProperty(String prop, BindTarget target) Binds the given property name to the given bind targetfinal booleanA component that might need side swipe such as the slider could block it from being used for some other purpose when on top of said component.protected DimensionMethod that can be overriden to represent the actual size of the component when it differs from the desireable size for the viewportbooleancontains(int x, int y) Returns true if the given absolute coordinate is contained in the ComponentbooleancontainsOrOwns(int x, int y) Checks to see if this component either contains the given point, or if it owns the component that contains the given point.createStyleAnimation(String destUIID, int duration) Creates an animation that will transform the current component to the styling of the destination UIID when completed.protected voidInvoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.protected voidAllows components to create a style of their own, this method cleans up state for the given styleprotected voidThis callback method indicates that a component drag has just entered this componentprotected voidThis callback method provides an indication for a drop target that a drag operation is exiting the bounds of this component and it should clear all relevant state if such state exists.protected voiddragFinished(int x, int y) Callback indicating that the drag has finished either via drop or by releasing the componentprotected booleandraggingOver(Component dragged, int x, int y) This method allows a component to indicate if it is a drop target for the given component at the given x/y location (in component coordiate space).protected voiddrawDraggedImage(Graphics g, Image img, int x, int y) Draws the given image at x/y, this method can be overriden to draw additional information such as positive or negative drop indicationprotected voidCallback allowing a developer to track when the component gains focusprotected voidCallback allowing a developer to track wheh the component loses focusintReturns the absolute X location based on the component hierarchy, this method calculates a location on the screen for the component rather than a relative location as returned by getX()intReturns the absolute Y location based on the component hierarchy, this method calculates a location on the screen for the component rather than a relative location as returned by getX()Returns the text that describes this component to assistive technologies.final StyleReturns a "meta style" that allows setting styles once to all the different Style objects, the getters for this style will be meaningless and will return 0 values.intgetBaseline(int width, int height) The baseline for the component text according to which it should be aligned with other components for best visual look.intReturns a constant indicating how the baseline varies with the size of the component.String[]Returns the names of the properties within this component that can be bound for persistence, the order of these names mean that the first one will be the first boundClass[]Returns the types of the properties that are bindable within this componentprotected BorderNormally returns getStyle().getBorder() but some subclasses might use this to programmatically replace the border in runtime e.g.getBoundPropertyValue(String prop) Allows the binding code to extract the value of the propertyprotected RectangleReturns the component bounds which is sometimes more convenient than invoking getX/Y/Width/Height.Returns the bounds of this component in the provided Rectangle.getClientProperty(String key) Client properties allow the association of meta-data with a component, this is useful for some applications that construct GUI's on the fly and need to track the connection between the UI and the data.Indicates the property within this component that should be bound to the cloud objectThe destination property of the CloudObjectSome components may optionally generate a state which can then be restored using setCompnentState().intGets the custom cursor for this component.static byteReturns the default translucency used in the#getDragImage()method.final Rectanglegets the Component dirty region, this method is for internal use only and SHOULD NOT be invoked by user code.Returns the Component Style for the disabled state allowing us to manipulate the look of the component when its disabledintGets the current dragged x values when the Component is being draggedintGets the current dragged y values when the Component is being draggedprotected ImageThis method returns an image representing the dragged component, it can be overriden by subclasses to customize the look of the image, the image will be overlaid on top of the form during a drag and drop operationprotected floatgetDragSpeed(boolean vertical) This method returns the dragging speed based on the latest dragged eventsbyteReturns the translucency used in the#getDragImage()method.Gets the delegate that handles the editing of this component.intReturns the component heightGets inline styles that are to be applied to all states of this component.Gets inline styles that are to be applied to the disabled state of this component.Gets inline styles that are to be applied to the pressed state of this component.Gets inline styles that are to be applied to the selected state of this component.Gets the theme that is used by inline styles to reference images.Gets inline styles that are to be applied to the unselected state of this component.intGets the inner height of this component.intGets the preferred height removing vertical padding.intGets the preferred width removing horizontal padding.intGets the inner width of this component.intGets x-coordinate of the inner bounds of this component.intGets the inner y-coordinate of the inner bounds of this component.Allows us to indicate the label associated with this component thus providing visual feedback related for this component e.g.getName()A component name allows us to easily identify the component within a dynamic UI.Gets the native overlay for this component.Allows us to determine which component will receive focus next when traversing with the down keyAllows us to determine which component will receive focus next when traversing with the left key.Allows us to determine which component will receive focus next when traversing with the right keyAllows us to determine which component will receive focus next when traversing with the up key.intGets the outer height of this component.intGets the preferred height including the vertical margins.intGets the preferred width including horizontal margins.intGets the outer width of this component.intGets the x-coordinate of the outer bounds of this component.intGets the Y-coordinate of the outer bounds of this component.getOwner()Gets the "owner" of this component as set by#setOwner(com.codename1.ui.Component).Returns the container in which this component is containedintHelper method to retrieve the preferred height of the component.Returns the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size.Returns the preferred size string that can be used to specify the preferred size of the component using pixels or millimetres.intGets the preferred tab index of this component.intHelper method to retrieve the preferred width of the component.Returns the Component Style for the pressed state allowing us to manipulate the look of the component when it is pressedReturns the array of components that have an equal heightReturns the array of components that have an equal widthReturns the scrollable parent of this componentReturns the Components dimension in scrolling, this is very similar to the preferred size aspect only it represents actual scrolling limits.intThis method is used internally by the look and feel to implement the fading scrollbar behavior.intIndicates the decrement units for the scroll opacityintIndicates the X position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.intIndicates the Y position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the y position of the component.Allows determining the text for the select command used in the 3rd softbutton mode.Returns the component bounds with absolute screen coordinates, for components that include an internal selection behavior and are not containers (currently only List) this method allows returning the position of the selection itself which is useful for things such as the popup dialog and similar UI's that need to reference the position of the selection externallyReturns the Component Style for the selected state allowing us to manipulate the look of the component when it owns focusgetStyle()Returns the current Component Style allowing code to draw the current component, you should normally use getUnselected/Pressed/DisabledStyle() and not this method since it will return different values based on component state.intGets the tab index of the component.intRecommended length for the tensile, -1 for defaultReturns text selection support object for this component.Returns
final StringgetUIID()Unique identifier for a component.final StyleReturns the Component Style for the unselected mode allowing us to manipulate the look of the componentprotected RectangleReturns the component bounds for scrolling which might differ from the getBounds for large components e.g.getVisibleBounds(Rectangle rect) Returns the component bounds for scrolling which might differ from the getBounds for large components into the provided rectangle.intgetWidth()Returns the component widthintgetX()Returns the current component x location relatively to its parent containerintgetY()Returns the component y location relatively to its parent containervoidgrowShrink(int duration) Grows or shrinks this component to its new preferred size, this method essentially takes a component whose preferred size has changed and creates a "growing" effect that lasts for the duration.booleanPrevents key events from being grabbed for focus traversal.booleanChecks if this component has a fixed preferred size either via an explicit call to#setPreferredH(int)and#setPreferredW(int), or via a preferred size style string.booleanhasFocus()Returns true if the component has focusprotected voidHides the native overlay for this component.protected voidAllows subclasses to bind functionality that relies on fully initialized and "ready for action" component stateprotected voidAllows components to create a style of their own, this method binds the listener to the style and installs a bg painterprotected voidinitDisabledStyle(Style disabledStyle) Can be overridden by subclasses to perform initialization when the disabled style is set to a new value.protected voidinitPressedStyle(Style pressedStyle) Can be overridden by subclasses to perform initialization when the pressed style is set to a new value.protected voidinitSelectedStyle(Style selectedStyle) Can be overridden by subclasses to perform initialization when the selected style is set to a new value.protected voidinitUnselectedStyle(Style unselectedStyle) Can be overridden by subclasses to perform initialization when the unselected style is set to a new value.protected voidAllows subclasses to create their own custom style types and install the background painter into thembooleanPrevent a lead component hierarchy from this specific component, this allows a component within that hierarchy to still act as a standalone componentbooleanUsed as an optimization to mark that this component is currently being used as a cell rendererbooleanSearches the hierarchy of the component recursively to see if the given Container is one of the parents of this componentprotected booleanIndicates whether we are in the middle of a drag operation, this method allows developers overriding the pointer released events to know when this is a drag operation.protected booleanisDragAndDropOperation(int x, int y) This method allows a developer to define only a specific portion of a component as draggable by default it returns true if the component is defined as "draggable"booleanIndicates whether this component can be dragged in a drag and drop operation rather than scroll the parentbooleanIndicates whether this component can receive dropped components into it, notice that when dropping on a component or container the parents will be checked recursively to find a valid drop targetbooleanChecks to see if the component is editable.booleanMakes the component effectively opaque by blending the backgrounds into an image in memory so the layer of underlying components is only drawn once when this component is repainted.booleanReturns true if this component can receive focus and is enabledbooleanThis property is useful for blocking in z-order touch events, sometimes we might want to grab touch events in a specific component without making it focusable.booleanisHidden()Returns true if the component was explicitly hidden by the user.booleanisHidden(boolean checkParent) Checks if the component is hidden.booleanIndicates that this component and all its children should be hidden when the device is switched to landscape modebooleanIndicates that this component and all its children should be hidden when the device is switched to portrait modebooleanReturns
protected booleanprotected booleanIndicates if the component is in the initialized state, a component is initialized when its initComponent() method was invoked.booleanisOpaque()Checks whether the component's background should be painted.booleanChecks to see if this component is owned by the given other component.booleanreturns true if pinch will block drag and dropbooleanIndicates whether the component displays the material design ripple effectfinal booleanisRTL()Is the component a bidi RTL componentstatic booleanChecks to see if this platform supports cursors.booleanIndicates whether scrolling this component should jump to a specific location in a gridprotected booleanReturns true if the component is interested in receiving drag/pointer release events even after the gesture exceeded its boundaries.booleanIndicates whether the component should "trigger" tactile touch when pressed by the user in a touch screen UI.protected booleanisTactileTouch(int x, int y) Elaborate components might not provide tactile feedback for all their areas (e.g. Lists) this method defaults to returning the value of isTactileTouchbooleanIndicates whether tensile drag (dragging beyond the boundry of the component and snapping back) is enabled for this component.final booleanChecks if this component should be traversable using the keyboard using tab, next, previous keys.booleanReturns whether the component is visible or notprotected voidlaidOut()This is a callback method to inform the Component when it's been laidout on the parent Containerprotected voidonScrollX(int scrollX) This method can be overriden to receive scroll events, unlike overriding setScrollX it will receive all calls for scrolling.protected voidonScrollY(int scrollY) This method can be overriden to receive scroll events, unlike overriding setScrollY it will receive all calls for scrolling.protected voidonSetFocusable(boolean focusable) Since setFocusable is final this callback is invoked when focusable changes.voidThis method paints all the parents Components Background.protected voidDraws the component border if such a border exists.protected voidDraws the component border background if such a border exists.final voidPaints this component as a root by going to all the parent components and setting the absolute translation based on coordinates and scroll status.final voidpaintComponent(Graphics g, boolean background) Paints this component as a root by going to all the parent components and setting the absolute translation based on coordinates and scroll status.voidPaints intersecting components that appear above this component.paintLock(boolean hardLock) This method locks the component so it will always paint the given image instead of running through its paint logic.voidReleases the paint lock image to allow paint to work as usual, see paintLock(boolean) for detailsvoidpaintRippleOverlay(Graphics g, int x, int y, int position) Invoked to draw the ripple effect overlay in Android where the finger of the user causes a growing circular overlay over time.protected voidPaints the UI for the scrollbar on the X axis, this method allows component subclasses to customize the look of a scrollbarprotected voidPaints the UI for the scrollbar on the Y axis, this method allows component subclasses to customize the look of a scrollbarvoidpaintShadows(Graphics g, int relativeX, int relativeY) Paints the drop-shadow projections for this component based on its elevation value.static DimensionparsePreferredSize(String preferredSize, Dimension baseSize) Parses the preferred size given as a stringprotected booleanpinch(float scale) Invoked by subclasses interested in handling pinch to zoom events, if true is returned other drag events will not be broadcastprotected booleanpinch(int[] x, int[] y) Invoked by subclasses interested in handling pinch to do their own actions based on the position of the two fingers, if true is returned other drag events will not be broadcastprotected voidpinchReleased(int x, int y) To be implemented by subclasses interested in being notified when a pinch zoom has ended (i.e the user has removed one of their fingers, but is still dragging).voidpointerPressed(int[] x, int[] y) If this Component is focused, the pointer pressed event will call this methodvoidpointerReleased(int[] x, int[] y) If this Component is focused, the pointer released event will call this methodvoidputClientProperty(String key, Object value) Client properties allow the association of meta-data with a component, this is useful for some applications that construct GUI's on the fly and need to track the connection between the UI and the data.voidMakes sure the component is up to date with the current theme, ONLY INVOKE THIS METHOD IF YOU CHANGED THE THEME!protected voidrefreshTheme(String id, boolean merge) Makes sure the component is up to date with the given UIIDvoidremove()This method will remove the Component from its parent.voidRemoves the listener from the drag finished eventvoidRemoves an action listener to drag over eventsvoidRemoves an action listener to drop events which are invoked when this component is dropped on a targetvoidDeregisters interest in receiving callbacks for focus gained eventsvoidRemoves the listener from the pointer eventvoidRemoves the listener from the pointer eventvoidRemoves the listener from the pointer eventvoidRemoves the listener from the pointer eventvoidDeregisters interest in receiving callbacks for scroll gained eventsvoidRemoves a listener from being notified when the state of this component is changed to and from initialized.voidrepaint()Repaint this Component, the repaint call causes a callback of the paint method on the event dispatch thread.voidrepaint(int x, int y, int w, int h) Repaints a specific region within the componentvoidChanges the current component to the focused component, will work only for a component that belongs to a parent form.protected voidRestores the state of the focusable flag to its default statebooleanChecks if the component responds to pointer events.voidscrollRectToVisible(int x, int y, int width, int height, Component coordinateSpace) Makes sure the component is visible in the scroll if this container is scrollableprotected voidscrollRectToVisible(Rectangle rect, Component coordinateSpace) Makes sure the component is visible in the scroll if this container is scrollablevoidsetAccessibilityText(String text) Sets the text that describes this component to assistive technologies.voidsetBlockLead(boolean blockLead) Prevent a lead component hierarchy from this specific component, this allows a component within that hierarchy to still act as a standalone componentvoidsetBoundPropertyValue(String prop, Object value) Sets the value of a bound property within this component, notice that this method MUST NOT fire the property change event when invoked to prevent recursion!voidsetCloudBoundProperty(String cloudBoundProperty) Indicates the property within this component that should be bound to the cloud objectvoidsetCloudDestinationProperty(String cloudDestinationProperty) The destination property of the CloudObjectvoidsetComponentState(Object state) If getComponentState returned a value the setter can update the value and restore the prior state.voidsetCursor(int cursor) Sets a custom mouse cursor for this component if the platform supports mouse cursors, notice that this isn't applicable for touch devices.static voidsetDefaultDragTransparency(byte defaultDragTransparency) Sets the default translucency of the#getDragImage()method.final voidsetDirtyRegion(Rectangle dirty) sets the Component dirty region, this method is for internal use only and SHOULD NOT be invoked by user code.voidsetDisabledStyle(Style style) Changes the Component disalbed Style by replacing the Component Style with the given StylevoidsetDraggable(boolean draggable) Indicates whether this component can be dragged in a drag and drop operation rather than scroll the parentvoidsetDragTransparency(byte dragTransparency) Sets the translucency of the#getDragImage()method.voidsetDropTarget(boolean dropTarget) Indicates whether this component can receive dropped components into it, notice that when dropping on a component or container the parents will be checked recursively to find a valid drop targetvoidsetEditingDelegate(Editable editable) Sets the editing delegate for this component.voidsetFlatten(boolean flatten) Makes the component effectively opaque by blending the backgrounds into an image in memory so the layer of underlying components is only drawn once when this component is repainted.voidsetFocus(boolean focused) This flag doesn't really give focus, its a state that determines what colors from the Style should be used when painting the component.final voidsetFocusable(boolean focusable) A simple setter to determine if this Component can get focusedvoidsetGrabsPointerEvents(boolean grabsPointerEvents) This property is useful for blocking in z-order touch events, sometimes we might want to grab touch events in a specific component without making it focusable.voidsetHandlesInput(boolean handlesInput) Prevents key events from being grabbed for focus traversal.voidsetHeight(int height) Sets the Component height, this method is exposed for the purpose of external layout managers and should not be invoked directly.voidsetHidden(boolean b) Makes the components preferred size equal 0 when hidden and restores it to the default size when not.voidsetHidden(boolean b, boolean changeMargin) Makes the components preferred size equal 0 when hidden and restores it to the default size when not.voidsetHideInLandscape(boolean hideInLandscape) Indicates that this component and all its children should be hidden when the device is switched to landscape modevoidsetHideInPortrait(boolean hideInPortrait) Indicates that this component and all its children should be hidden when the device is switched to portrait modevoidsetIgnorePointerEvents(boolean ignorePointerEvents) Parameters
protected voidsetInitialized(boolean initialized) Indicates if the component is in the initialized state, a component is initialized when its initComponent() method was invoked.voidsetInlineAllStyles(String styles) Registers inline styles that should be applied to all states of the component.voidsetInlineDisabledStyles(String styles) Registers inline styles that should be applied to the disabled state of the component.voidsetInlinePressedStyles(String styles) Registers inline styles that should be applied to the pressed state of the component.voidsetInlineSelectedStyles(String styles) Registers inline styles that should be applied to the selected state of the component.voidsetInlineStylesTheme(Resources inlineStylesTheme) Sets the theme that is used by inline styles to reference images.voidsetInlineUnselectedStyles(String styles) Registers inline styles that should be applied to the unselected state of the component.voidsetIsScrollVisible(boolean isScrollVisible) Set whether this component scroll is visiblevoidsetLabelForComponent(Label componentLabel) Allows us to indicate the label associated with this component thus providing visual feedback related for this component e.g.voidA component name allows us to easily identify the component within a dynamic UI.voidsetNextFocusDown(Component nextFocusDown) Allows us to determine which component will receive focus next when traversing with the down keyvoidsetNextFocusLeft(Component nextFocusLeft) Allows us to determine which component will receive focus next when traversing with the left key, this method doesn't affect the general focus behavior.voidsetNextFocusRight(Component nextFocusRight) Allows us to determine which component will receive focus next when traversing with the right keyvoidsetNextFocusUp(Component nextFocusUp) Allows us to determine which component will receive focus next when traversing with the up key, this method doesn't affect the general focus behavior.final voidsetOpaque(boolean opaque) Sets whether or not to paint the component background.voidSets the owner of this component to the specified component.voidsetPinchBlocksDragAndDrop(boolean block) If a component supports pinch as well as drag and drop the two may conflict (if one finger is placed a bit before the other, the drag timer will be initiated and may trigger drag even if the second finger has been placed before).voidsetPreferredH(int preferredH) Helper method to set the preferred height of the component.voidSets the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size.voidsetPreferredSizeStr(String value) Parameters
voidsetPreferredTabIndex(int index) Sets the preferred tab index of the component.voidsetPreferredW(int preferredW) Helper method to set the preferred width of the component.voidsetPressedStyle(Style style) Sets the Component Style for the pressed state allowing us to manipulate the look of the component when it is pressedvoidsetRippleEffect(boolean rippleEffect) Indicates whether the component displays the material design ripple effectstatic voidsetSameHeight(Component... c) Places all of these components in the same height group, to remove a component from the group invoke this method with that component only.static voidsetSameSize(Component... c) This is identical to invoking#sameWidthfollowed by#sameHeightstatic voidsetSameWidth(Component... c) Places all of these components in the same width group, to remove a component from the group invoke this method with that component only.voidsetScrollOpacityChangeSpeed(int scrollOpacityChangeSpeed) Indicates the decrement units for the scroll opacityvoidSet the size for the scroll areaprotected voidsetScrollX(int scrollX) Indicates the X position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.protected voidsetScrollY(int scrollY) Indicates the Y position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the y position of the component.voidsetSelectCommandText(String selectText) Allows determining the text for the select command used in the 3rd softbutton mode.voidsetSelectedStyle(Style style) Changes the Component selected Style by replacing the Component Style with the given StylevoidSets the Component size, this method is exposed for the purpose of external layout managers and should not be invoked directly.voidsetSnapToGrid(boolean snapToGrid) Indicates whether scrolling this component should jump to a specific location in a gridvoidsetTabIndex(int index) Sets the tab index of the component.voidsetTactileTouch(boolean tactileTouch) Indicates whether the component should "trigger" tactile touch when pressed by the user in a touch screen UI.voidsetTensileDragEnabled(boolean tensileDragEnabled) Indicates whether tensile drag (dragging beyond the boundry of the component and snapping back) is enabled for this component.voidsetTensileLength(int tensileLength) Recommended length for the tensile, -1 for defaultvoidsetTooltip(String tooltip) Parameters
final voidsetTraversable(boolean traversable) Sets whether this component is traversable using the keyboard using tab, next, previous keys.voidThis method sets the Component the Unique identifier.voidThis method sets the Component the Unique identifier.protected final voidsetUIIDFinal(String id) This method is the implementation of setUIID and is defined as final to allow invocation from constructors.voidsetUnselectedStyle(Style style) Changes the Component Style by replacing the Component Style with the given StylevoidsetWidth(int width) Sets the Component width, this method is exposed for the purpose of external layout managers and should not be invoked directly.voidsetX(int x) Sets the Component x location relative to the parent container, this method is exposed for the purpose of external layout managers and should not be invoked directly.voidsetY(int y) Sets the Component y location relative to the parent container, this method is exposed for the purpose of external layout managers and should not be invoked directly.protected booleanA component that might need side swipe such as the slider could block it from being used for some other purpose when on top of said component.protected booleanA component that might need side swipe such as the tabs could block it from being used for some other purpose when on top of said component.protected booleanA component that might need side swipe such as the tabs could block it from being used for some other purpose when on top of said component.protected booleanA component can indicate whether it is interested in rendering it's selection explicitly, this defaults to true in non-touch UI's and false in touch UI's except for the case where a user clicks the screen.protected voidCreates the native overlay for this component.voidIf the component#isEditable(), then this will start the editing process.Convenience method that strips margin and padding from the component, and returns itself for chaining.voidstyleChanged(String propertyName, Style source) Invoked to indicate a change in a propertyName of a StyletoImage()Returns the component as an image.toString()Overriden to return a useful value for debugging purposesvoidunbindProperty(String prop, BindTarget target) Removes a bind target from the given property nameprotected voidUpdates the native overlay for this component.booleanvisibleBoundsContains(int x, int y) Returns true if the given absolute coordinate is contained inside the visible bounds of the component.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Field Details
-
focusScrolling
protected boolean focusScrollingIndicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of Codename One.
-
-
Constructor Details
-
Form
public Form()Default constructor creates a simple form -
Form
Constructor that accepts a layout
Parameters
contentPaneLayout: the layout for the content pane
-
Form
Sets the title after invoking the constructor
Parameters
title: the form title
-
Form
-
-
Method Details
-
setAllowEnableLayoutOnPaint
public void setAllowEnableLayoutOnPaint(boolean allow) Enabling "layoutOnPaint" behaviour. Setting this flag to true will cause this form and all of its containers to lay themselves out whenever they are painted. This carries a performance penalty.
Historical Note: "layoutOnPaint" behaviour has been "on" since the original commit to Google code in 2012, but it isn't clear, now, why it was necessary. It was likely to fix an edge case in certain layouts that is no longer relevant. As of 7.0, we are disabling this behaviour by default because it carries such performance penalties, but allowing developers to opt-in to it using this method.
Parameters
allow: Whether to allow layoutOnPaint behaviour in this this form and it's containers.
Since
7.0
-
addPasteListener
Adds a listener to be notified when the user has initiated a paste event. This will primarily occur only on desktop devices which allow the user to initiate a paste outside the UI of the app itself, either using a key code (Command/Ctrl V), or a menu (Edit > Paste).
The event will be fired after the paste action has updated the clipboard contents, so you can access the clipboard contents via
Display#getPasteDataFromClipboard().Parameters
l: Listener registered to receive paste events.
Since
7.0
-
removePasteListener
Removes listener from being notified when the user has initiated a paste event.
Parameters
l: Listener to unregister to receive paste events.
Since
7.0
See also
- #addPasteListener(com.codename1.ui.events.ActionListener)
-
dispatchPaste
Fires a paste event to the paste listeners. For internal use.
Parameters
l: The paste event. Includes no useful data currently.
Since
7.0
See also
-
#addPasteListener(com.codename1.ui.events.ActionListener)
-
#removePasteListener(com.codename1.ui.events.ActionListener)
-
getTextSelection
Gets TextSelection support for this form.
Returns
The text selection support for this form.
Since
7.0
-
isEnableCursors
public boolean isEnableCursors()Checks if custom cursors are enabled on this form. They are turned off by default since they incur some overhead.
Returns
True if cursors are enabled on this form.
See also
-
#setEnableCursors(boolean)
-
Component#setCursor(int)
-
-
setEnableCursors
public void setEnableCursors(boolean e) Enable or disable custom cursors on this form. They are turned off by default since they incur some overhead.
Parameters
e: True to enable cursors. False to disable them.
See also
- Component#setCursor(int)
-
getSourceCommand
Gets the source command that was used to navigate to this form. This can be used to pass context information to the form.
Returns
The source command.
Since
7.0
-
setSourceCommand
Sets the source command that was used to navigate to this form. This can be used to pass context information to the form.
Parameters
sourceCommand: The source command.
Since
7.0
-
getCurrentInputDevice
Returns the current virtual input device in the form.
Returns
The current input device in the form.
See also
- #setCurrentInputDevice(com.codename1.ui.VirtualInputDevice)
-
setCurrentInputDevice
Sets the current virtual input device for the form. This will execute the
VirtualInputDevice#close()method of the current input device, and then set device as the new current input device.Some examples of virtual input devices are the Picker widget and the virtual keyboard.
Parameters
device
Throws
Exception
- Throws:
Exception
-
initGlobalToolbar
protected void initGlobalToolbar()Allows subclasses to disable the global toolbar for a specific form by overriding this method -
setOverrideInvisibleAreaUnderVKB
public void setOverrideInvisibleAreaUnderVKB(int invisibleAreaUnderVKB) Overrides the invisible area under the virtual keyboard with a given value. This is used by lightweight components to simulate the virtual keyboard, so that they will respect
#setFormBottomPaddingEditingMode(boolean).Warning: This setting is generally for internal use only, and should only be used if you know what you are doing. After setting this value to a non-negative value, it will override the "real" area under the VKB if the read VKB is shown.
To reset this after the lightweight component is hidden, set the value to -1.
Parameters
invisibleAreaUnderVKB: The area hidden by the VKB in pixels.
Since
8.0
-
getInvisibleAreaUnderVKB
public int getInvisibleAreaUnderVKB()In some virtual keyboard implementations (notably iOS) this value is used to determine the height of the virtual keyboard
Returns
height in pixels of the virtual keyboard
See also
- #setOverrideInvisibleAreaUnderVKB(int)
-
getAnimationManager
Returns the animation manager instance responsible for this form, this can be used to track/queue animations
Returns
the animation manager
- Overrides:
getAnimationManagerin classComponent
-
isFormBottomPaddingEditingMode
public boolean isFormBottomPaddingEditingMode()Toggles the way the virtual keyboard behaves, enabling this mode shrinks the screen but makes editing possible when working with text fields that aren't in a scrollable container.
Returns
true when this mode is enabled
-
setFormBottomPaddingEditingMode
public void setFormBottomPaddingEditingMode(boolean b) Toggles the way the virtual keyboard behaves, enabling this mode shrinks the screen but makes editing possible when working with text fields that aren't in a scrollable container.
Parameters
b: true to enable false to disable
-
getSafeArea
This method returns a rectangle defining the "safe" area of the display, which excludes areas on the screen that are covered by notches, task bars, rounded corners, etc.
This feature was primarily added to deal with the task bar on the iPhone X, which is displayed on the screen near the bottom edge, and can interfere with components that are laid out at the bottom of the screen.
Most platforms will simply return a Rectangle with bounds (0, 0, displayWidth, displayHeight). iPhone X will return a rectangle that excludes the notch, and task bar regions.
Returns
The safe area on which to draw.
Since
7.0
See also
-
CodenameOneImplementation#getDisplaySafeArea(com.codename1.ui.geom.Rectangle)
-
Container#setSafeArea(boolean)
-
Container#isSafeArea()
-
-
shouldPaintStatusBar
protected boolean shouldPaintStatusBar()This method returns the value of the theme constant
paintsTitleBarBooland it is invoked internally in the code. You can override this method to toggle the appearance of the status bar on a per-form basisReturns
the value of the
paintsTitleBarBooltheme constant -
createStatusBar
Subclasses can override this method to control the creation of the status bar component. Notice that this method will only be invoked if the paintsTitleBarBool theme constant is true which it is on iOS by default
Returns
a Component that represents the status bar if the OS requires status bar spacing
-
isAlwaysTensile
public boolean isAlwaysTensile()Enable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)
Returns
the alwaysTensile
- Overrides:
isAlwaysTensilein classComponent
-
setAlwaysTensile
public void setAlwaysTensile(boolean alwaysTensile) Enable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)
Parameters
alwaysTensile: the alwaysTensile to set
- Overrides:
setAlwaysTensilein classComponent
-
grabAnimationLock
public boolean grabAnimationLock()Allows grabbing a flag that is used by convention to indicate that you are running an exclusive animation. This is used by some code to prevent collision between optional animation
Returns
whether the lock was acquired or not
Deprecated
this is effectively invalidated by the newer animation framework
-
releaseAnimationLock
public void releaseAnimationLock()Invoke this to release the animation lock that was grabbed in grabAnimationLock
Deprecated
this is effectively invalidated by the newer animation framework
-
findCurrentlyEditingComponent
Returns the component on this form that is currently being edited, or null if no component is currently being edited.
Returns
The currently edited component on this form.
See also
- Component#isEditing()
-
getTitleArea
Title area manipulation might break with future changes to Codename One and might damage themeing/functionality of the Codename One application in some platforms
Returns
the container containing the title
Deprecated
-
getUIManager
Description copied from class:ContainerThis method should be used by the Component to retrieve the correct UIManager to work with
Returns
a UIManager instance
- Overrides:
getUIManagerin classContainer
-
setUIManager
Description copied from class:ContainerAllows replacing the UIManager in a component hierarchy to update the look and feel only to a specific hierarchy
Parameters
uiManager: UIManager instance
- Overrides:
setUIManagerin classContainer
-
addShowListener
This listener would be invoked when show is completed
Parameters
l: listener
-
removeShowListener
Removes the show listener
Parameters
l: the listener
-
removeAllShowListeners
public void removeAllShowListeners()Removes all Show Listeners from this Form -
addOrientationListener
This listener is invoked when device orientation changes on devices that support orientation change
Parameters
l: listener
-
removeOrientationListener
This listener is invoked when device orientation changes on devices that support orientation change
Parameters
l: the listener
-
addSizeChangedListener
This listener is invoked when device size is changed
Parameters
l: listener
-
removeSizeChangedListener
Remove SizeChangedListener
Parameters
l: the listener
-
hideNotify
protected void hideNotify()This method is only invoked when the underlying canvas for the form is hidden this method isn't called for form based events and is generally usable for suspend/resume based behavior -
showNotify
protected void showNotify()This method is only invoked when the underlying canvas for the form is shown this method isn't called for form based events and is generally usable for suspend/resume based behavior -
sizeChanged
protected void sizeChanged(int w, int h) This method is only invoked when the underlying canvas for the form gets a size changed event. This method will trigger a relayout of the Form. This method will get the callback only if this Form is the Current Form
Parameters
-
w: the new width of the Form -
h: the new height of the Form
-
-
setSafeAreaChanged
public void setSafeAreaChanged()Causes the display safe area to be recalculated the next time the form list laid out.
Since
7.0
See also
- #getSafeArea()
-
isDragRegion
public boolean isDragRegion(int x, int y) Indicates if the section within the X/Y area is a "drag region" where we expect people to drag and never actually "press" in which case we can instantly start dragging making perceived performance faster. This is invoked by the implementation code to optimize drag start behavior
Parameters
-
x: x location for the touch -
y: y location for the touch
Returns
true if the touch is in a region specifically designated as a "drag region"
Deprecated
this method was replaced by getDragRegionStatus
- Overrides:
isDragRegionin classComponent
-
-
getDragRegionStatus
public int getDragRegionStatus(int x, int y) Indicates if the section within the X/Y area is a "drag region" where we expect people to drag or press in which case we can instantly start dragging making perceived performance faster. This is invoked by the implementation code to optimize drag start behavior
Parameters
-
x: x location for the touch -
y: y location for the touch
Returns
one of the DRAG_REGION_* values
- Overrides:
getDragRegionStatusin classComponent
-
-
getGlassPane
Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations. This is useful for watermarks or special effects (such as tinting) it is also useful for generic drawing of validation errors etc... A glass pane is generally transparent or translucent and allows the the UI below to be seen.
The example shows a glasspane running on top of a field to show a validation hint, notice that for real world usage you should probably look into
com.codename1.ui.validation.ValidatorForm hi = new Form("Glass Pane", new BoxLayout(BoxLayout.Y_AXIS)); Style s = UIManager.getInstance().getComponentStyle("Label"); s.setFgColor(0xff0000); s.setBgTransparency(0); Image warningImage = FontImage.createMaterial(FontImage.MATERIAL_WARNING, s).toImage(); TextField tf1 = new TextField("My Field"); tf1.getAllStyles().setMarginUnit(Style.UNIT_TYPE_DIPS); tf1.getAllStyles().setMargin(5, 5, 5, 5); hi.add(tf1); hi.setGlassPane((g, rect) -> { int x = tf1.getAbsoluteX() + tf1.getWidth(); int y = tf1.getAbsoluteY(); x -= warningImage.getWidth() / 2; y += (tf1.getHeight() / 2 - warningImage.getHeight() / 2); g.drawImage(warningImage, x, y); }); hi.show();Returns
the instance of the glass pane for this form
See also
- com.codename1.ui.painter.PainterChain#installGlassPane(Form, com.codename1.ui.Painter)
-
setGlassPane
Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations. This is useful for watermarks or special effects (such as tinting) it is also useful for generic drawing of validation errors etc... A glass pane is generally transparent or translucent and allows the the UI below to be seen.
The example shows a glasspane running on top of a field to show a validation hint, notice that for real world usage you should probably look into
com.codename1.ui.validation.ValidatorForm hi = new Form("Glass Pane", new BoxLayout(BoxLayout.Y_AXIS)); Style s = UIManager.getInstance().getComponentStyle("Label"); s.setFgColor(0xff0000); s.setBgTransparency(0); Image warningImage = FontImage.createMaterial(FontImage.MATERIAL_WARNING, s).toImage(); TextField tf1 = new TextField("My Field"); tf1.getAllStyles().setMarginUnit(Style.UNIT_TYPE_DIPS); tf1.getAllStyles().setMargin(5, 5, 5, 5); hi.add(tf1); hi.setGlassPane((g, rect) -> { int x = tf1.getAbsoluteX() + tf1.getWidth(); int y = tf1.getAbsoluteY(); x -= warningImage.getWidth() / 2; y += (tf1.getHeight() / 2 - warningImage.getHeight() / 2); g.drawImage(warningImage, x, y); }); hi.show();Parameters
glassPane: @param glassPane a new glass pane to install. It is generally recommended to use a painter chain if more than one painter is required.
-
getTitleComponent
Allows modifying the title attributes beyond style (e.g. setting icon/alignment etc.)
Returns
the component representing the title for the form
-
setTitleComponent
Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.
Parameters
title: new title component
-
setTitleComponent
Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects. This version of the method allows special effects for title replacement such as transitions for title entering
Parameters
-
title: new title component -
t: transition for title replacement
-
-
addKeyListener
Add a key listener to the given keycode for a callback when the key is released
Parameters
-
keyCode: code on which to send the event -
listener: listener to invoke when the key code released.
-
-
removeKeyListener
Removes a key listener from the given keycode
Parameters
-
keyCode: code on which the event is sent -
listener: listener instance to remove
-
-
removeGameKeyListener
Removes a game key listener from the given game keycode
Parameters
-
keyCode: code on which the event is sent -
listener: listener instance to remove
-
-
addGameKeyListener
Add a game key listener to the given gamekey for a callback when the key is released
Parameters
-
keyCode: code on which to send the event -
listener: listener to invoke when the key code released.
-
-
getSoftButtonCount
public final int getSoftButtonCount()Returns the number of buttons on the menu bar for use with getSoftButton()
Returns
the number of softbuttons
-
getSoftButton
Returns the button representing the softbutton, this allows modifying softbutton attributes and behavior programmatically rather than by using the command API. Notice that this API behavior is fragile since the button mapped to a particular offset might change based on the command API
Parameters
offset: the offest of the softbutton
Returns
a button that can be manipulated
-
getMenuStyle
Returns the style of the menu
Returns
the style of the menu
-
getTitleStyle
Returns the style of the title
Returns
the style of the title
-
setTitleStyle
Sets the style of the title programmatically
Parameters
s: new style
Deprecated
this method doesn't take into consideration multiple styles
-
initLaf
-
getDefaultCommand
Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. Use with caution.
Returns
the command to treat as default
-
setDefaultCommand
Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. Use with caution.
Parameters
defaultCommand: the command to treat as default
-
getClearCommand
Indicates the command that is defined as the clear command in this form. A clear command can be used both to map to a "clear" hardware button if such a button exists.
Returns
the command to treat as the clear Command
-
setClearCommand
Indicates the command that is defined as the clear command in this form. A clear command can be used both to map to a "clear" hardware button if such a button exists.
Parameters
clearCommand: the command to treat as the clear Command
-
setBackCommand
Shorthand for
#setBackCommand(com.codename1.ui.Command)that dynamically creates the command usingcom.codename1.ui.Image, com.codename1.ui.events.ActionListener).Parameters
-
name: the name/title of the command -
icon: the icon for the command -
ev: the even handler
Returns
a newly created Command instance
-
-
getBackCommand
Indicates the command that is defined as the back command out of this form. A back command can be used both to map to a hardware button (e.g. on the Sony Ericsson devices) and by elements such as transitions etc. to change the behavior based on direction (e.g. slide to the left to enter screen and slide to the right to exit with back).
Returns
the command to treat as the back Command
-
setBackCommand
Indicates the command that is defined as the back command out of this form. A back command can be used both to map to a hardware button (e.g. on the Sony Ericsson devices) and by elements such as transitions etc. to change the behavior based on direction (e.g. slide to the left to enter screen and slide to the right to exit with back).
Parameters
backCommand: the command to treat as the back Command
-
getContentPane
This method returns the Content pane instance
Returns
a content pane instance
-
getLayeredPane
This method returns the layered pane of the Form, the layered pane is laid on top of the content pane and is created lazily upon calling this method the layer will be created. This is equivalent to getLayeredPane(null, false).
Returns
the LayeredPane
-
getLayeredPane
Returns the layered pane for the class and if one doesn't exist a new one is created dynamically and returned
Parameters
-
c: @param c the class with which this layered pane is associated, null for the global layered pane which is always on the bottom -
top: if created this indicates whether the layered pane should be added on top or bottom
Returns
the layered pane instance
-
-
getLayeredPane
Returns the layered pane for the class and if one doesn't exist a new one is created dynamically and returned
Parameters
-
c: @param c the class with which this layered pane is associated, null for the global layered pane which is always on the bottom -
zIndex: if created this indicates the zIndex at which the pane is placed. Higher z values in front of lower z values.
Returns
the layered pane instance
-
-
getFormLayeredPane
Returns the layered pane for the class and if one doesn't exist a new one is created dynamically and returned. This version of the method returns a layered pane on the whole form
Parameters
-
c: @param c the class with which this layered pane is associated, null for the global layered pane which is always on the bottom -
top: if created this indicates whether the layered pane should be added on top or bottom
Returns
the layered pane instance
-
-
getLayeredPaneIfExists
Gets the layered pane of the container without trying to create it. If
#getLayeredPane()hasn't been called yet for the form, then the layered pane will be null.Returns
The layered pane if it's been created - or null.
-
getFormLayeredPaneIfExists
Gets the form layered pane of the container without trying to create it. If
boolean)hasn't been called yet for the form, then the layered pane will be null.Returns
The layered pane if it's been created - or null.
-
removeAll
-
setBgImage
Sets the background image to show behind the form
Parameters
bgImage: the background image
Deprecated
Use the style directly
-
stopEditing
Stops any active editing on the form. Closes keyboard if it is opened.
Parameters
onFinish: Callback to run on finish.
- Specified by:
stopEditingin interfaceEditable- Overrides:
stopEditingin classComponent
-
isEditing
public boolean isEditing()Description copied from class:ComponentChecks if the component is currently being edited.
Returns
True if the component is currently being edited.
See also
-
#startEditingAsync()
-
#stopEditing(java.lang.Runnable)
-
#isEditable()
-
#getEditingDelegate()
-
#setEditingDelegate(com.codename1.ui.Editable)
-
-
getTitle
Returns the Form title text
Returns
returns the form title
-
setTitle
Sets the Form title to the given text
Parameters
title: the form title
-
addComponent
Adds Component to the Form's Content Pane
Parameters
cmp: the added param
- Overrides:
addComponentin classContainer
-
addComponent
Adds a Component to the Container
Parameters
-
constraints: @param constraints this method is useful when the Layout requires a constraint such as the BorderLayout. In this case you need to specify an additional data when you add a Component, such as "CENTER", "NORTH"... -
cmp: component to add
- Overrides:
addComponentin classContainer
-
-
addComponent
Adds a Component to the Container
Parameters
-
index: location to insert the Component -
constraints: @param constraints this method is useful when the Layout requires a constraint such as the BorderLayout. In this case you need to specify an additional data when you add a Component, such as "CENTER", "NORTH"... -
cmp: component to add
- Overrides:
addComponentin classContainer
-
-
addComponent
Adds Component to the Form's Content Pane
Parameters
cmp: the added param
- Overrides:
addComponentin classContainer
-
replace
This method replaces the current Component with the next Component. Current Component must be contained in this Container. This method return immediately.
Parameters
-
current: a Component to remove from the Container -
next: a Component that replaces the current Component -
t: @param t a Transition between the add and removal of the Components a Transition can be null
-
-
replaceAndWait
This method replaces the current Component with the next Component. Current Component must be contained in this Container. This method returns when transition has finished.
Parameters
-
current: a Component to remove from the Container -
next: a Component that replaces the current Component -
t: @param t a Transition between the add and removal of the Components a Transition can be null
- Overrides:
replaceAndWaitin classContainer
-
-
removeComponent
Removes a component from the Form's Content Pane
Parameters
cmp: the component to be removed
- Overrides:
removeComponentin classContainer
-
animateHierarchy
public void animateHierarchy(int duration) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation
Parameters
duration: the duration in milliseconds for the animation
- Overrides:
animateHierarchyin classContainer
-
animateHierarchyAndWait
public void animateHierarchyAndWait(int duration) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation. This method waits until the operation is completed before returning
Parameters
duration: the duration in milliseconds for the animation
- Overrides:
animateHierarchyAndWaitin classContainer
-
animateHierarchyFade
public void animateHierarchyFade(int duration, int startingOpacity) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation
Parameters
-
duration: the duration in milliseconds for the animation -
startingOpacity: the initial opacity to give to the animated components
- Overrides:
animateHierarchyFadein classContainer
-
-
animateHierarchyFadeAndWait
public void animateHierarchyFadeAndWait(int duration, int startingOpacity) Animates a pending hierarchy of components into place, this effectively replaces revalidate with a more visual form of animation. This method waits until the operation is completed before returning
Parameters
-
duration: the duration in milliseconds for the animation -
startingOpacity: the initial opacity to give to the animated components
- Overrides:
animateHierarchyFadeAndWaitin classContainer
-
-
animateLayout
public void animateLayout(int duration) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animation
See:
Form hi = new Form("Layout Animations", new BoxLayout(BoxLayout.Y_AXIS)); Button fall = new Button("Fall"); fall.addActionListener((e) -> { for(int iter = 0 ; iter < 10 ; iter++) { Label b = new Label ("Label " + iter); b.setWidth(fall.getWidth()); b.setHeight(fall.getHeight()); b.setY(-fall.getHeight()); hi.add(b); } hi.getContentPane().animateLayout(20000); }); hi.add(fall);Parameters
duration: the duration in milliseconds for the animation
- Overrides:
animateLayoutin classContainer
-
animateLayoutAndWait
public void animateLayoutAndWait(int duration) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animation. This method waits until the operation is completed before returning
Parameters
duration: the duration in milliseconds for the animation
- Overrides:
animateLayoutAndWaitin classContainer
-
animateLayoutFade
public void animateLayoutFade(int duration, int startingOpacity) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animation
Parameters
-
duration: the duration in milliseconds for the animation -
startingOpacity: the initial opacity to give to the animated components
- Overrides:
animateLayoutFadein classContainer
-
-
animateLayoutFadeAndWait
public void animateLayoutFadeAndWait(int duration, int startingOpacity) Animates a pending layout into place, this effectively replaces revalidate with a more visual form of animation. This method waits until the operation is completed before returning
Parameters
-
duration: the duration in milliseconds for the animation -
startingOpacity: the initial opacity to give to the animated components
- Overrides:
animateLayoutFadeAndWaitin classContainer
-
-
animateUnlayout
This method is the exact reverse of animateLayout, when completed it leaves the container in an invalid state. It is useful to invoke this in order to remove a component, transition to a different form or provide some other interaction. E.g.:
Form hi = new Form("Layout Animations", new BoxLayout(BoxLayout.Y_AXIS)); Button fall = new Button("Fall"); fall.addActionListener((e) -> { if(hi.getContentPane().getComponentCount() == 1) { fall.setText("Rise"); for(int iter = 0 ; iter { hi.removeAll(); hi.add(fall); hi.revalidate(); });*/ } }); hi.add(fall);Parameters
-
duration: the duration of the animation -
opacity: the opacity to which the layout will reach, allows fading out the components -
callback: if not null will be invoked when unlayouting is complete
- Overrides:
animateUnlayoutin classContainer
-
-
animateUnlayoutAndWait
public void animateUnlayoutAndWait(int duration, int opacity) This method is the exact reverse of animateLayoutAndWait, when completed it leaves the container in an invalid state. It is useful to invoke this in order to remove a component, transition to a different form or provide some other interaction. E.g.:
Form hi = new Form("Layout Animations", new BoxLayout(BoxLayout.Y_AXIS)); Button fall = new Button("Fall"); fall.addActionListener((e) -> { if(hi.getContentPane().getComponentCount() == 1) { fall.setText("Rise"); for(int iter = 0 ; iter { hi.removeAll(); hi.add(fall); hi.revalidate(); });*/ } }); hi.add(fall);Parameters
-
duration: the duration of the animation -
opacity: the opacity to which the layout will reach, allows fading out the components
- Overrides:
animateUnlayoutAndWaitin classContainer
-
-
hasMedia
public final boolean hasMedia()Used by the implementation to prevent flickering when flushing the double buffer
Returns
true if the form has media components within it
-
registerAnimated
The given component is interested in animating its appearance and will start receiving callbacks when it is visible in the form allowing it to animate its appearance. This method would not register a component instance more than once
Parameters
cmp: component that would be animated
-
onRegisterAnimated
Callback that's invoked by registerAnimated to let subclasses keep track of animation registration.
Parameters
cmp: component that would be animated
-
deregisterAnimated
Indicate that cmp would no longer like to receive animation events
Parameters
cmp: component that would no longer receive animation events
-
animate
public boolean animate()Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the
com.codename1.ui.Displayclass.Returns
true if a repaint is desired or false if no repaint is necessary
-
getSideGap
-
paintScrollbars
Description copied from class:ComponentPaints the UI for the scrollbars on the component, this will be invoked only for scrollable components. This method invokes the appropriate X/Y versions to do all the work.
Parameters
g: the component graphics
- Overrides:
paintScrollbarsin classComponent
-
refreshTheme
public void refreshTheme(boolean merge) Makes sure the component is up to date with the current theme, ONLY INVOKE THIS METHOD IF YOU CHANGED THE THEME!
Parameters
merge: indicates if the current styles should be merged with the new styles
- Overrides:
refreshThemein classContainer
-
paintBackground
Exposing the background painting for the benefit of animations
Parameters
g: the form graphics
- Overrides:
paintBackgroundin classComponent
-
getTransitionInAnimator
This property allows us to define a an animation that will draw the transition for entering this form. A transition is an animation that would occur when switching from one form to another.
Returns
the Form in transition
-
setTransitionInAnimator
This property allows us to define a an animation that will draw the transition for entering this form. A transition is an animation that would occur when switching from one form to another.
Parameters
transitionInAnimator: the Form in transition
-
getTransitionOutAnimator
This property allows us to define a an animation that will draw the transition for exiting this form. A transition is an animation that would occur when switching from one form to another.
Returns
the Form out transition
-
setTransitionOutAnimator
This property allows us to define a an animation that will draw the transition for exiting this form. A transition is an animation that would occur when switching from one form to another.
Parameters
transitionOutAnimator: the Form out transition
-
addCommandListener
A listener that is invoked when a command is clicked allowing multiple commands to be handled by a single block
Parameters
l: the command action listener
-
removeCommandListener
A listener that is invoked when a command is clicked allowing multiple commands to be handled by a single block
Parameters
l: the command action listener
-
actionCommand
Invoked to allow subclasses of form to handle a command from one point rather than implementing many command instances. All commands selected on the form will trigger this method implicitly.
Parameters
cmd: the form commmand object
-
dispatchCommand
Dispatches a command via the standard form mechanism of firing a command event
Parameters
-
cmd: The command to dispatch -
ev: the event to dispatch
-
-
show
public void show()Displays the current form on the screen -
showBack
public void showBack()Displays the current form on the screen, this version of the method is useful for "back" navigation since it reverses the direction of the transition. -
isSmoothScrolling
public boolean isSmoothScrolling()Indicates that scrolling through the component should work as an animation
Returns
whether this component use smooth scrolling
- Overrides:
isSmoothScrollingin classComponent
-
setSmoothScrolling
public void setSmoothScrolling(boolean smoothScrolling) Indicates that scrolling through the component should work as an animation
Parameters
smoothScrolling: indicates if a component uses smooth scrolling
- Overrides:
setSmoothScrollingin classComponent
-
getScrollAnimationSpeed
public int getScrollAnimationSpeed()Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode
Returns
scroll animation speed in milliseconds
- Overrides:
getScrollAnimationSpeedin classComponent
-
setScrollAnimationSpeed
public void setScrollAnimationSpeed(int animationSpeed) Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode
Parameters
animationSpeed: scroll animation speed in milliseconds
- Overrides:
setScrollAnimationSpeedin classComponent
-
onShow
protected void onShow()Allows subclasses to bind functionality that occurs when a specific form or dialog appears on the screen -
onShowCompleted
protected void onShowCompleted()Allows subclasses to bind functionality that occurs when a specific form or dialog is "really" showing hence when the transition is totally complete (unlike onShow which is called on intent). The necessity for this is for special cases like media that might cause artifacts if played during a transition. -
getComponentForm
Returns the Component Form or null if this Component is not added yet to a form
Returns
the Component Form
- Overrides:
getComponentFormin classComponent
-
getFocused
Returns the current focus component for this form
Returns
the current focus component for this form
-
setFocused
Sets the focused component and fires the appropriate events to make it so
Parameters
focused: the newly focused component or null for no focus
-
longKeyPress
protected void longKeyPress(int keyCode) If this Component is focused this method is invoked when the user presses and holds the key
Parameters
keyCode: the key code value to indicate a physical key.
- Overrides:
longKeyPressin classComponent
-
longPointerPress
public void longPointerPress(int x, int y) If this Component is focused this method is invoked when the user presses and holds the pointer on the Component- Overrides:
longPointerPressin classComponent
-
shouldSendPointerReleaseToOtherForm
protected boolean shouldSendPointerReleaseToOtherForm()Indicates whether this form wants to receive pointerReleased events for touch events that started in a different form
Returns
false by default
-
getNextComponent
Gets the next component in focus traversal order. This will return the
Component#getNextFocusRight()if it is set. If not, it will returnComponent#getNextFocusDown()if it is set. If not, it will return the next component according to the traversal order.Parameters
current: The current component.
Returns
The next component in the focus traversal order.
-
getPreviousComponent
Gets the previous component in focus traversal order. This will return the
Component#getNextFocusLeft()if it is set. If not, it will returnComponent#getNextFocusUp()if it is set. If not, it will return the previous component according to the traversal order defined byForm#getTabIterator(com.codename1.ui.Component).Parameters
current: The current component.
Returns
The previous component in the traversal order.
-
getTabIterator
Returns an iterator that iterates over all of the components in this form, ordered by their tab index.
Parameters
start: @param start The start position. The iterator will automatically initialized such thatListIterator#next()will return the next component in the traversal order, and theListIterator#previous()returns the previous component in traversal order.
Returns
An iterator for the traversal order of the components in this form.
See also
-
#getNextComponent(com.codename1.ui.Component)
-
#getPreviousComponent(com.codename1.ui.Component)
-
Component#getPreferredTabIndex()
-
Component#setPreferredTabIndex(int)
-
keyPressed
public void keyPressed(int keyCode) If this Component is focused, the key pressed event will call this method
Parameters
keyCode: the key code value to indicate a physical key.
- Overrides:
keyPressedin classContainer
-
getLayout
-
setLayout
-
isMinimizeOnBack
public boolean isMinimizeOnBack()When set to true the physical back button will minimize the application
Returns
the minimizeOnBack
-
setMinimizeOnBack
public void setMinimizeOnBack(boolean minimizeOnBack) When set to true the physical back button will minimize the application
Parameters
minimizeOnBack: the minimizeOnBack to set
-
keyReleased
public void keyReleased(int keyCode) If this Component is focused, the key released event will call this method
Parameters
keyCode: the key code value to indicate a physical key.
- Overrides:
keyReleasedin classContainer
-
keyRepeated
public void keyRepeated(int keyCode) If this Component is focused, the key repeat event will call this method.
Parameters
keyCode: the key code value to indicate a physical key.
- Overrides:
keyRepeatedin classComponent
-
resumeDragAfterScrolling
protected boolean resumeDragAfterScrolling(int x, int y) This method fixes this tensile drag issue. However, this might be undesireable in some cases and so this method can be overriden to return false in some cases.
Parameters
-
x: the x position of a pointer press operation -
y: the y position of a pointer press operation
Returns
true if drag should be resumed and false otherwise
-
-
pointerPressed
public void pointerPressed(int x, int y) If this Component is focused, the pointer pressed event will call this method
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerPressedin classContainer
-
-
addComponentAwaitingRelease
-
removeComponentAwaitingRelease
-
clearComponentsAwaitingRelease
public void clearComponentsAwaitingRelease() -
pointerDragged
public void pointerDragged(int x, int y) If this Component is focused, the pointer dragged event will call this method
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerDraggedin classComponent
-
-
pointerDragged
public void pointerDragged(int[] x, int[] y) Description copied from class:ComponentIf this Component is focused, the pointer dragged event will call this method
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerDraggedin classComponent
-
-
pointerHoverReleased
public void pointerHoverReleased(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerHoverReleasedin classComponent
-
-
pointerHoverPressed
public void pointerHoverPressed(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerHoverPressedin classComponent
-
-
pointerHover
public void pointerHover(int[] x, int[] y) Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerHoverin classComponent
-
-
isSingleFocusMode
public boolean isSingleFocusMode()Returns true if there is only one focusable member in this form. This is useful so setHandlesInput would always be true for this case.
Returns
true if there is one focusable component in this form, false for 0 or more
-
pointerReleased
public void pointerReleased(int x, int y) If this Component is focused, the pointer released event will call this method
Parameters
-
x: the pointer x coordinate -
y: the pointer y coordinate
- Overrides:
pointerReleasedin classComponent
-
-
isScrollVisible
public boolean isScrollVisible()Indicate whether this component scroll is visible
Returns
true is this component scroll is visible; otherwise false
- Overrides:
isScrollVisiblein classComponent
-
setScrollVisible
public void setScrollVisible(boolean isScrollVisible) Set whether this component scroll is visible
Parameters
isScrollVisible: Indicate whether this component scroll is visible
- Overrides:
setScrollVisiblein classComponent
-
getComponentIndex
Returns the Component index in the Container
Parameters
cmp: the component to search for
Returns
the Component index in the Container or -1 if not found
- Overrides:
getComponentIndexin classContainer
-
addCommand
Adds a command to the menu bar softkeys or into the menu dialog, this version of add allows us to place a command in an arbitrary location. This allows us to force a command into the softkeys when order of command addition can't be changed.
Parameters
-
cmd: the Form command to be added -
offset: position in which the command is added
Deprecated
Please use
Toolbar#addCommandToLeftBar(com.codename1.ui.Command)or similar methods -
-
getCommandCount
public int getCommandCount()A helper method to check the amount of commands within the form menu
Returns
the number of commands
Deprecated
Please use
Toolbar#getComponentCount()or similar methods -
getCommand
Returns the command occupying the given index
Parameters
index: offset of the command
Returns
the command at the given index
-
addCommand
Adds a command to the menu bar softkeys. The Commands are placed in the order they are added. If the Form has 1 Command it will be placed on the right. If the Form has 2 Commands the first one that was added will be placed on the right and the second one will be placed on the left. If the Form has more then 2 Commands the first one will stay on the left and a Menu will be added with all the remain Commands.
Parameters
cmd: the Form command to be added
Deprecated
Please use
Toolbar#addCommandToLeftBar(com.codename1.ui.Command)or similar methods -
removeCommand
Removes the command from the menu bar softkeys
Parameters
cmd: the Form command to be removed
-
findNextFocusVertical
This method returns the next focusable Component vertically
NOTE: This method does NOT make use of
Component#getNextFocusDown()orComponent#getNextFocusUp(). It simply finds the next focusable component on the form based solely on absolute Y coordinate.Parameters
down: @param down if true will the return the next focusable on the bottom else on the top
Returns
a focusable Component or null if not found
-
findNextFocusHorizontal
This method returns the next focusable Component horizontally
NOTE: This method does NOT make use of
Component#getNextFocusLeft()orComponent#getNextFocusRight(). It simply finds the next focusable component on the form based solely on absolute X coordinate.Parameters
right: @param right if true will the return the next focusable on the right else on the left
Returns
a focusable Component or null if not found
-
isCyclicFocus
public boolean isCyclicFocus()Indicates whether focus should cycle within the form
Returns
true if focus should cycle
-
setCyclicFocus
public void setCyclicFocus(boolean cyclicFocus) Indicates whether focus should cycle within the form
Parameters
cyclicFocus: marks whether focus should cycle
-
scrollComponentToVisible
Makes sure the component is visible in the scroll if this container is scrollable
Parameters
c: the componant to be visible
- Overrides:
scrollComponentToVisiblein classContainer
-
setMenuCellRenderer
Determine the cell renderer used to render menu elements for themeing the look of the menu options
Parameters
menuCellRenderer: the menu cell renderer
-
removeAllCommands
public void removeAllCommands()Clear menu commands from the menu bar -
setRTL
-
paint
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
Parameters
g: the component graphics
-
isScrollable
public boolean isScrollable()Indicates whether the component should/could scroll by default a component is not scrollable.
Returns
whether the component is scrollable
- Overrides:
isScrollablein classComponent
-
setScrollable
public void setScrollable(boolean scrollable) The equivalent of calling both setScrollableY and setScrollableX
Parameters
scrollable: @param scrollable whether the component should/could scroll on the X and Y axis
Deprecated
use setScrollableX and setScrollableY instead. This method is deprecated since it breeds confusion and is often misunderstood.
- Overrides:
setScrollablein classContainer
-
isScrollableX
public boolean isScrollableX()Indicates whether the component should/could scroll on the X axis
Returns
whether the component is scrollable on the X axis
- Overrides:
isScrollableXin classContainer
-
setScrollableX
public void setScrollableX(boolean scrollableX) Sets whether the component should/could scroll on the X axis
Parameters
scrollableX: whether the component should/could scroll on the X axis
- Overrides:
setScrollableXin classContainer
-
isScrollableY
public boolean isScrollableY()Indicates whether the component should/could scroll on the Y axis
Returns
whether the component is scrollable on the X axis
- Overrides:
isScrollableYin classContainer
-
setScrollableY
public void setScrollableY(boolean scrollableY) Sets whether the component should/could scroll on the Y axis
Parameters
scrollableY: whether the component should/could scroll on the Y axis
- Overrides:
setScrollableYin classContainer
-
setVisible
public void setVisible(boolean visible) Toggles visibility of the component
Parameters
visible: true if component is visible; otherwise false
- Overrides:
setVisiblein classComponent
-
getTintColor
public int getTintColor()Default color for the screen tint when a dialog or a menu is shown
Returns
the tint color when a dialog or a menu is shown
-
setTintColor
public void setTintColor(int tintColor) Default color for the screen tint when a dialog or a menu is shown
Parameters
tintColor: the tint color when a dialog or a menu is shown
-
setMenuTransitions
Sets the menu transitions for showing/hiding the menu, can be null...
Parameters
-
transitionIn: the transition that will play when the menu appears -
transitionOut: the transition that will play when the menu is folded
-
-
paramString
Returns a string representing the state of this component. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be
null.Returns
a string representation of this component's state
- Overrides:
paramStringin classContainer
-
getMenuBar
Returns the associated Menu Bar object
Returns
the associated Menu Bar object
-
setMenuBar
Sets the associated MenuBar Object.
Parameters
menuBar
-
setToolBar
Sets the Form Toolbar
Parameters
toolbar
Deprecated
use setToolbar instead (lower case b)
-
getToolbar
Gets the Form Toolbar if exists or null
Returns
the Toolbar instance or null if does not exists.
-
setToolbar
Sets the Form Toolbar
Parameters
toolbar
-
isFocusScrolling
public boolean isFocusScrolling()Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of Codename One.
Returns
the value of focusScrolling
-
setFocusScrolling
public void setFocusScrolling(boolean focusScrolling) Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of Codename One.
Parameters
focusScrolling: the new value for focus scrolling
-
getPropertyNames
A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code
Returns
the property names allowing mutation
- Overrides:
getPropertyNamesin classComponent
-
getPropertyTypes
Matches the property names method (see that method for further details).
Returns
the types of the properties
- Overrides:
getPropertyTypesin classComponent
-
getPropertyTypeNames
This method is here to workaround an XMLVM array type bug where property types aren't identified properly, it returns the names of the types using the following type names: String,int,double,long,byte,short,char,String[],String[][],byte[],Image,Image[],Object[],ListModel,ListCellRenderer
Returns
Array of type names
- Overrides:
getPropertyTypeNamesin classComponent
-
getPropertyValue
Returns the current value of the property name, this method is used by the GUI builder
Parameters
name: the name of the property
Returns
the value of said property
- Overrides:
getPropertyValuein classComponent
-
setPropertyValue
Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.
Parameters
-
name: the name of the property -
value: new value for the property
Returns
error message or null
- Overrides:
setPropertyValuein classComponent
-
-
getEditOnShow
A text component that will receive focus and start editing immediately as the form is shown
Returns
the component instance
-
setEditOnShow
A text component that will receive focus and start editing immediately as the form is shown
Parameters
editOnShow: text component to edit when the form is shown
-