Padma Malladi

Greenhorn
+ Follow
since Jun 14, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Padma Malladi

No, it kindof not possible to convert this function to java. I was hoping there is something similar to JNI or even JNI which would let me do this. Thank You.
Padma
22 years ago
Hi,
I have an application written in Java, which needs to call a Javascript function to execute some part of the code written in that function. Can I do this ?? If so, please let me know how I can call this javascript function from my application code. Thank You.
Padma Malladi
22 years ago
Hi,
I have a JEditorPane which is loaded with a dynamic web page using the setPage(url) method. During this process I want the user to have an option to stop loading the web page. For this I created a stop button in my application. But I can't figure out as to how to implement this stop button functionality. Also, I can't figure out how to implement a refresh button. Please help me with this. Thanks a lot.

Thank You.
Padma Malladi
22 years ago
Hello Manfred,
I realized why firstIndex is always equal to -1. This is because the method indexOf(str) is not able to find this string str in the editorPane text and hence is returning -1. And the reason why indexOf(str) cannot recognize the string str is because, the string returned by the method getText() has all kinds of html tags within it. Hence indexOf method is not able to match the str string with the one in the editorPane string. I am not sure how to solve this though??
Padma
22 years ago
Hi Manfred,
Thanks a lot for the help. But, it is not working like expected. I mean, irrespective of where the mouse is placed on the editorpane, it just selects the first few lines of the html text in the editorpane. I didn't mention this before but I am loading a html file into editorpane dynamically(using the JEditorPane contructor, editorPane = new JEditorPane(url); and the url being like http://www.rbi.com). Thus, the firstIndex is always -1(the first character in the html text) and depending on the length of the str, the lastIndex is calculated. The str selected, from the editorPane using AccessibleContext and AccessibleText, is correct although the firstIndex is wrong. I hope you can still help me with this problem. Thank You.
Padma
22 years ago
Hi,
I am having problems with coloring a sentence in a JEditorPane. I am doing the following: I have a JEditorPane which displays a HTML text. When the user moves his cursor over a sentence I need to highlight the sentence(only) with yellow color. I could get upto the point where I am extracting the sentence from the line where the mouse is moved. But I can't figure out as to how to color that sentence. Here's the code for the getting the sentence.
MouseMotionListener mouseMotionListener=new MouseMotionAdapter() {
public void mouseMoved(MouseEvent e) {
x = e.getX(); y = e.getY();
Point p = new Point(x, y);
AccessibleContext ac = editorPane.getAccessibleContext();
AccessibleText at = ac.getAccessibleText();
int index = at.getIndexAtPoint(p);
String str = at.getAtIndex(AccessibleText.SENTENCE,
index);
//I NEED TO HIGLIGHT THIS SENTENCE IN THE EDITORPANE.
}
};
I've looked into various methods available for JEditorPane, among which select(int selectionStart,int selectionEnd) seems to be helpful. If I use this, I can later use the setSelectionColor(Color c) method to highlighten that selected sentence. But I can't figure out what values I should send to the method select, to have that particular sentence selected. Please help me with this. Thanks a lot.
Padma
22 years ago
Hi,
I have a JEditorPane which is loaded with a dynamic web page using the setPage(url) method. During this process I want the user to have an option to stop loading the web page. For this I created a stop button in my application. But I can't figure out as to how to implement this stop button functionality. Also, I can't figure out how to implement a refresh button. Please help me with this. Thanks a lot.
Padma Malladi
22 years ago