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

📄 textpanel.html

📁 Java算法大全(近100种算法打包),內容詳實,很好的學習資料.
💻 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 TextPanel</title></head><body><a name="_top_"></a><h1>  Class TextPanel</h1><pre>java.lang.Object   |   +----java.awt.Component           |           +----java.awt.Container                   |                   +----java.awt.Panel                           |                           +----TextPanel</pre><hr><dl>  <dt> public class <b>TextPanel</b>  <dt> extends Panel</dl>Text panel to display the source code of the animation algorithm. This class is initialized in the <code>TextFrame</code> class construction during the main frame initialization. Each line of the source code starting with <code>/*-</code> will be ignored. The line after <code>/*-------</code> is considered as the first line of text being displayed. The line before <code>//-</code> is the last line of source code being displayed. The text after this line will no longer be parsed. See also <A href="AlgThread.html"><code>AlgThread</code></A> for special symbol used in displaying source code in text panel. <p> This method should NOT have to be called manually.<p><dl>    <dt> <b>See Also:</b>    <dd> <a href="TextFrame.html#_top_">TextFrame</a>, <a href="AlgAnimFrame.html#_top_">AlgAnimFrame</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="#TextPanel(java.lang.String)"><b>TextPanel</b></a>(String)  <dd>  Creates a text panel based on the source file specified in the String passed in as the parameter.  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#TextPanel(java.net.URL)"><b>TextPanel</b></a>(URL)  <dd>  Creates a text frame based on the URL specified by the parameter.</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="#getLineSpace()"><b>getLineSpace</b></a>()  <dd>  Get the number of pixels used by each line of text.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getMinimumSize()"><b>getMinimumSize</b></a>()  <dd>  Return the minimum allowed dimension of the text panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getNumLines()"><b>getNumLines</b></a>()  <dd>  Get the number of lines of source code to be displayed on the text 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 dimension of the text panel.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#getStart()"><b>getStart</b></a>()  <dd>  Get the first line of the source code that will be displayed.  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">	<a href="#Highlight(int)"><b>Highlight</b></a>(int)  <dd>  Highlight a certain line of the source code.  <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>  This method print the source code starting from the first line specified by <code>setStart(int)</code> on the text panel.  <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 first line to display.  <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 of the parent class is called.</dl><a name="constructors"></a><h2>  <img src="images/constructors.gif" width=231 height=38 alt="Constructors"></h2><a name="TextPanel"></a><a name="TextPanel(java.lang.String)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>TextPanel</b><pre> public TextPanel(String fn)</pre><dl>  <dd> Creates a text panel based on the source file specified in the String passed in as the parameter.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> fn - Filename of the source code  </dl></dd></dl><a name="TextPanel(java.net.URL)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a><b>TextPanel</b><pre> public TextPanel(URL sourceURL)</pre><dl>  <dd> Creates a text frame based on the URL specified by the parameter.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> sourceURL - URL of the source code    <dt> <b>See Also:</b>    <dd> URL  </dl></dd></dl><a name="methods"></a><h2>  <img src="images/methods.gif" width=151 height=38 alt="Methods"></h2><a name="Highlight(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="Highlight"><b>Highlight</b></a><pre> public void Highlight(int h)</pre><dl>  <dd> Highlight a certain line of the source code. The highlighted line is displayed in RED while the other normal lines are displayed in BLACK. The first line of the source has a line index of <b>0</b>.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> h - The line to be highlighted  </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 dimension of the text panel. This method will be called by the layout manager during the corresponding frame initialization.<p>  <dd><dl>    <dt> <b>Overrides:</b>    <dd> <a href="java.awt.Container.html#getPreferredSize()">getPreferredSize</a> in class Container  </dl></dd></dl><a name="getMinimumSize()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getMinimumSize"><b>getMinimumSize</b></a><pre> public Dimension getMinimumSize()</pre><dl>  <dd> Return the minimum allowed dimension of the text panel.<p>  <dd><dl>    <dt> <b>Overrides:</b>    <dd> <a href="java.awt.Container.html#getMinimumSize()">getMinimumSize</a> in class Container  </dl></dd></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 of the parent class is called. This method eliminates flashing during animation.<p>  <dd><dl>    <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="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 first line to display.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> start - First line to display    <dt> <b>See Also:</b>    <dd> <a href="#getStart">getStart</a>  </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> This method print the source code starting from the first line specified by <code>setStart(int)</code> on the text panel.<p>  <dd><dl>    <dt> <b>Parameters:</b>    <dd> g - Graphical context of the text panel.    <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="getNumLines()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getNumLines"><b>getNumLines</b></a><pre> public int getNumLines()</pre><dl>  <dd> Get the number of lines of source code to be displayed on the text panel.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> The number of lines of source code to be displayed on the		text frame.  </dl></dd></dl><a name="getLineSpace()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getLineSpace"><b>getLineSpace</b></a><pre> public int getLineSpace()</pre><dl>  <dd> Get the number of pixels used by each line of text.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> The number of pixels allocated for each line of text.  </dl></dd></dl><a name="getStart()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a><a name="getStart"><b>getStart</b></a><pre> public int getStart()</pre><dl>  <dd> Get the first line of the source code that will be displayed. This attribute is used to couple the text panel to a vertical scrollbar in the TextFrame.<p>  <dd><dl>    <dt> <b>Returns:</b>    <dd> The first line of source code that will be displayed.  </dl></dd></dl></body></html>

⌨️ 快捷键说明

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