42 import javax.swing.border.Border;
43 import javax.swing.border.EmptyBorder;
44 import javax.swing.border.CompoundBorder;
45 import javax.swing.border.AbstractBorder;
46 import javax.swing.JButton;
47 import javax.swing.JViewport;
48 import javax.swing.InputMap;
49 import javax.swing.SwingUtilities;
50 import javax.swing.TransferHandler;
51 import javax.swing.plaf.basic.BasicArrowButton;
52 import javax.swing.plaf.basic.BasicScrollBarUI;
53 import javax.swing.plaf.basic.BasicScrollPaneUI;
54 import java.beans.PropertyChangeEvent;
55 import java.beans.PropertyChangeListener;
56 import javax.swing.text.Caret;
57 import javax.swing.text.DefaultCaret;
58 import javax.swing.text.JTextComponent;
59
60 import javax.swing.plaf.BorderUIResource;
61 import java.awt.im.InputMethodRequests;
62 import sun.awt.CausedFocusEvent;
63 import sun.awt.AWTAccessor;
64 import sun.awt.SunToolkit;
65
66 final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
67
68 private final AWTTextPane textPane;
69 private final AWTTextArea jtext;
70 private final boolean firstChangeSkipped;
71
72 private final JavaMouseEventHandler javaMouseEventHandler =
73 new JavaMouseEventHandler(this);
74
75 /**
76 * Create a Text area.
77 */
78 XTextAreaPeer(TextArea target) {
79 super(target);
80
81 // some initializations require that target be set even
82 // though init(target) has not been called
928 }
929
930 @Override
931 public void removeUpdate(DocumentEvent e) {
932 if (peer != null) {
933 peer.postEvent(new TextEvent(peer.target,
934 TextEvent.TEXT_VALUE_CHANGED));
935 }
936 }
937
938 @Override
939 public void changedUpdate(DocumentEvent e) {
940 if (peer != null) {
941 peer.postEvent(new TextEvent(peer.target,
942 TextEvent.TEXT_VALUE_CHANGED));
943 }
944 }
945
946 void forwardFocusGained( FocusEvent e) {
947 isFocused = true;
948 FocusEvent fe = CausedFocusEvent.retarget(e, this);
949 super.processFocusEvent(fe);
950 }
951
952
953 void forwardFocusLost( FocusEvent e) {
954 isFocused = false;
955 FocusEvent fe = CausedFocusEvent.retarget(e, this);
956 super.processFocusEvent(fe);
957 }
958
959 @Override
960 public boolean hasFocus() {
961 return isFocused;
962 }
963
964 public void repaintNow() {
965 paintImmediately(getBounds());
966 }
967
968 public void processMouseEventPublic(MouseEvent e) {
969 processMouseEvent(e);
970 }
971
972 public void processMouseMotionEventPublic(MouseEvent e) {
973 processMouseMotionEvent(e);
974 }
975
|
42 import javax.swing.border.Border;
43 import javax.swing.border.EmptyBorder;
44 import javax.swing.border.CompoundBorder;
45 import javax.swing.border.AbstractBorder;
46 import javax.swing.JButton;
47 import javax.swing.JViewport;
48 import javax.swing.InputMap;
49 import javax.swing.SwingUtilities;
50 import javax.swing.TransferHandler;
51 import javax.swing.plaf.basic.BasicArrowButton;
52 import javax.swing.plaf.basic.BasicScrollBarUI;
53 import javax.swing.plaf.basic.BasicScrollPaneUI;
54 import java.beans.PropertyChangeEvent;
55 import java.beans.PropertyChangeListener;
56 import javax.swing.text.Caret;
57 import javax.swing.text.DefaultCaret;
58 import javax.swing.text.JTextComponent;
59
60 import javax.swing.plaf.BorderUIResource;
61 import java.awt.im.InputMethodRequests;
62 import sun.awt.AWTAccessor;
63 import sun.awt.SunToolkit;
64
65 final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
66
67 private final AWTTextPane textPane;
68 private final AWTTextArea jtext;
69 private final boolean firstChangeSkipped;
70
71 private final JavaMouseEventHandler javaMouseEventHandler =
72 new JavaMouseEventHandler(this);
73
74 /**
75 * Create a Text area.
76 */
77 XTextAreaPeer(TextArea target) {
78 super(target);
79
80 // some initializations require that target be set even
81 // though init(target) has not been called
927 }
928
929 @Override
930 public void removeUpdate(DocumentEvent e) {
931 if (peer != null) {
932 peer.postEvent(new TextEvent(peer.target,
933 TextEvent.TEXT_VALUE_CHANGED));
934 }
935 }
936
937 @Override
938 public void changedUpdate(DocumentEvent e) {
939 if (peer != null) {
940 peer.postEvent(new TextEvent(peer.target,
941 TextEvent.TEXT_VALUE_CHANGED));
942 }
943 }
944
945 void forwardFocusGained( FocusEvent e) {
946 isFocused = true;
947 FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
948 e.getOppositeComponent(), e.getCause());
949 super.processFocusEvent(fe);
950 }
951
952
953 void forwardFocusLost( FocusEvent e) {
954 isFocused = false;
955 FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
956 e.getOppositeComponent(), e.getCause());
957 super.processFocusEvent(fe);
958 }
959
960 @Override
961 public boolean hasFocus() {
962 return isFocused;
963 }
964
965 public void repaintNow() {
966 paintImmediately(getBounds());
967 }
968
969 public void processMouseEventPublic(MouseEvent e) {
970 processMouseEvent(e);
971 }
972
973 public void processMouseMotionEventPublic(MouseEvent e) {
974 processMouseMotionEvent(e);
975 }
976
|