• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling applet from SJ passing enum type

 
Matjaz Trtnik
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to pass enumeration type when calling applet from JavaScript?
For example my method in applet looks like:

public enum ColorEnum {
RED,
GREEN,
BLUE
}


public void doSomething(ColorEnum color)

If I send String in JS like 'RED' I get following exception:

Message: java.lang.IllegalArgumentException: No method found matching name doSomething and arguments [java.lang.String]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, JavaScript has no understanding of enumerations. You need to stick to basic datatypes like strings and numbers.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!