• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling applet from SJ passing enum type  RSS feed

 
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: 42972
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!