-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1
-
None
-
x86
-
windows_95
Name: icT56964 Date: 06/02/97
In Solaris, TextArea.getSelectionStart() returns 8, but in NT, it returns 10.
It is a bug. (June2, icho@eng)
---------------------------------
1.
Try to compile and execute 2. program and type in displaied TextArea following text
abc<RETURN>
def<RETURN>
and push "dump" button.
I think TextArea's selections are 8,8, but it will be printed 10,10.
I think it's not correct.
2.
import java.io.*;
import java.awt.*;
class test extends Frame {
Button button = new Button("dump");
TextArea textarea = new TextArea(12, 40);
public test() {
add("Center", textarea);
add("South", button);
pack();
}
public boolean action(Event event, Object arg) {
if (event.target == button) {
try {
String text = textarea.getText();
int length = text.length();
System.out.println("length="+length);
System.out.print("text=");
for (int i = 0; i < length; i++) {
System.out.print(Integer.toHexString(text.charAt(i))+" ");
}
System.out.println("\nselection="+textarea.getSelectionStart()+","+textarea.getSelectionEnd());
return true;
} catch (Exception e) {
}
}
return false;
}
public static void main(String args[]) {
new test().show();
}
}
company - PFU Limited , email - ###@###.###
======================================================================
- duplicates
-
JDK-4072264 getSelectedText, getSelectedStart/End in TextArea class returns wrong
- Closed