KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > demo > DescriptionPanel


1 /* ======================================
2  * JFreeChart : a free Java chart library
3  * ======================================
4  *
5  * Project Info: http://www.jfree.org/jfreechart/index.html
6  * Project Lead: David Gilbert (david.gilbert@object-refinery.com);
7  *
8  * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
9  *
10  * This library is free software; you can redistribute it and/or modify it under the terms
11  * of the GNU Lesser General Public License as published by the Free Software Foundation;
12  * either version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License along with this
19  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  * ---------------------
23  * DescriptionPanel.java
24  * ---------------------
25  * (C) Copyright 2001-2003, by Object Refinery Limited.
26  *
27  * Original Author: David Gilbert (for Object Refinery Limited);
28  * Contributor(s): -;
29  *
30  * $Id: DescriptionPanel.java,v 1.3 2003/06/12 16:54:01 mungady Exp $
31  *
32  * Changes
33  * -------
34  * 10-Dec-2001 : Version 1 (DG);
35  * 10-Oct-2002 : Fixed errors reported by Checkstyle (DG);
36  *
37  */

38
39 package org.jfree.chart.demo;
40
41 import java.awt.BorderLayout JavaDoc;
42 import java.awt.Dimension JavaDoc;
43
44 import javax.swing.JPanel JavaDoc;
45 import javax.swing.JScrollPane JavaDoc;
46 import javax.swing.JTextArea JavaDoc;
47
48 /**
49  * A panel containing a chart description.
50  *
51  * @author David Gilbert
52  */

53 public class DescriptionPanel extends JPanel JavaDoc {
54
55     /** The preferred size for the panel. */
56     public static final Dimension JavaDoc PREFERRED_SIZE = new Dimension JavaDoc(150, 50);
57
58     /**
59      * Creates a new panel.
60      *
61      * @param text the component containing the text.
62      */

63     public DescriptionPanel(JTextArea JavaDoc text) {
64
65         setLayout(new BorderLayout JavaDoc());
66         text.setLineWrap(true);
67         text.setWrapStyleWord(true);
68         add(new JScrollPane JavaDoc(text,
69                             JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
70                             JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
71
72     }
73
74     /**
75      * Returns the preferred size.
76      *
77      * @return the preferred size.
78      */

79     public Dimension JavaDoc getPreferredSize() {
80         return PREFERRED_SIZE;
81     }
82
83 }
84
Popular Tags