Skip to main content

TextField - it's difficult to typing

9 replies [Last post]
sawal_xp
Offline
Joined: 2008-02-12
Points: 0

hi..
now i in textfield problem..
i use textfield to input text...
but when i type in this textfield, my text is not show..it difficult to type in textfield
sometime is closed with the "Abc" symbol...
so when i type the text, the symbol "Abc" close my text..

for more clearly, i has upload my picture to show my textfield problem is..

http://www.4shared.com/file/55210712/c9d06de5/pic1.html

and this is my code...

<br />
public class ResearchTextField extends MIDlet implements ActionListener {<br />
    Command quitCM;</p>
<p>    public void startApp() {<br />
        try {<br />
            Display.init(this);<br />
            Resources resource = Resources.open("/res/myTheme.res");<br />
            UIManager.getInstance().setThemeProps(resource.getTheme("javaTheme"));</p>
<p>            Form myForm = new Form();<br />
            myForm.setTitle("Test Form");<br />
            myForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));<br />
            myForm.setCommandListener(this);</p>
<p>            TextField firstTF = new TextField();<br />
            myForm.addComponent(firstTF);</p>
<p>            TextField secondTF = new TextField();<br />
            myForm.addComponent(createPair("Username", secondTF, 100));</p>
<p>            quitCM = new Command("Quit");<br />
            myForm.addCommand(quitCM);</p>
<p>            myForm.show();<br />
        } catch (IOException ex) {<br />
            ex.printStackTrace();<br />
        }<br />
    }</p>
<p>    public void pauseApp() {<br />
    }</p>
<p>    public void destroyApp(boolean unconditional) {<br />
    }</p>
<p>    public Container createPair(String label, Component c, int minWidth) {<br />
        Container pair = new Container(new BorderLayout());<br />
        pair.getStyle().setMargin(1, 1, 1, 1);<br />
        Label l=  new Label(label);<br />
        int aa = Math.max(l.getPreferredW(), minWidth);<br />
        l.setPreferredW(aa);<br />
        l.getStyle().setBgTransparency(80);<br />
        pair.addComponent(BorderLayout.WEST,l);<br />
        pair.addComponent(BorderLayout.CENTER, c);<br />
        return pair;<br />
    }</p>
<p>    public void actionPerformed(ActionEvent evt) {<br />
        if(evt.getSource() == quitCM){<br />
            notifyDestroyed();<br />
        }<br />
    }</p>
<p>}</p>
<p>

please help me..thx..:)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chen

Hi,
I tried your code and it works fine for me.
Verify the TextField colors are defines correctly in your Theme.
TextField.bgColor != TextField.fgColor, TextField.fgSelectionColor !=
TextField.bgSelectionColor

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> hi..
> now i in textfield problem..
> i use textfield to input text...
> but when i type in this textfield, my text is not show..it difficult to type in textfield
> sometime is closed with the "Abc" symbol...
> so when i type the text, the symbol "Abc" close my text..
>
> for more clearly, i has upload my picture to show my textfield problem is..
>
> [url]http://www.4shared.com/file/55210712/c9d06de5/pic1.html[/url]
>
> and this is my code...
>
> [code]
> public class ResearchTextField extends MIDlet implements ActionListener {
> Command quitCM;
>
> public void startApp() {
> try {
> Display.init(this);
> Resources resource = Resources.open("/res/myTheme.res");
> UIManager.getInstance().setThemeProps(resource.getTheme("javaTheme"));
>
> Form myForm = new Form();
> myForm.setTitle("Test Form");
> myForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
> myForm.setCommandListener(this);
>
> TextField firstTF = new TextField();
> myForm.addComponent(firstTF);
>
> TextField secondTF = new TextField();
> myForm.addComponent(createPair("Username", secondTF, 100));
>
> quitCM = new Command("Quit");
> myForm.addCommand(quitCM);
>
> myForm.show();
> } catch (IOException ex) {
> ex.printStackTrace();
> }
> }
>
> public void pauseApp() {
> }
>
> public void destroyApp(boolean unconditional) {
> }
>
> public Container createPair(String label, Component c, int minWidth) {
> Container pair = new Container(new BorderLayout());
> pair.getStyle().setMargin(1, 1, 1, 1);
> Label l= new Label(label);
> int aa = Math.max(l.getPreferredW(), minWidth);
> l.setPreferredW(aa);
> l.getStyle().setBgTransparency(80);
> pair.addComponent(BorderLayout.WEST,l);
> pair.addComponent(BorderLayout.CENTER, c);
> return pair;
> }
>
> public void actionPerformed(ActionEvent evt) {
> if(evt.getSource() == quitCM){
> notifyDestroyed();
> }
> }
>
> }
>
> [/code]
>
> please help me..thx..:)
> [Message sent by forum member 'sawal_xp' (sawal_xp)]
>
> http://forums.java.net/jive/thread.jspa?messageID=286611
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

sawal_xp
Offline
Joined: 2008-02-12
Points: 0

hi chen, thaks to tried my code..
in my code, Textfield secondTF, the symbol "Abc" in left side from the textfield is closing my text when i am typing to that textfield...

for more clearly, i show in this picture
[url]http://www.4shared.com/file/55365681/ce7b12a6/pic2.html[/url]

can the "Abc" symbol not show in my textfield..?

chen

Hi,
Are you using the latest version?I believe this issue was resolved.

Chen

lwuit-users@mobileandembedded.org wrote:
> hi chen, thaks to tried my code..
> in my code, Textfield secondTF, the symbol "Abc" in left side from the textfield is closing my text when i am typing to that textfield...
>
> for more clearly, i show in this picture
> [url]http://www.4shared.com/file/55365681/ce7b12a6/pic2.html[/url]
>
> can the "Abc" symbol not show in my textfield..?
> [Message sent by forum member 'sawal_xp' (sawal_xp)]
>
> http://forums.java.net/jive/thread.jspa?messageID=286926
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

sawal_xp
Offline
Joined: 2008-02-12
Points: 0

hi chen
thx for your reply..:)
ok i have download the new version, and use it. I'm not found the same problem again..
thx..:)

sawal_xp
Offline
Joined: 2008-02-12
Points: 0

hi All, i get problem again with textfield..

In QWERTY device(I'm in nokia E90),
when typing some character like R, P, G, V..
when user type them, the textfield focus go to the other textfield in the form....

ex : if in form there are textfield A and B, then the user typing in textfield A and type the character like R, P, G or V, the focus will go to textfield B. It alwasys happen when the user type the characters...

help me...?
is this bug from textfield again...?...:(

Shai Almog

Hi,
this seems like an issue where the E90 treats these elements as game
keys... This might be a bit of a problem to debug without a device
and might not be easily worked around.
I suggest starting with overriding:
protected boolean isEditingEndTrigger(int keyCode) {
int k =Display.getInstance().getGameAction(keyCode);
return keyCode < 0 && (k == Display.GAME_FIRE || k ==
Display.GAME_UP || k == Display.GAME_DOWN);
}

> hi All, i get problem again with textfield..
>
> In QWERTY device(I'm in nokia E90),
> when typing some character like R, P, G, V..
> when user type them, the textfield focus go to the other textfield
> in the form....
>
> ex : if in form there are textfield A and B, then the user typing
> in textfield A and type the character like R, P, G or V, the focus
> will go to textfield B. It alwasys happen when the user type the
> characters...
>
> help me...?
> is this bug from textfield again...?...:(
> [Message sent by forum member 'sawal_xp' (sawal_xp)]
>
> http://forums.java.net/jive/thread.jspa?messageID=292955
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

sawal_xp
Offline
Joined: 2008-02-12
Points: 0

hi Shai, thx for your question and your solution..:)
it run well in my device..E90
but, it's will working good if we enter the textfield, or when the softkey display Clear and T9..

Can it work if we not enter to the textfield, so just in focus to textfield, and type some character (R, P, V, and etc) and it will run like we enter to it, can it?

thx shai..:)

Shai Almog

Hi,
try overriding this too:
protected boolean isEditingTrigger(int keyCode) {
return (keyCode > 0) ||
(Display.getInstance().getGameAction(keyCode) ==
Display.GAME_FIRE);
}

> hi Shai, thx for your question and your solution..:)
> it run well in my device..E90
> but, it's will working good if we enter the textfield, or when the
> softkey display Clear and T9..
>
> Can it work if we not enter to the textfield, so just in focus to
> textfield, and type some character (R, P, V, and etc) and it will
> run like we enter to it, can it?
>
> thx shai..:)
> [Message sent by forum member 'sawal_xp' (sawal_xp)]
>
> http://forums.java.net/jive/thread.jspa?messageID=293214
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

sawal_xp
Offline
Joined: 2008-02-12
Points: 0

hi shai..
i have add your code, and working good, much better now...:)

thx shai..:)