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

Want to print text char by char for my textbased game, but it prints out the whole text after the summed delay
Any library to format a file containing Java code? [closed]
Connect pc with arduino using Java Simple Serial Connector
Creating JSON properly from SQL Resultset using Java
Trying to extract data and write to another spreadsheet comes up empty
java code to mount USB on linux [closed]
How to pass MultipartFile param in JUNIT testing?
Can anyone explain this code related to shadowing in Java?
create ipa without RoboVM in a project libgdx
hibernate criteria is not executed
Java: BufferedWriter NullPointerException
Write charAt method for string
SQLServer connection with windows authentification in 32- and 64-bit environments
Can't get Blob info from derby DB
how to transfer a file in network (socket programming(TCP) ) in android [duplicate]
Java If Else Statement with random value from 1 to 7 and 1 to 6

Categories

HOME
blogger
drivers
lodash
session
spagobi
angular-ui-bootstrap
alpha
ios-charts
applepay
wheelnav.js
collectd
google-cloud-ml
leiningen
visual-studio-cordova
django-cms
cx-freeze
physics-engine
orleans
chromium-embedded
core-text
tibco-mdm
trading
p-value
buildbot
sparse-matrix
chromebook
strncpy
typo3-6.2.x
jspm
directx-10
xquery-3.0
data-manipulation
google-qpx-express-api
picasso
fusionpbx
wixsharp
serverside-rendering
dynamics-crm-2013
user-controls
arena-simulation
midl
mime
eclipse-gef
segment
dandelion
jlink
veracode
tizen-native-app
aurelia-validation
feeds
np-complete
media-player
pdfclown
query-performance
deadbolt-2
httplistener
phishing
measures
fputcsv
jwplayer7
testng-dataprovider
qgraphicsview
make-install
hover-over
whois
rvest
yaws
asp.net5
uid
citrus-pay
pundit
microbenchmark
twirl
arcanist
generic-programming
directoryservices
nsmutabledictionary
clicktag
rdtsc
asp.net-web-api-odata
socketexception
expected-exception
htmlcleaner
comexception
message-driven-bean
algebraic-data-types
monomac
fmod
farseer
dexterity
quartz-graphics
eventual-consistency
pygit2
flashvars
robotics-studio
referrer
path-separator
objective-c-2.0
osql
removeclass
window-management
f#-powerpack
lpeg
substrings
thread-local-storage

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