Skip to content

Commit 11d528f

Browse files
committed
fix for AWT TextArea.setCaretPosition() not working.
Still not implemented for Swing
1 parent b570d47 commit 11d528f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSTextAreaUI.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.beans.PropertyChangeEvent;
66

77
import javax.swing.JTextArea;
8+
import javax.swing.event.CaretEvent;
89
import javax.swing.text.Element;
910
import javax.swing.text.PlainView;
1011
import javax.swing.text.View;
@@ -173,4 +174,16 @@ protected boolean handleTab(Object jqEvent) {
173174
}
174175

175176

177+
@Override
178+
public void caretUpdatedByProgram(CaretEvent e) {
179+
if (!jc.isVisible() || !isAWT) // for now, AWT only
180+
return;
181+
@SuppressWarnings("unused")
182+
int pt = e.getDot();
183+
// Unfortunately, not MacOS, Edge, or MS Explorer
184+
/**
185+
* @j2sNative this.domNode.scrollTo && this.domNode.scrollTo(0, pt);
186+
*/
187+
}
188+
176189
}

0 commit comments

Comments
 (0)