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

📄 drawingpanel.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 DrawingPanel</title></head><body><a name="_top_"></a><h1>  Class DrawingPanel</h1><pre>java.lang.Object   |   +----java.awt.Component           |           +----java.awt.Container                   |                   +----java.awt.Panel                           |                           +----DrawingPanel</pre><hr><dl>  <dt> public class <b>DrawingPanel</b>  <dt> extends Panel</dl><code>DrawingPanel</code> is the graphical panel attached to the animation frame <code>AlgAnimFrame</code>. It contains the methods to draw objects for the animation algorithm or instances of another classes, which contain the drawing methods. <p> This class is <b>NOT TO BE MODIFIED</b>. <p> Any object class which implements the interface <code>DrawingObj</code> can be added to this panel by calling the <code>addDrawingObj()</code> method. Similarly, commentary box of type <code>ComBox</code> can be added to the panel by using <code>addCom</code> method. Since the commentary box (<code>ComBox</code>) is also implementing the interface <code>DrawingObj</code>, it can also be added by using the <code>addDrawingObj</code> method. However, <code>ComBox</code> added to the drawing panel by using <code>addCom</code> will always appear on top of any object added to the panel by using the <code>addDrawingObj</code> method. <p> Note that last object added to the panel will be displayed on top.<p><dl>    <dt> <b>See Also:</b>    <dd> <a href="AlgAnimFrame.html#getDrawingPanel">getDrawingPanel</a>, <a href="DrawingObj.html#_top_">DrawingObj</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="#DrawingPanel()"><b>DrawingPanel</b></a>()  <dd>  Creates a panel with white background and initializes the fonts to be used during the animation.</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="#addCom(ComBox)"><b>addCom</b></a>(ComBox)  <dd>  Adds a commentary box to the drawing panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#addDrawingObj(DrawingObj)"><b>addDrawingObj</b></a>(DrawingObj)  <dd>  Adds a drawing object to the canvas.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#animate(DrawingObj, java.util.Vector)"><b>animate</b></a>(DrawingObj, Vector)  <dd>  Animate a single drawing object through a sequence of points specified by the <code>Vector</code> construction.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#animate(DrawingObj[], java.util.Vector[])"><b>animate</b></a>(DrawingObj[], Vector[])  <dd>  Animate a list of drawing objects store in an array.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#delay()"><b>delay</b></a>()  <dd>  Invoke a delay for a certain duration specified by  <code>setDelay(int)</code>.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getBigFont()"><b>getBigFont</b></a>()  <dd>  Returns the font objects initialized during the class initialization,  which can be readily used during the animation.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getFixFont()"><b>getFixFont</b></a>()  <dd>  Return font objects initialized during the class initialization, which can be readily used during the animation.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getHugeFont()"><b>getHugeFont</b></a>()  <dd>  Return font objects initialized during the class initialization, which can be readily used during the animation.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getNoAnim()"><b>getNoAnim</b></a>()  <dd>  Check if the noAnim flag is set.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getOffset()"><b>getOffset</b></a>()  <dd>  Get the number of pixel towards the edge of the panel which are not going to be drawn.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getPanelHeight()"><b>getPanelHeight</b></a>()  <dd>  Get the height of the drawing panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getPanelWidth()"><b>getPanelWidth</b></a>()  <dd>  Get the width of the drawing panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getPreferredSize()"><b>getPreferredSize</b></a>()  <dd>  Returns the initial preferred size of the drawing panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getSkip()"><b>getSkip</b></a>()  <dd>  Check if the animationis in the skip mode.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getSmallFont()"><b>getSmallFont</b></a>()  <dd>  Return font objects initialized during the class initialization, which can be readily used during the animation.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getTinyFont()"><b>getTinyFont</b></a>()  <dd>  Return font objects initialized during the class initialization, which can be readily used during the animation.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#init()"><b>init</b></a>()  <dd>  Initialize the commentary boxes and drawing objects,  removing all of them from the drawing panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#isComExist(ComBox)"><b>isComExist</b></a>(ComBox)  <dd>  Check if a commentary box has already been added to the drawing panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#isObjExist(DrawingObj)"><b>isObjExist</b></a>(DrawingObj)  <dd>  Checks if a certain object has already been added to the drawing panel.  <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 objects on the drawing panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#redraw()"><b>redraw</b></a>()  <dd>  Calls repaint() followed by delay().  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#removeCom(ComBox)"><b>removeCom</b></a>(ComBox)  <dd>  Remove the commentary box.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#removeObj(DrawingObj)"><b>removeObj</b></a>(DrawingObj)  <dd>  Remove a drawing object which matches the parameter.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#setAnimStep(int)"><b>setAnimStep</b></a>(int)  <dd>  Set the animation step, i.e.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#setDelay(int)"><b>setDelay</b></a>(int)  <dd>  Set the delay duration between animation update.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#setNoAnim(boolean)"><b>setNoAnim</b></a>(boolean)  <dd>  Set if the animation is disable.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#setSkip(boolean)"><b>setSkip</b></a>(boolean)  <dd>  Set if the animation is in the 'SKIP' .  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#shortDelay()"><b>shortDelay</b></a>()  <dd>  Causing a short delay of 1/3 of the normal delay duration.  <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 when the <code>repaint()</code> method is called.</dl><a name="constructors"></a><h2>  <img src="images/constructors.gif" width=231 height=38 alt="Constructors"></h2><a name="DrawingPanel"></a><a name="DrawingPanel()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>DrawingPanel</b><pre> public DrawingPanel()</pre><dl>  <dd> Creates a panel with white background and initializes the fonts to be used during the animation.<p>  <dd><dl>    <dt> <b>See Also:</b>    <dd> <a href="#getBigFont">getBigFont</a>, <a href="#getSmallFont">getSmallFont</a>, <a href="#getTinyFont">getTinyFont</a>, <a href="#getHugeFont">getHugeFont</a>, <a href="#getFixFont">getFixFont</a>  </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 commentary boxes and drawing objects,  removing all of them from the drawing panel.<p></dl><a name="shortDelay()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="shortDelay"><b>shortDelay</b></a><pre> public void shortDelay()</pre><dl>  <dd> Causing a short delay of 1/3 of the normal delay duration. This method is normally used during debugging to speed up the achievement of certain system state.<p></dl><a name="delay()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="delay"><b>delay</b></a><pre> public void delay()</pre><dl>  <dd> Invoke a delay for a certain duration specified by  <code>setDelay(int)</code>.<p>  <dd><dl>    <dt> <b>See Also:</b>    <dd> <a href="#setDelay">setDelay</a>  </dl></dd></dl><a name="setDelay(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="setDelay"><b>setDelay</b></a><pre> public void setDelay(int delay)</pre><dl>  <dd> Set the delay duration between animation update. This method is normally called from the event handler of the simulation delay menu bar.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> delay - Delay duration in milliseconds.  </dl></dd></dl><a name="redraw()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="redraw"><b>redraw</b></a><pre> public void redraw()</pre><dl>  <dd> Calls repaint() followed by delay(). Since these two methods are being called very frequently in order, the redraw() method is constructed to save typing.<p></dl><a name="update(java.awt.Graphics)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="update"><b>update</b></a><pre> public void update(Graphics g)</pre><dl>  <dd> This method is invoked when the <code>repaint()</code> method is called. The <code>update</code> method is override here to eliminate flashing.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> g - Graphical context    <dt> <b>Overrides:</b>    <dd> <a href="java.awt.Container.html#update(java.awt.Graphics)">update</a> in class Container  </dl></dd></dl><a name="paint(java.awt.Graphics)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="paint"><b>paint</b></a><pre> public void paint(Graphics g)</pre><dl>  <dd> Method to draw objects on the drawing panel.<p>  <dd><dl>    <dt> <b>Overrides:</b>    <dd> <a href="java.awt.Container.html#paint(java.awt.Graphics)">paint</a> in class Container  </dl></dd></dl><a name="getPreferredSize()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getPreferredSize"><b>getPreferredSize</b></a><pre> public Dimension getPreferredSize()</pre><dl>  <dd> Returns the initial preferred size of the drawing panel. This method is called by the layout manager during the creation of the corresponding drawing frame.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> The dimension of the drawing panel.    <dt> <b>Overrides:</b>    <dd> <a href="java.awt.Container.html#getPreferredSize()">getPreferredSize</a> in class Container  </dl></dd></dl><a name="getBigFont()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getBigFont"><b>getBigFont</b></a><pre> public Font getBigFont()</pre><dl>  <dd> Returns the font objects initialized during the class initialization,  which can be readily used during the animation. Initialization fonts on the fly during the animation will slow down the screen update significantly (especially on SGI Irix platform). Therefore, this fonts are only initialized during the creation of the class and used by any other classes that require them to reduce

⌨️ 快捷键说明

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