473,698 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
+ 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 3079


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.javasc ript.*;
and you can then instantiate the JavaScript window object from Java as
follows
JSObject window = JSObject.getWin dow(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("hi ghlightLinkText ", new Object[] {"textId"});
Then in the HTML page write a JavaScript function
function highlightLinkTe xt (elementId) {
var element;
if (document.getEl ementById) {
element = document.getEle mentById(elemen tId);
if (element && element.style) {
element.style.b ackgroundColor = '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*******@yaho o.de> wrote in message news:3f******** @olaf.komtel.ne t...


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.javasc ript.*;
and you can then instantiate the JavaScript window object from Java as
follows
JSObject window = JSObject.getWin dow(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("hi ghlightLinkText ", new Object[] {"textId"});
Then in the HTML page write a JavaScript function
function highlightLinkTe xt (elementId) {
var element;
if (document.getEl ementById) {
element = document.getEle mentById(elemen tId);
if (element && element.style) {
element.style.b ackgroundColor = '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
9519
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 in which the applet is embedded (like Java 1.3) using Java 1.4.2??? http://java.sun.com/products/jdk/1.2/docs/api/java/applet/Applet.html#getDocumentBase() http://java.sun.com/j2se/1.3/docs/api/java/applet/Applet.html#getDocumentBase()
0
9872
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 ********************************** package Celcom.Client;
1
2939
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
3327
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 links are hidden i.e. how do I hide broken links? Chris
8
3381
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 problems. IE crashes when one refreshes the page or leave the page. This happens only after calling the Java method more than once. It does not crash if the Java method is called just once and then the page is refreshed. FireFox does not crash at all...
16
14493
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
5659
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 ChatDispatch.java
4
7818
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 future investment values. When you click Loan Calculator button, a frame appears in a separate new window for computong loan payments. Here's my coding: // Lab3.java: import java.awt.*; import java.awt.event.*; import javax.swing.*; ...
1
2383
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 in the right direction. Ok the problem. I am creating a program that ask the user to input a height value, the program will then do a calculation and create a golden ratio width. The type of both the height and the width are double. This is...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7728
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4369
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.