component.html
来自「维信SDK文档。源码要求为至少5个C或Java源码」· HTML 代码 · 共 1,304 行 · 第 1/4 页
HTML
1,304 行
<PRE> boolean <B>hasLinefeed</B>()</PRE><DL><DD>Return the current state of <code>LINEFEED</code> flag.<P><DD><DL><DT><B>See Also:</B><DD><A HREF="../../widsets/api/API.html#LINEFEED"><CODE>LINEFEED</CODE></A></DL></DD></DL><HR><A NAME="isVisible()"><!-- --></A><H3>isVisible</H3><PRE> boolean <B>isVisible</B>()</PRE><DL><DD>Return the current state of <code>VISIBLE</code> flag.<P><DD><DL><DT><B>See Also:</B><DD><A HREF="../../widsets/api/API.html#VISIBLE"><CODE>VISIBLE</CODE></A></DL></DD></DL><HR><A NAME="isFocusable()"><!-- --></A><H3>isFocusable</H3><PRE> boolean <B>isFocusable</B>()</PRE><DL><DD>Return the current state of <code>FOCUSABLE</code> flag.<P><DD><DL><DT><B>See Also:</B><DD><A HREF="../../widsets/api/API.html#FOCUSABLE"><CODE>FOCUSABLE</CODE></A></DL></DD></DL><HR><A NAME="isWrapping()"><!-- --></A><H3>isWrapping</H3><PRE> boolean <B>isWrapping</B>()</PRE><DL><DD>Return the current state of <code>WRAP</code> flag.<P><DD><DL><DT><B>See Also:</B><DD><A HREF="../../widsets/api/API.html#WRAP"><CODE>WRAP</CODE></A></DL></DD></DL><HR><A NAME="getFlags()"><!-- --></A><H3>getFlags</H3><PRE> int <B>getFlags</B>()</PRE><DL><DD>Return the current flags of this component<P><DD><DL><DT><B>Returns:</B><DD>flags<DT><B>See Also:</B><DD><A HREF="../../widsets/api/API.html#VISIBLE"><CODE>VISIBLE</CODE></A>, <A HREF="../../widsets/api/API.html#FOCUSABLE"><CODE>FOCUSABLE</CODE></A>, <A HREF="../../widsets/api/API.html#LINEFEED"><CODE>LINEFEED</CODE></A>, <A HREF="../../widsets/api/API.html#WRAP"><CODE>WRAP</CODE></A></DL></DD></DL><HR><A NAME="getText()"><!-- --></A><H3>getText</H3><PRE> <A HREF="../../widsets/api/String.html" title="class in ">String</A> <B>getText</B>()</PRE><DL><DD>Return the current text of <A HREF="../../widsets/api/Label.html" title="class in "><CODE>Label</CODE></A>, <A HREF="../../widsets/api/Text.html" title="class in "><CODE>Text</CODE></A> or <A HREF="../../widsets/api/Input.html" title="class in "><CODE>Input</CODE></A> component. Returns <code>null</code> for all other components.<P><DD><DL><DT><B>Returns:</B><DD>Current text or <code>null</code><DT><B>See Also:</B><DD><A HREF="../../widsets/api/Label.html" title="class in "><CODE>Label</CODE></A>, <A HREF="../../widsets/api/Text.html" title="class in "><CODE>Text</CODE></A>, <A HREF="../../widsets/api/Input.html" title="class in "><CODE>Input</CODE></A></DL></DD></DL><HR><A NAME="getImage()"><!-- --></A><H3>getImage</H3><PRE> <A HREF="../../widsets/api/Image.html" title="class in ">Image</A> <B>getImage</B>()</PRE><DL><DD>Return the current image of <A HREF="../../widsets/api/Label.html" title="class in "><CODE>Label</CODE></A> or <A HREF="../../widsets/api/Picture.html" title="class in "><CODE>Picture</CODE></A> component. Returns <code>null</code> for all other components.<P><DD><DL><DT><B>Returns:</B><DD>Current image or <code>null</code><DT><B>See Also:</B><DD><A HREF="../../widsets/api/Label.html" title="class in "><CODE>Label</CODE></A>, <A HREF="../../widsets/api/Picture.html" title="class in "><CODE>Picture</CODE></A></DL></DD></DL><HR><A NAME="setStyle(Style)"><!-- --></A><H3>setStyle</H3><PRE> <A HREF="../../widsets/api/Component.html" title="class in ">Component</A> <B>setStyle</B>(<A HREF="../../widsets/api/Style.html" title="class in ">Style</A> style)</PRE><DL><DD>Sets the style of this Component. Changing the style does not automatically repaint Component.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>style</CODE> - New style<DT><B>See Also:</B><DD><A HREF="../../widsets/api/Component.html#getStyle()"><CODE>getStyle()</CODE></A>, <A HREF="../../widsets/api/Component.html#repaint(boolean)"><CODE>repaint(boolean)</CODE></A>, <A HREF="../../widsets/api/API.html#flushScreen(boolean)"><CODE>flushScreen(boolean)</CODE></A></DL></DD></DL><HR><A NAME="setData(Object)"><!-- --></A><H3>setData</H3><PRE> <A HREF="../../widsets/api/Component.html" title="class in ">Component</A> <B>setData</B>(<A HREF="../../widsets/api/Object.html" title="class in ">Object</A> data)</PRE><DL><DD>Sets the data attachment to this component. Data attachment can be used to store state/context information.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>data</CODE> - data attachment<DT><B>Returns:</B><DD>this Component instance<DT><B>See Also:</B><DD><A HREF="../../widsets/api/Component.html#getData()"><CODE>getData()</CODE></A></DL></DD></DL><HR><A NAME="setAction(int)"><!-- --></A><H3>setAction</H3><PRE> <A HREF="../../widsets/api/Component.html" title="class in ">Component</A> <B>setAction</B>(int action)</PRE><DL><DD>Sets the explicit "fire" action. Only meaningful if component has <code>FOCUSABLE</code> flag set.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>action</CODE> - Fire action<DT><B>See Also:</B><DD><A HREF="../../widsets/api/Component.html#getAction()"><CODE>getAction()</CODE></A>, <A HREF="../../widsets/api/API.html#FOCUSABLE"><CODE>FOCUSABLE</CODE></A></DL></DD></DL><HR><A NAME="setFlags(int)"><!-- --></A><H3>setFlags</H3><PRE> <A HREF="../../widsets/api/Component.html" title="class in ">Component</A> <B>setFlags</B>(int flags)</PRE><DL><DD>Sets the flags of this component. This method will override current flags with new one.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>flags</CODE> - Flags to set<DT><B>Returns:</B><DD>this component<DT><B>See Also:</B><DD><A HREF="../../widsets/api/API.html#VISIBLE"><CODE>VISIBLE</CODE></A>, <A HREF="../../widsets/api/API.html#FOCUSABLE"><CODE>FOCUSABLE</CODE></A>, <A HREF="../../widsets/api/API.html#LINEFEED"><CODE>LINEFEED</CODE></A>, <A HREF="../../widsets/api/API.html#WRAP"><CODE>WRAP</CODE></A></DL></DD></DL><HR><A NAME="setPreferredWidth(int)"><!-- --></A><H3>setPreferredWidth</H3><PRE> <A HREF="../../widsets/api/Component.html" title="class in ">Component</A> <B>setPreferredWidth</B>(int width)</PRE><DL><DD>Sets the preferred width of this Component. Width can be: <ul> <li><code>1..</code> : Absolute width <li><code>0</code> : Optimal width, calculated automatically <li><code>-100..-1</code>: Relative width (1%..100%), calculated from available space </ul><P><DD><DL><DT><B>Parameters:</B><DD><CODE>width</CODE> - desired width<DT><B>Returns:</B><DD>this Component<DT><B>See Also:</B><DD><A HREF="../../widsets/api/Component.html#setPreferredHeight(int)"><CODE>setPreferredHeight(int)</CODE></A>, <A HREF="../../widsets/api/Component.html#setPreferredSize(int, int)"><CODE>setPreferredSize(int, int)</CODE></A>, <A HREF="../../widsets/api/Component.html#getSize()"><CODE>getSize()</CODE></A></DL></DD></DL><HR><A NAME="setPreferredHeight(int)"><!-- --></A><H3>setPreferredHeight</H3><PRE> <A HREF="../../widsets/api/Component.html" title="class in ">Component</A> <B>setPreferredHeight</B>(int height)</PRE><DL><DD>Sets the preferred height of this Component. Width can be: <ul> <li><code>1..</code> : Absolute height <li><code>0</code> : Optimal height, calculated automatically <li><code>-100..-1</code>: Relative height (1%..100%), calculated from available space </ul><P><DD><DL><DT><B>Parameters:</B><DD><CODE>height</CODE> - desired height<DT><B>Returns:</B><DD>this Component<DT><B>See Also:</B><DD><A HREF="../../widsets/api/Component.html#setPreferredWidth(int)"><CODE>setPreferredWidth(int)</CODE></A>, <A HREF="../../widsets/api/Component.html#setPreferredSize(int, int)"><CODE>setPreferredSize(int, int)</CODE></A>, <A HREF="../../widsets/api/Component.html#getSize()"><CODE>getSize()</CODE></A></DL></DD></DL><HR><A NAME="setPreferredSize(int, int)"><!-- --></A><H3>setPreferredSize</H3><PRE> <A HREF="../../widsets/api/Component.html" title="class in ">Component</A> <B>setPreferredSize</B>(int width, int height)</PRE><DL><DD>Sets preferred width and height for this Component.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>width</CODE> - desired width<DD><CODE>height</CODE> - desired height<DT><B>See Also:</B><DD><A HREF="../../widsets/api/Component.html#setPreferredWidth(int)"><CODE>setPreferredWidth(int)</CODE></A>, <A HREF="../../widsets/api/Component.html#setPreferredHeight(int)"><CODE>setPreferredHeight(int)</CODE></A></DL></DD></DL><HR><A NAME="getSize()"><!-- --></A><H3>getSize</H3><PRE> int, int <B>getSize</B>()</PRE><DL><DD>Returns the realized width and height of this Component. The values are available only after the layout has been computed.<P><DD><DL><DT><B>Returns:</B><DD><code>(int width, int height)</code> tuple.</DL></DD></DL><HR><A NAME="getLocation()"><!-- --></A><H3>getLocation</H3><PRE> int, int <B>getLocation</B>()</PRE><DL><DD>Returns the coordinate of component. Values returned might not represent actual screen coordinates if the Component is placed inside scrollable container.<P><DD><DL><DT><B>Returns:</B><DD><code>(int x, int y)</code> tuple.</DL></DD></DL><HR><A NAME="size()"><!-- --></A><H3>size</H3><PRE> int <B>size</B>()</PRE><DL><DD>Returns the number of children in container. Containers are <A HREF="../../widsets/api/Flow.html" title="class in "><CODE>Flow</CODE></A>, <A HREF="../../widsets/api/Scrollable.html" title="class in "><CODE>Scrollable</CODE></A> and <A HREF="../../widsets/api/Shell.html" title="class in "><CODE>Shell</CODE></A>.<P><DD><DL><DT><B>Returns:</B><DD>Number of children.<DT><B>See Also:</B><DD><A HREF="../../widsets/api/Flow.html" title="class in "><CODE>Flow</CODE></A>, <A HREF="../../widsets/api/Scrollable.html" title="class in "><CODE>Scrollable</CODE></A>, <A HREF="../../widsets/api/Shell.html" title="class in "><CODE>Shell</CODE></A></DL></DD></DL><HR><A NAME="indexOf(Component)"><!-- --></A><H3>indexOf</H3><PRE> int <B>indexOf</B>(<A HREF="../../widsets/api/Component.html" title="class in ">Component</A> child)</PRE><DL><DD>Returns the index of specified child in container. This method uses pointer check to determine the equality.<P><DD><DL><DT><B>Returns:</B><DD>Index, or <code>-1</code> if child was not found</DL></DD></DL><HR><A NAME="clear()"><!-- --></A><H3>clear</H3><PRE> void <B>clear</B>()</PRE><DL><DD>Clears all children from container. Only applicable to <A HREF="../../widsets/api/Flow.html" title="class in "><CODE>Flow</CODE></A> component.<P><DD><DL></DL></DD></DL><HR><A NAME="repaint(boolean)"><!-- --></A><H3>repaint</H3><PRE> void <B>repaint</B>(boolean refreshLayout)</PRE><DL><DD>Adds this component is repaint queue. Repaint queue is handled automatically if this method called inside handling of following callbacks: <ul> <li><A HREF="../../widsets/api/Script.html#keyAction(Component, int, int)"><CODE>Script.keyAction(Component, int, int)</CODE></A> <li><A HREF="../../widsets/api/Script.html#actionPerformed(Shell, Component, int)"><CODE>Script.actionPerformed(Shell, Component, int)</CODE></A> <li><A HREF="../../widsets/api/Script.html#getMenu(Shell, Component)"><CODE>Script.getMenu(Shell, Component)</CODE></A> <li><A HREF="../../widsets/api/Script.html#getSoftKey(Shell, Component, int)"><CODE>Script.getSoftKey(Shell, Component, int)</CODE></A> <li><A HREF="../../widsets/api/Script.html#openWidget()"><CODE>Script.openWidget()</CODE></A> <li><A HREF="../../widsets/api/Script.html#paint(Component, Graphics, Style, int, int)"><CODE>Script.paint(Component, Graphics, Style, int, int)</CODE></A> </ul> <p> Otherwise handling is requested with <A HREF="../../widsets/api/API.html#flushScreen(boolean)"><CODE>flushScreen(boolean)</CODE></A> method. Queue is optimized so that no Component is repainted twice.<P>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?