473,466 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Links in a applet

I have an applet which is a cube each face if which is a link. I have a floating <DIV> element which when the mouse is over the applet it pops up showing the text of all the links in the applet. What I would like is when the mouse is over one of the faces of the cube the corresponding text in my <DIV> will highlight.

So in other words this is sort of like have a link on a page and when the mouse is held over it, some other area of the html page will highlight. If the link itself highligts that is no problem. I would just like some other area of the page to highlight.

Any suggestions on how to do this? Thanks.

--
George Hester
__________________________________

Jul 20 '05 #1
2 3064


George Hester wrote:
I have an applet which is a cube each face if which is a link. I
have a floating <DIV> element which when the mouse is over the applet
it pops up showing the text of all the links in the applet. What I
would like is when the mouse is over one of the faces of the cube the
corresponding text in my <DIV> will highlight.

So in other words this is sort of like have a link on a page and when
the mouse is held over it, some other area of the html page will
highlight. If the link itself highligts that is no problem. I would
just like some other area of the page to highlight.


If you really have a Java applet and want it to change the style of an
element in the HTML page containing the Java applet then you need to
allow the applet to script with
<applet mayscript
in the HTML code and inside your applet code you need to
import netscape.javascript.*;
and you can then instantiate the JavaScript window object from Java as
follows
JSObject window = JSObject.getWindow(this);
The window object has then methods outlined at
http://devedge.netscape.com/library/...e/lcjsobj.html
for instance a call method so that you could call a function in the page
window.call("highlightLinkText", new Object[] {"textId"});
Then in the HTML page write a JavaScript function
function highlightLinkText (elementId) {
var element;
if (document.getElementById) {
element = document.getElementById(elementId);
if (element && element.style) {
element.style.backgroundColor = 'lightblue';
}
}
}
and set up the text for each link to have an id e.g.
<p id="link1Text">...</p>

The whole process of Java->JavaScript communication is called
LiveConnect and is not supported by all browsers on all platforms as it
depends on the Java VM supporting it.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Thanks Martin. Yes I saw that at Sun. Unfortunately I cannot change the applet it was purchased. Let me ask this then.

The only change that the Window recognizes when the mouse is held over one of the faces is a change in the Status bar. It reads all I want. The <DIV> element is actually just a rehash of the status bar but all the faces "names" appear at once rather then each seperate face in the Status bar when the mouse is over a face.

So what I did is try to Read the status bar in JavaScript code. That didn't work. For each time I got the Status bar window.status was empty.

So if I could just figure out what if anything changes in the DOM and hopefully has the information of the intended direction of the link. If there is no other way then redesigning the applet, OK that's fine. What I have will be good enough I guess. I'm giving data binding a shot but haven't worked out how to use that yet.

Oh and thanks for your example. I am sure I'll be able to use tht in some other project.

--
George Hester
__________________________________
"Martin Honnen" <ma*******@yahoo.de> wrote in message news:3f********@olaf.komtel.net...


George Hester wrote:
I have an applet which is a cube each face if which is a link. I
have a floating <DIV> element which when the mouse is over the applet
it pops up showing the text of all the links in the applet. What I
would like is when the mouse is over one of the faces of the cube the
corresponding text in my <DIV> will highlight.

So in other words this is sort of like have a link on a page and when
the mouse is held over it, some other area of the html page will
highlight. If the link itself highligts that is no problem. I would
just like some other area of the page to highlight.


If you really have a Java applet and want it to change the style of an
element in the HTML page containing the Java applet then you need to
allow the applet to script with
<applet mayscript
in the HTML code and inside your applet code you need to
import netscape.javascript.*;
and you can then instantiate the JavaScript window object from Java as
follows
JSObject window = JSObject.getWindow(this);
The window object has then methods outlined at
http://devedge.netscape.com/library/...e/lcjsobj.html
for instance a call method so that you could call a function in the page
window.call("highlightLinkText", new Object[] {"textId"});
Then in the HTML page write a JavaScript function
function highlightLinkText (elementId) {
var element;
if (document.getElementById) {
element = document.getElementById(elementId);
if (element && element.style) {
element.style.backgroundColor = 'lightblue';
}
}
}
and set up the text for each link to have an id e.g.
<p id="link1Text">...</p>

The whole process of Java->JavaScript communication is called
LiveConnect and is not supported by all browsers on all platforms as it
depends on the Java VM supporting it.


--

Martin Honnen
http://JavaScript.FAQTs.com/


Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: nathanlaan | last post by:
This is the stupidest thing I have ever seen. Java 1.2, 1.3, and 1.4.1, and 1.4.2 all define the Applet.getDocumentBase() method differently! How am I supposed to get the directory of the document...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
1
by: Charlie Kim | last post by:
Here is gnome applet source of mine. -------------------------------------------------- #!/usr/bin/env python import pydic import gtk import gnome.applet
1
by: Chris Hemingway | last post by:
Hi I have an html file which links to word docs amongst other things; but these files and their location may change periodically. How can I adapt my html so that if the files do not exist, the...
8
by: DKM | last post by:
Here are the source code files to a Java applet that utilizes LiveConnect to communicate with Javascript, and the HTML file. The thing works both in IE 6.0 and FireFox 1.4. but with some...
16
by: Frances | last post by:
<a href="#1"> <a name="#1"> this link is not working in FF (works fine in IE..) would appreciate thoughts/suggestions.. thank you.. Frances
0
by: ankur | last post by:
WHEN I RUN THIS WEB APPLICATION ON Tomcat5.5.9 SERVER MY HttpChatApplet sccessfully Loaded from ChatDispatch but running on some another PC HttpChatApplet not loaded my Coad ...
4
by: tudyfruity18 | last post by:
I'm suppose to write an applet that contains two buttons Investment calculator and Loan Calculator. When the Investment Calculator button is clicked, a frame appears in a new window for calculating...
1
by: sheephead86 | last post by:
Hi, I'm pretty new to java, and I have a small problem involving drawing a rectangle on a java applet.Firstly this is not a plea for someone to help me with this peice of work, I just need pointing...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.