⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tablepanel.html

📁 关于用java实现的程序
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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 TablePanel</title></head><body><a name="_top_"></a><h1>  Class TablePanel</h1><pre>java.lang.Object   |   +----java.awt.Component           |           +----java.awt.Container                   |                   +----java.awt.Panel                           |                           +----TablePanel</pre><hr><dl>  <dt> public class <b>TablePanel</b>  <dt> extends Panel  <dt> implements <a href="DrawingObj.html#_top_">DrawingObj</a></dl>This class creates a panel with a table canvas and a vertical scrollbar to the east of the canvas. Most of its methods are simply directing the method calls to the table canvas (instance of class <code>TableCanvas</code>) with methods of the same name (polymorphism). <p> Since this class is of type <code>java.awt.Panel</code> and the drawing panel is also of the same type, the layout manager of the drawing panel (<code>DrawingPanel</code>) has to be disabled prior to adding this table panel. <p> The way of adding the table panel to a drawing panel is similar to adding a histogram (they are of similar nature - both inheriting from <code>java.awt.Panel</code>). <p> The following line of codes can be used as an example to add a table panel to a drawing panel: <code><pre>	TablePanel table = new TablePanel(max_table_size);	drawingPanel.setLayout(null);	drawingPanel.add(table);	table.setDrawingPanel(drawingPanel);	table.reshape(x, y, width, height); </pre></code> <code>drawingPanel</code> is an instance of class <code>DrawingPanel</code> which is normally obtained by calling the <code>getDrawingPanel()</code>  method from an instance of the <code>AlgAnimFrame</code> class: <code><pre> 	drawingPanel = frame.getDrawingPanel(); </pre></code> where <code>frame</code> is the instance of the <code>AlgAnimFrame</code> class.<p><dl>    <dt> <b>See Also:</b>    <dd> <a href="TableCanvas.html#_top_">TableCanvas</a>, <a href="Histogram.html#_top_">Histogram</a></dl><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="#TablePanel(int)"><b>TablePanel</b></a>(int)  <dd>  Create a panel with a table canvas and a scrollbar to the east of the table canvas.</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>  Pass the method call to the corresponding <code>TableCanvas</code>, which 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>  Pass the method call to the corresponding <code>TableCanvas</code>, which checks 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="#delay()"><b>delay</b></a>()  <dd>  This method causes a delay of 200msec.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#draw(java.awt.Graphics)"><b>draw</b></a>(Graphics)  <dd>  Simply call the <code>repaint()</code> method of the table panel.  <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>  Pass the method call to the corresponding <code>TableCanvas</code>.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#full()"><b>full</b></a>()  <dd>  Pass the method call to the corresponding <code>TableCanvas</code>, which checks 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>  Pass the method call to the corresponding <code>TableCanvas</code>, which obtains 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="#getX()"><b>getX</b></a>()  <dd>  Get the left most position of the table panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getY()"><b>getY</b></a>()  <dd>  Get the top most position of the table panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#handleEvent(java.awt.Event)"><b>handleEvent</b></a>(Event)  <dd>  The main purpose of this method is to handle the scrollbar event.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#highlightRow(int)"><b>highlightRow</b></a>(int)  <dd>  Pass the method call to the corresponding <code>TableCanvas</code>, which highlights 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>  Pass the method call to the corresponding <code>TableCanvas</code>, which gets 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(int)"><b>init</b></a>(int)  <dd>  Set the size of the table and rescale the scrollbar governing the table.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#numOccupied()"><b>numOccupied</b></a>()  <dd>  Pass the method call to the corresponding <code>TableCanvas</code>, which gets the number of rows in the table where the contents are non-null objects.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#occupied(int)"><b>occupied</b></a>(int)  <dd>  Pass the method call to the corresponding <code>TableCanvas</code>, which checks 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="#restoreRow()"><b>restoreRow</b></a>()  <dd>  Pass the method call to the corresponding <code>TableCanvas</code>, which restores any highlighted row.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#scroll2posn(int)"><b>scroll2posn</b></a>(int)  <dd>  Scroll the display window of the table to shown the row specified by the parameter.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#setDrawingPanel(DrawingPanel)"><b>setDrawingPanel</b></a>(DrawingPanel)  <dd>  Set the parent panel where this table panel is going to reside.  <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>  Pass the method call to the corresponding <code>TableCanvas</code>, which sets 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>  Pass the method call to the corresponding <code>TableCanvas</code>, which sets the size of the table and hence rescale the scrollbar.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#tableSize()"><b>tableSize</b></a>()  <dd>  Pass the method call to the corresponding <code>TableCanvas</code>, which gets the maximum size of the table.</dl><a name="constructors"></a><h2>  <img src="images/constructors.gif" width=231 height=38 alt="Constructors"></h2><a name="TablePanel"></a><a name="TablePanel(int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>TablePanel</b><pre> public TablePanel(int max_elem)</pre><dl>  <dd> Create a panel with a table canvas and a scrollbar to the east of the table canvas. The maximum size of the table is initialized according to the parameter of this constructor.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> max_elem - The maximum size of the table.  </dl></dd></dl><a name="methods"></a><h2>  <img src="images/methods.gif" width=151 height=38 alt="Methods"></h2><a name="init(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="init"><b>init</b></a><pre> public void init(int max_size)</pre><dl>  <dd> Set the size of the table and rescale the scrollbar governing the table. This method calls the method with the same name in <code>TableCanvas</code>.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> max_size - The maximum size of the table.  </dl></dd></dl><a name="draw(java.awt.Graphics)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="draw"><b>draw</b></a><pre> public void draw(Graphics g)</pre><dl>  <dd> Simply call the <code>repaint()</code> method of the table panel.<p></dl><a name="getX()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getX"><b>getX</b></a><pre> public int getX()</pre><dl>  <dd> Get the left most position of the table panel.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> The left most position of the table panel.  </dl></dd></dl><a name="getY()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getY"><b>getY</b></a><pre> public int getY()</pre><dl>  <dd> Get the top most position of the table panel.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> The top most position of the table panel.  </dl></dd></dl><a name="full()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="full"><b>full</b></a><pre> public boolean full()</pre><dl>  <dd> Pass the method call to the corresponding <code>TableCanvas</code>, which checks if the table has been fully filled up.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> TRUE if all entries in the corresponding table canvas is non-null object; FALSE otherwise.    <dt> <b>See Also:</b>    <dd> <a href="TableCanvas.html#full">full</a>  </dl></dd></dl><a name="numOccupied()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="numOccupied"><b>numOccupied</b></a><pre> public int numOccupied()</pre><dl>  <dd> Pass the method call to the corresponding <code>TableCanvas</code>, which gets the number of rows in the table where the contents are non-null objects.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> The number of non-null object in the table.    <dt> <b>See Also:</b>    <dd> <a href="TableCanvas.html#numOccupied">numOccupied</a>  </dl></dd></dl><a name="occupied(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="occupied"><b>occupied</b></a><pre> public boolean occupied(int i)</pre><dl>

⌨️ 快捷键说明

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