views:

34

answers:

1

Hi, I am developing in J2ME, I need to show a text, and then an underlined link / button that people can press.

I cannot use Canvas.

As a temporal solution, I am using the typical command button but I would like to show this option on screen.

(I don't want to use any framework that implies to change everything so that it has a particular look, only an underlined link)

A: 

I found it, uff!!!

Command  prospectoCommand = new Command("Prospecto", Command.EXIT, 1);

                         StringItem messageItem2 = new StringItem("", "", Item.HYPERLINK);

                         messageItem2.setText("push to go to the URL");

ItemCommandListener listener = new ItemCommandListener() {

                    public void commandAction(Command cmnd, Item item) {

                        if(cmnd==prospectoCommand)
                        {
                            try {
                                midlet.platformRequest(URL);
                            } catch (ConnectionNotFoundException ex) {
                                ex.printStackTrace();
                            }

                        }


                    }
                };

                    messageItem2.setDefaultCommand(prospectoCommand);
netadictos
Thanks for sharing
org.life.java