aspose file tools*
The moose likes Applets and the fly likes Liveconnect- background color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Liveconnect- background color" Watch "Liveconnect- background color" New topic
Author

Liveconnect- background color

Venkata Kiran
Ranch Hand

Joined: Sep 06, 2005
Posts: 30
Hai All,
can v change the backgrouund color of an applet based on user selection using Javascript.
Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
Yes, using LiveConnect that's possible. What do you have so far?


Ping & DNS - my free Android networking tools app
Venkata Kiran
Ranch Hand

Joined: Sep 06, 2005
Posts: 30
I must accept a color from a textbox and on button click must set new color as the background color. I tried onKlick="document.AppletName.setBackgroundColordocument.form1.textBox.value)
I am getting an error : Object does not support this property.
i had just started working with LiveConnect ,
r there any good links for this.
Thank You.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
onKlick="document.AppletName.setBackgroundColordocument.form1.textBox.value)

I assume that's just a typo, and you really have (i.e., there is an opening parenthesis):
document.AppletName.setBackgroundColor(document.form1.textBox.value)

I'm not sure if the error message is about the HTML form or the applet. Do an "alert(document.form1.textBox.value)" before you call the applet method, just to see if the correct value is transmitted.

Also, the setBackgroundColor method must be declared public for this to work.

The Applet FAQ -linked in my signature- has a section on LiveConnect which will get you started.
[ January 02, 2006: Message edited by: Ulf Dittmer ]
Venkata Kiran
Ranch Hand

Joined: Sep 06, 2005
Posts: 30
The setBackground color is declared as public and the alert statements are displaying the correct values entered in textboxes.

but still i am getting an error java.lang.Exception:setBackgroundColor(0): no such method exists;
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
What type has the parameter of setBackgroundColor? I'm not sure how well passing integers works - try declaring it as a String, and converting that to int in the Java code.
Venkata Kiran
Ranch Hand

Joined: Sep 06, 2005
Posts: 30
ok got an excellent link which almost suits my requirement at
www.experts-exchange.com
Thnaks You for the Help.

[ link edited by UD to keep the formatting readable ]
[ January 03, 2006: Message edited by: Ulf Dittmer ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Liveconnect- background color