📄 tablecanvas.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><!--NewPage--><html><head><!-- Generated by javadoc on Tue Nov 03 15:31:36 EST 1998 --><title> Class TableCanvas</title></head><body><a name="_top_"></a><h1> Class TableCanvas</h1><pre>java.lang.Object | +----java.awt.Component | +----java.awt.Container | +----java.awt.Panel | +----TableCanvas</pre><hr><dl> <dt> public class <b>TableCanvas</b> <dt> extends Panel</dl>This class creates a panel to display a table. It is only called from the <code>TablePanel</code> class which adds a scrollbar to the east of the table canvas. <p> This <code>TableCanvas</code> class should not have to be used manually. All its methods are redirected from the <code>TablePanel</code> class.<p><hr><a name="index"></a><h2> <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index"></h2><dl> <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o "> <a href="#TableCanvas(TablePanel)"><b>TableCanvas</b></a>(TablePanel) <dd> Constructor method of the <code>TableCanvas</code> class.</dl><h2> <img src="images/method-index.gif" width=207 height=38 alt="Method Index"></h2><dl> <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#addTableEntry(java.lang.Object, int)"><b>addTableEntry</b></a>(Object, int) <dd> Add an entry to the table and push the existing entries after this newly added object one position down. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#contains(java.lang.Object)"><b>contains</b></a>(Object) <dd> Check if the table contains a certain object specified by the parameter. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#drawBox(java.awt.Graphics, int, int, java.lang.String, java.awt.Color, java.awt.Color, int)"><b>drawBox</b></a>(Graphics, int, int, String, Color, Color, int) <dd> This method is only called by the <code>paint()</code> method to draw each entry of the table as a box. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#drawClusters(java.awt.Graphics, int, int)"><b>drawClusters</b></a>(Graphics, int, int) <dd> Display a status summary of the table regarding the percentage of the table being occupied, the number of clusters in the table, and a rough idea of the location of the table being occupied. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#full()"><b>full</b></a>() <dd> Check if the table has been fully filled up. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#getTableEntryAt(int)"><b>getTableEntryAt</b></a>(int) <dd> Obtain the object placed at the table row specified by the parameter. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#highlightRow(int)"><b>highlightRow</b></a>(int) <dd> Highlight the table entry with the row specified by the parameter. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#indexOf(java.lang.Object)"><b>indexOf</b></a>(Object) <dd> Get the location of an object in the table. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#init()"><b>init</b></a>() <dd> Initialize the table and set all entries to null. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#numOccupied()"><b>numOccupied</b></a>() <dd> Get the number of rows in the table where the contents are non-null object. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#occupied(int)"><b>occupied</b></a>(int) <dd> Check if a particular row in the table has a non-null object. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#paint(java.awt.Graphics)"><b>paint</b></a>(Graphics) <dd> Method to draw the table canvas. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#preferredSize()"><b>preferredSize</b></a>() <dd> Define the default size of the table. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#restoreRow()"><b>restoreRow</b></a>() <dd> This method is used to restore any highlighted row. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setStart(int)"><b>setStart</b></a>(int) <dd> Set the starting row, which will be displayed by the table. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setTableEntry(java.lang.Object, int)"><b>setTableEntry</b></a>(Object, int) <dd> Set the object specified by the first parameter to the table row defined by the second parameter. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#setTableSize(int)"><b>setTableSize</b></a>(int) <dd> This method is called to set the size of the table and hence rescale the scrollbar on the panel it resides in. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#tableSize()"><b>tableSize</b></a>() <dd> Get the maximum size of the table (including all null and non-null objects). <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o "> <a href="#update(java.awt.Graphics)"><b>update</b></a>(Graphics) <dd> This method is invoked by the display manager when the <code>repaint()</code> method of the panel is called.</dl><a name="constructors"></a><h2> <img src="images/constructors.gif" width=231 height=38 alt="Constructors"></h2><a name="TableCanvas"></a><a name="TableCanvas(TablePanel)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>TableCanvas</b><pre> public TableCanvas(<a href="TablePanel.html#_top_">TablePanel</a> parent)</pre><dl> <dd> Constructor method of the <code>TableCanvas</code> class.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> parent - The panel with a scrollbar where this table canvas is going to reside. </dl></dd></dl><a name="methods"></a><h2> <img src="images/methods.gif" width=151 height=38 alt="Methods"></h2><a name="init()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="init"><b>init</b></a><pre> public void init()</pre><dl> <dd> Initialize the table and set all entries to null.<p></dl><a name="setStart(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setStart"><b>setStart</b></a><pre> public void setStart(int start)</pre><dl> <dd> Set the starting row, which will be displayed by the table.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> start - The first row to be shown at any one time. </dl></dd></dl><a name="highlightRow(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="highlightRow"><b>highlightRow</b></a><pre> public void highlightRow(int i)</pre><dl> <dd> Highlight the table entry with the row specified by the parameter. There can only be one row highlighted at any one time. If a row has already been highlighted and this <code>highlightRow</code> method is called on another different row, the previously highlighted row will be restored and the new row will be highlighted.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> i - The row to be highlighted. </dl></dd></dl><a name="restoreRow()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="restoreRow"><b>restoreRow</b></a><pre> public void restoreRow()</pre><dl> <dd> This method is used to restore any highlighted row.<p></dl><a name="setTableSize(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setTableSize"><b>setTableSize</b></a><pre> public void setTableSize(int size)</pre><dl> <dd> This method is called to set the size of the table and hence rescale the scrollbar on the panel it resides in.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> size - The new size of this table. </dl></dd></dl><a name="setTableEntry(java.lang.Object, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setTableEntry"><b>setTableEntry</b></a><pre> public void setTableEntry(Object obj, int posn)</pre><dl> <dd> Set the object specified by the first parameter to the table row defined by the second parameter.<p> <dd><dl> <dt> <b>Parameters:</b> <dd> obj - The object to be added to the table. <dd> posn - The row number where the object is going to be added.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -