java


How to access the multiple choiceGroup in midlet class as selection


I have created one class which extends MIDLet. I have created another class more than one choiceGroup, textField, and many more. I want to use at a time only choiceGroup or textField .. Please help me. When I select on item1 only choiceGroup1 and textField will show on screen.
package tesdt;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class testMidlet extends MIDlet implements CommandListener
{
Display display;
Form form;
Command cmdNext;
ChoiceGroup gr4;
public testMidlet()
{
display=Display.getDisplay(this);
form =new Form("Hello World");
cmdNext=new Command("Next", Command.SCREEN,1);
form.addCommand(cmdNext);
form.setCommandListener(this);
gr4=new ChoiceGroup("Select",ChoiceGroup.EXCLUSIVE);
gr4.append("item1", null);
gr4.append("item2", null);
gr4.append("item3", null);
form.append(gr4);
}
public void startApp()
{
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable d) throws UnsupportedOperationException
{
if(c==cmdNext || gr4.getSelectedIndex()==1)
{
GUITest guitest=new GUITest();
display.setCurrent(guitest);
}
}
}
package tesdt;
import javax.microedition.lcdui.*;
public class GUITest extends Form
{
TextField tf1,tf2,tf3;
ChoiceGroup gr1,gr2,gr3;
String[] gr1Item={"item1","item2","item3","item4"};
String[] gr2Item={"Name","Age","Sex","DOB"};
String[] gr3Item={"Delhi","Mumbai","Patna","Bangalore"};
Command com;
// testMidlet testMidlet;
public GUITest()
{
super("hi");
com=new Command("Next on", Command.SCREEN,1);
}
public Command getCom()
{
return com;
}
public ChoiceGroup getGr1()
{
return gr1;
}
public void setGr1()
{
gr1=new ChoiceGroup("Item",ChoiceGroup.EXCLUSIVE,gr1Item,null);
append(gr1);
}
public ChoiceGroup getGr2()
{
return gr2;
}
public void setGr2()
{
gr2=new ChoiceGroup("Record",List.EXCLUSIVE,gr2Item,null);
append(gr2);
}
public ChoiceGroup getGr3()
{
return gr3;
}
public void setGr3()
{
gr3=new ChoiceGroup("Item",ChoiceGroup.EXCLUSIVE,gr3Item,null);
append(gr3);
}
public TextField getTf1()
{
return tf1;
}
public void setTf1()
{
tf1=new TextField("Record","Enter Item",20,TextField.ANY);
append(tf1);
}
public TextField getTf2()
{
return tf2;
}
public void setTf2()
{
tf2=new TextField("Item","Enter Record",20,TextField.ANY);
append(tf2);
}
public TextField getTf3()
{
return tf3;
}
public void setTf3()
{
tf3=new TextField("Item","Enter City",20,TextField.ANY);
append(tf3);
}
}
}

Related Links

PatternSyntax Exception,Dangling meta character '+' near index 0
OOP sort Arraylist
Java stopping code execution?
Jackson update part of object
Why can't Git Follow my Java JDK installation path?
Type error - Switch fragments in the Navigation Drawer
Java - Compare item of String array with a String [duplicate]
Deploy Java Web in Tomcat Subfolder Using Reverse Proxy
How do I return an array of words given an input sentence (string)?
Java collections over arangoDB
How to specify repeated elements in XSD
Hibernate annotations - date cannot be mapped
use the name of JList in java for ListSelectionListener
JFrame not responding to setVisible() and dispose() [closed]
How to Merge A4 Size PDF with A8 size PDF in java using iText?
Lambda on primitive arrays

Categories

HOME
cakephp
xamarin
log4j
multithreading
bluetooth
testng
single-sign-on
react-router
cvs
elm
binary-tree
serverspec
append
medical
gorm
facebook-php-sdk
fancybox-3
reveal.js
spring-xd
rascal
correlation
visual-studio-2005
flask-wtforms
fatal-error
footer
one-hot-encoding
scriptcs
extjs5
format-specifiers
spark-jobserver
linkerd
galsim
xquery-3.0
fog
code-contracts
kendo-ui-grid
azure-sql-database
hexo
plsql-psp
hot-module-replacement
unspecified
reportbuilder
document.write
splice
reportingservices-2005
nomethoderror
no-www
rails-routing
promela
dropbox-php
drupal-6
qtwebview
gcsfuse
pycaffe
firmata
libpng
firebaseui
contact-list
moveit
sdf
oauth2client
netmq
natvis
wso2cloud
teamcity-8.0
ideamart
fluid-dynamics
angularjs-ng-click
socketexception
client-side-templating
internet-connection
heisenbug
fluentautomation
didselectrowatindexpath
aqtime
apc
html4
http-unit
jelly
referrer
dmoz
trusted
datawindow
jspinclude
coredump
coercion
django-tagging
xdomainrequest
oncheckedchanged
gamma
perfect-hash
firefox4
simpletest
signal-handling

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App