j2mepolish


J2ME Polish - List and TextField


I am sorry for my bad English, but I am from Czech Republic. Thanks for understand.
Hi,
I am programming simple calculator in J2ME Polish. I created buttons by using object List (J2ME Polish, template accessible) and now I need put in display some textfield for typing terms. But I do not know how I do that. Object List does not support this:
myList.append(myTextField);
So I have all buttons and now I only need some TextField, but it is problem for me.
Thanks for any help. Peter.
Instead of using a List you should trying using a Form. This would allow you to append the TextField at the start and ether create a TableItem of possible buttons you can press or use various StringItem objects and clever styling, such as the midp2 view-type.
If I was creating a calculator I would try to use the midp2 view-type approach. This will mean the buttons will scale across the width of the screen. In terrible untested sudo-like code I might do:
//#style calcForm
Form calc = new Form( Locale.get( "calc.title" )); // See the use of J2ME Polish's [Localization][5]
calc.append( myInputField );
calc.append( plusOperator );
...
Where the css for the style might be:
/* Simple white to black gradient background, using midp2 view type styling */
.calcForm {
padding: 2;
padding-left: 10;
padding-right: 10;
background {
type: vertical-gradient; /* See how I have added a little gradient background here*/
top-color: red;
bottom-color: black;
start: 25%;
end: 100%;
}
layout: horizontal-expand | horizontal-center | vertical-center;
view-type: midp2;
}
Using the TableItem method will mean the buttons may not always fit on smaller screens, but you might it find quicker to implement. In terrible untested sudo-like code I might do:
TableItem calcButtons = new TableItem(4, 4); //16 block table 4 by 4
calcButtons.add(0,0, "1"); //Don't trust my 0,0 indexing I sometimes forget
....
calcButtons.addCommand(selectButton);
calcButtons.setItemCommandListener( myViewObj ); //Or whatever is managing the object, it could be the MIDlet
Form calc = new Form( Locale.get("calc.title"));
...
calc.append(calcButtons);
...
Anyway I hope that you find some of this useful and that you can see how some of the other J2ME Polish features work.

Related Links

j2me polish binary compatibility
Problem with textfield - J2ME Polish
J2ME Polish - List and TextField
accurate age input in j2me polish
What is difference between J2ME and J2ME Polish
GPS with J2ME polish
Disabling on screen keyboard

Categories

HOME
rust
spring-data
flask
artificial-intelligence
libgdx
angular-ui-grid
xcode8.1
windows-10
odata
fedora
angular2-template
specifications
hspi
siesta
fireloop
documentum
pm2
heap-dump
temperature
rpmbuild
google-sites
coroutine
renderscript
adobe-illustrator
spring-shell
bluemix-mobile-services
angular2-highcharts
akka-persistence
batch-rename
pdf.js
plyr
cellular-network
morris.js
javax.persistence
es6-modules
tightvnc
vcenter
caesar-cipher
cucumber-junit
ms-media-foundation
android-canvas
aurelia-http-client
text-decorations
sspi
coverage.py
virtual-memory
moinmoin
doctrine-extensions
gcal
roracle
jgrapht
cordova-ios
solr-query-syntax
maven-jaxb2-plugin
portability
rcharts
hmmlearn
annotatorjs
yui3
bigdecimal
pyaudio
groovyfx
android-syncadapter
gulp-uglify
gravatar
diawi
deeplink
decidable
chicagoboss
ora-04091
highest
featuretoggle
modern.ie
relational-model
erlog
sablecc
ssmtp
debug-symbols
pageviews
radius-protocol
proxy-server
apache-shindig
boinc
acitree
oscilloscope
significant-digits
smartfox
linkbutton
multiscaleimage
cgrectmake
chronometer
border-box
struts2-s2hibernate
firebird1.5
will-paginate
motodev-studio
jquery-1.4
suphp
mongrel
tessellation
icicles
principles
accumulator
rootkit

Resources

Encrypt Message