A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Mobile
»
Java Micro Edition
Author
IllegalAccessException
Tom Diamond
Ranch Hand
Joined: May 10, 2001
Posts: 98
posted
Aug 17, 2002 16:11:00
0
Hello,
I am trying to write a simple MIDlet, but I still get an
IllegalAccessException
when trying to run it (with the emulator). Any ideas? Here is the code ...
Tnx, in advance,
Tom.
package JPDictionary; /*imports .....*/ public class JPDictionary extends MIDlet implements CommandListener { /** The current display for this MIDlet */ private Display display; /** The Alert for messages */ private Alert alert; public static final int WILDCHAR = 0; public static final int REGEXP = 1; private ChoiceGroup choiceGroup = null; private Form mainForm = null; private Command exitCommand = null; public JPDictionary(boolean engGr) { String[] choices = {"Wildcards (? and *)", "Regexp"}; Image[] images = {}; display = Display.getDisplay(this); alert = new Alert("Warning"); choiceGroup = new ChoiceGroup("Choose type : ", ChoiceGroup.EXCLUSIVE, choices, images); mainForm = new Form("Query"); exitCommand = new Command("Exit", Command.SCREEN, 2); } public void startApp() { mainForm.append(new TextField("Type a word to find : ", "", 30, TextField.ANY)); mainForm.append(choiceGroup); mainForm.addCommand(exitCommand); mainForm.setCommandListener(this); display.setCurrent(mainForm); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable s) { if (c == exitCommand) { destroyApp(false); notifyDestroyed(); } } }
[ August 17, 2002: Message edited by: Tom Diamond ]
Liam Quinn
Ranch Hand
Joined: Jan 18, 2002
Posts: 35
posted
Aug 17, 2002 16:40:00
0
The "images" array that you pass to the ChoiceGroup constructor needs to either be null or the same length as the "choices"
String
array.
Tom Diamond
Ranch Hand
Joined: May 10, 2001
Posts: 98
posted
Aug 19, 2002 01:32:00
0
Yeap, thanks!
I agree. Here's the link:
http://aspose.com/file-tools
subject: IllegalAccessException
Similar Threads
Current focused item in the form
Problem in basics
Why won't my BACK BUTTON work?
Getting Battery Level
Horizantal image scroll in J2ME form
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter