1 package org.columba.mail.gui.composer; 2 3 import java.awt.BorderLayout ; 4 import java.awt.Dimension ; 5 import java.awt.Rectangle ; 6 7 import javax.swing.JPanel ; 8 import javax.swing.JScrollPane ; 9 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(UIManager.getColor("TextArea.background")); 32 } 33 34 37 public JPanel getContentPane() { 38 return contentPane; 39 } 40 41 } 42 43 class VerticalScrollablePanel extends JPanel implements Scrollable { 44 45 48 public VerticalScrollablePanel() { 49 super(); 50 } 51 52 public boolean getScrollableTracksViewportHeight() { 53 return false; 54 } 55 56 public boolean getScrollableTracksViewportWidth() { 57 return true; 58 } 59 60 public Dimension getPreferredScrollableViewportSize() { 61 return getPreferredSize(); 62 } 63 64 public int getScrollableBlockIncrement(Rectangle visibleRect, 65 int orientation, int direction) { 66 return FontProperties.getTextFont().getSize() * 10; 67 } 68 69 public int getScrollableUnitIncrement(Rectangle visibleRect, 70 int orientation, int direction) { 71 return FontProperties.getTextFont().getSize() * 3; 72 } 73 74 } | Popular Tags |