0
我想在我的J2ME LWUIT应用程序中显示一个对话框。在对话框中,我可以添加文本区域和按钮。现在我想单击按钮时关闭对话框。我的代码在下面,我想关闭按钮,同时按下“确定”按钮。带自定义按钮的对话框,LWUIT,J2ME
Container dispback = new Container(new BoxLayout(BoxLayout.Y_AXIS));
TextArea textArea = new TextArea(Message); //pass the alert text here
textArea.setFocusable(false);
textArea.setEditable(false);
Font fnt=Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
textArea.getStyle().setFont(fnt);
textArea.getSelectedStyle().setBorder(null);
textArea.getUnselectedStyle().setBorder(null);
textArea.getStyle().setFgColor(0xFF0000);
textArea.getStyle().setBgTransparency(0);
textArea.setIsScrollVisible(false);
textArea.getStyle().setMargin(20,0,0,0);
Button okbut = new Button("OK");
//okbut.setAlignment(Component.CENTER);
okbut.getStyle().setFont(fnt);
okbut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae)
{
**//How to close my dialog here**
}
});
dispback.addComponent(textArea);
okbut.setWidth(10);
dispback.addComponent(okbut);
Dialog.show("SnorkelOTP-Info", dispback, null,0,null);
感谢您的回复。我目前只使用该模型。但问题是,当我调用“dialogName..show(”SnorkelOTP-Info“,撤销,null,0,TransotionObj);” ,“Netbeans”显示警告“访问静态方法显示”。 – DAC84
如果你进入Lwuit类对话框。你可以看到大多数函数表示(...)除了它们之外都是静态的。 – neb1
所以我认为我们应该使用“Dialog.show()”而不是“dialogName.show()”来调用这些函数。我对么?。如果我是正确的,那么我怎么能使用“dialogName.dispose()”。 – DAC84