01: package org.columba.mail.gui.composer;
02:
03: import java.awt.BorderLayout;
04: import java.awt.Dimension;
05: import java.awt.Rectangle;
06:
07: import javax.swing.JPanel;
08: import javax.swing.JScrollPane;
09: import javax.swing.Scrollable;
10: import javax.swing.UIManager;
11:
12: import org.columba.core.gui.util.FontProperties;
13:
14: public class TextEditorPanel extends JScrollPane {
15:
16: private JPanel contentPane;
17:
18: public TextEditorPanel() {
19: super ();
20:
21: contentPane = new VerticalScrollablePanel();
22:
23: contentPane.setBorder(null);
24:
25: setBorder(null);
26:
27: contentPane.setLayout(new BorderLayout());
28:
29: setViewportView(contentPane);
30:
31: getViewport().setBackground(
32: UIManager.getColor("TextArea.background"));
33: }
34:
35: /**
36: * @return Returns the contentPane.
37: */
38: public JPanel getContentPane() {
39: return contentPane;
40: }
41:
42: }
43:
44: class VerticalScrollablePanel extends JPanel implements Scrollable {
45:
46: /**
47: *
48: */
49: public VerticalScrollablePanel() {
50: super ();
51: }
52:
53: public boolean getScrollableTracksViewportHeight() {
54: return false;
55: }
56:
57: public boolean getScrollableTracksViewportWidth() {
58: return true;
59: }
60:
61: public Dimension getPreferredScrollableViewportSize() {
62: return getPreferredSize();
63: }
64:
65: public int getScrollableBlockIncrement(Rectangle visibleRect,
66: int orientation, int direction) {
67: return FontProperties.getTextFont().getSize() * 10;
68: }
69:
70: public int getScrollableUnitIncrement(Rectangle visibleRect,
71: int orientation, int direction) {
72: return FontProperties.getTextFont().getSize() * 3;
73: }
74:
75: }
|