开发者

J2me, how to create a link in the screen?

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 typ开发者_运维问答ical 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)


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜