1 38 39 package org.jfree.chart.demo; 40 41 import java.awt.BorderLayout ; 42 import java.awt.Dimension ; 43 44 import javax.swing.JPanel ; 45 import javax.swing.JScrollPane ; 46 import javax.swing.JTextArea ; 47 48 53 public class DescriptionPanel extends JPanel { 54 55 56 public static final Dimension PREFERRED_SIZE = new Dimension (150, 50); 57 58 63 public DescriptionPanel(JTextArea text) { 64 65 setLayout(new BorderLayout ()); 66 text.setLineWrap(true); 67 text.setWrapStyleWord(true); 68 add(new JScrollPane (text, 69 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 70 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)); 71 72 } 73 74 79 public Dimension getPreferredSize() { 80 return PREFERRED_SIZE; 81 } 82 83 } 84 | Popular Tags |