component.html

来自「维信SDK文档。源码要求为至少5个C或Java源码」· HTML 代码 · 共 1,304 行 · 第 1/4 页

HTML
1,304
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_11) on Tue Oct 23 19:38:41 EEST 2007 --><TITLE>Component (Widsets API)</TITLE><META NAME="keywords" CONTENT="Component class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="Component (Widsets API)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../widsets/api/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../widsets/api/Comparator.html" title="interface in "><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../widsets/api/Config.html" title="class in "><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html?widsets/api/Component.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="Component.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1"></FONT><BR>Class Component</H2><PRE>  <IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../widsets/api/Object.html" title="class in ">Object</A>      <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>Component</B></PRE><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../widsets/api/Camera.html" title="class in ">Camera</A>, <A HREF="../../widsets/api/Canvas.html" title="class in ">Canvas</A>, <A HREF="../../widsets/api/Flow.html" title="class in ">Flow</A>, <A HREF="../../widsets/api/HyperText.html" title="class in ">HyperText</A>, <A HREF="../../widsets/api/Label.html" title="class in ">Label</A>, <A HREF="../../widsets/api/Picture.html" title="class in ">Picture</A>, <A HREF="../../widsets/api/Progress.html" title="class in ">Progress</A>, <A HREF="../../widsets/api/Scrollable.html" title="class in ">Scrollable</A>, <A HREF="../../widsets/api/Shell.html" title="class in ">Shell</A>, <A HREF="../../widsets/api/Text.html" title="class in ">Text</A></DD></DL><HR><DL><DT><PRE>       class <B>Component</B><DT>extends <A HREF="../../widsets/api/Object.html" title="class in ">Object</A></DL></PRE><P><p> Component is base class for user interface elements. Most of the access methods are available through this class even if the actual instance might not  support them. Rationale for this is to improve the usability of API so that need for explicit casting is minimized. </p>  <p> Every component has flags that define some basic properties of it and the way other components are positioned inside it.   The existing flags are: <ul>   <li><A HREF="../../widsets/api/API.html#VISIBLE"><CODE>VISIBLE</CODE></A> - visible or not   <li><A HREF="../../widsets/api/API.html#FOCUSABLE"><CODE>FOCUSABLE</CODE></A> - can the user or UI focus to the element.   <li><A HREF="../../widsets/api/API.html#LINEFEED"><CODE>LINEFEED</CODE></A> - no more components will appear on the same     horizontal height on the right side   <li><A HREF="../../widsets/api/API.html#WRAP"><CODE>WRAP</CODE></A> - When components are set horizontally one after      another any component that won't fit on that line will be      placed on the next line. </ul> </p><P><P><HR><P><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../widsets/api/Component.html#Component(Style)">Component</A></B>(<A HREF="../../widsets/api/Style.html" title="class in ">Style</A>&nbsp;style)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new component with the specified style.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#add(Component)">add</A></B>(<A HREF="../../widsets/api/Component.html" title="class in ">Component</A>&nbsp;child)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds the given component to end of this container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#appendText(String)">appendText</A></B>(<A HREF="../../widsets/api/String.html" title="class in ">String</A>&nbsp;text)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the more text into <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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#clear()">clear</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears all children from container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#find(Object)">find</A></B>(<A HREF="../../widsets/api/Object.html" title="class in ">Object</A>&nbsp;data)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Searches for component with matching data attachment.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#first()">first</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the first component on container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#get(int)">get</A></B>(int&nbsp;index)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the component at the specified index.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getAction()">getAction</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the explicit "fire" action associated with this component.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Object.html" title="class in ">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getData()">getData</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the data attachment associated with this component.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getElement(String)">getElement</A></B>(<A HREF="../../widsets/api/String.html" title="class in ">String</A>&nbsp;name)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns named component from View.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getFlags()">getFlags</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the current flags of this component</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Image.html" title="class in ">Image</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getImage()">getImage</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;  int,&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getLocation()">getLocation</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the coordinate of component.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getParent()">getParent</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the parent component.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Shell.html" title="class in ">Shell</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getShell()">getShell</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the root Shell of component tree.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;  int,&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getSize()">getSize</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the realized width and height of this Component.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Style.html" title="class in ">Style</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getStyle()">getStyle</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the current style of this component.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/String.html" title="class in ">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getText()">getText</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Scrollable.html" title="class in ">Scrollable</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#getViewPort()">getViewPort</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Searches for <A HREF="../../widsets/api/Scrollable.html" title="class in "><CODE>Scrollable</CODE></A> among the parents of this Component.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#hasLinefeed()">hasLinefeed</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return the current state of <code>LINEFEED</code> flag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#indexOf(Component)">indexOf</A></B>(<A HREF="../../widsets/api/Component.html" title="class in ">Component</A>&nbsp;child)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index of specified child in container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../widsets/api/Component.html" title="class in ">Component</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../widsets/api/Component.html#insert(int, Component)">insert</A></B>(int&nbsp;index,       <A HREF="../../widsets/api/Component.html" title="class in ">Component</A>&nbsp;child)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Inserts the given component to specified index in this container.</TD></TR>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?