这是对应的Hello.java文件
package com.hello.client;import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Frame;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Hello implements EntryPoint { private class MyDialog extends DialogBox implements ClickListener {
public MyDialog() {
setText("Sample DialogBox with embedded Frame"); Frame iframe = new Frame("rembrandt/LaMarcheNocturne.html");
Button closeButton = new Button("Close", this);
HTML msg = new HTML(
"<center>This is an example of a standard dialog box component.<br> "
+ "You can put pretty much anything you like into it,<br>such as the "
+ "following IFRAME:</center>", true); DockPanel dock = new DockPanel();
dock.setSpacing(4); dock.add(closeButton, DockPanel.SOUTH);
dock.add(msg, DockPanel.NORTH);
dock.add(iframe, DockPanel.CENTER); dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
dock.setCellWidth(iframe, "100%");
dock.setWidth("100%");
iframe.setWidth("36em");
iframe.setHeight("20em");
setWidget(dock);
} public void onClick(Widget sender) {
hide();
}
} private class HelpDialog extends DialogBox implements ClickListener{
String number = " ";
HTML tip = new HTML(" ");
Button inButton = new Button("CLOSE",this);
public HelpDialog(){
setText("Welcome to use the Help Center");
HTML info = new HTML("You are now in floor n "+"<br>"+"Please press the floor that you want to go",true);
AbsolutePanel ap = new AbsolutePanel();
Button[] floorButton = new Button[10];
for(int i=0;i<10;i++){
floorButton[i] = new Button("F "+(i+1),this);
}
int index =0;
for(int i=0;i<2;i++){
for(int j=0;j<5;j++){
ap.add(floorButton[index],5+45*j,5+35*i);
index++;
}
}
ap.add(tip, 5, 75);
//ap.setStyleName("hello-input-panel");
VerticalPanel dock = new VerticalPanel();
dock.setSpacing(4);
//dock.setStyleName(style)
dock.add(info);
dock.add(ap);
dock.add(inButton);
dock.setCellHorizontalAlignment(inButton, VerticalPanel.ALIGN_RIGHT);
dock.setCellWidth(ap, "100%");
dock.setWidth("100%");
//ap.setWidth("36em");
//ap.setHeight("20em");
setWidget(dock);
this.setStyleName("hello-gwt-DialogBox");
}
public void onClick(Widget sender){
if(sender==inButton){
hide();
}else{
number = sender.getTitle();
tip.setHTML("You select the floor "+number+"<br>"+"System is executing, please waiting...");
}
}
}
/**
* This is the entry point method.
*/
public void onModuleLoad() {
final Button button = new Button("Click me");
final Label label = new Label();
//final HelpDialog hd = new HelpDialog();
button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
DialogBox hd = new HelpDialog();
int left = button.getAbsoluteLeft() + 10;
int top = button.getAbsoluteTop() + 10;
hd.setPopupPosition(left, top);
hd.setVisible(true);
hd.show();
System.out.println(hd.isVisible());
}
}); // Assume that the host HTML has elements defined whose
// IDs are "slot1", "slot2". In a real app, you probably would not want
// to hard-code IDs. Instead, you could, for example, search for all
// elements with a particular CSS class and replace them with widgets.
//
RootPanel.get("slot1").add(button);
RootPanel.get("slot2").add(label);
}
}
package com.hello.client;import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Frame;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Hello implements EntryPoint { private class MyDialog extends DialogBox implements ClickListener {
public MyDialog() {
setText("Sample DialogBox with embedded Frame"); Frame iframe = new Frame("rembrandt/LaMarcheNocturne.html");
Button closeButton = new Button("Close", this);
HTML msg = new HTML(
"<center>This is an example of a standard dialog box component.<br> "
+ "You can put pretty much anything you like into it,<br>such as the "
+ "following IFRAME:</center>", true); DockPanel dock = new DockPanel();
dock.setSpacing(4); dock.add(closeButton, DockPanel.SOUTH);
dock.add(msg, DockPanel.NORTH);
dock.add(iframe, DockPanel.CENTER); dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
dock.setCellWidth(iframe, "100%");
dock.setWidth("100%");
iframe.setWidth("36em");
iframe.setHeight("20em");
setWidget(dock);
} public void onClick(Widget sender) {
hide();
}
} private class HelpDialog extends DialogBox implements ClickListener{
String number = " ";
HTML tip = new HTML(" ");
Button inButton = new Button("CLOSE",this);
public HelpDialog(){
setText("Welcome to use the Help Center");
HTML info = new HTML("You are now in floor n "+"<br>"+"Please press the floor that you want to go",true);
AbsolutePanel ap = new AbsolutePanel();
Button[] floorButton = new Button[10];
for(int i=0;i<10;i++){
floorButton[i] = new Button("F "+(i+1),this);
}
int index =0;
for(int i=0;i<2;i++){
for(int j=0;j<5;j++){
ap.add(floorButton[index],5+45*j,5+35*i);
index++;
}
}
ap.add(tip, 5, 75);
//ap.setStyleName("hello-input-panel");
VerticalPanel dock = new VerticalPanel();
dock.setSpacing(4);
//dock.setStyleName(style)
dock.add(info);
dock.add(ap);
dock.add(inButton);
dock.setCellHorizontalAlignment(inButton, VerticalPanel.ALIGN_RIGHT);
dock.setCellWidth(ap, "100%");
dock.setWidth("100%");
//ap.setWidth("36em");
//ap.setHeight("20em");
setWidget(dock);
this.setStyleName("hello-gwt-DialogBox");
}
public void onClick(Widget sender){
if(sender==inButton){
hide();
}else{
number = sender.getTitle();
tip.setHTML("You select the floor "+number+"<br>"+"System is executing, please waiting...");
}
}
}
/**
* This is the entry point method.
*/
public void onModuleLoad() {
final Button button = new Button("Click me");
final Label label = new Label();
//final HelpDialog hd = new HelpDialog();
button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
DialogBox hd = new HelpDialog();
int left = button.getAbsoluteLeft() + 10;
int top = button.getAbsoluteTop() + 10;
hd.setPopupPosition(left, top);
hd.setVisible(true);
hd.show();
System.out.println(hd.isVisible());
}
}); // Assume that the host HTML has elements defined whose
// IDs are "slot1", "slot2". In a real app, you probably would not want
// to hard-code IDs. Instead, you could, for example, search for all
// elements with a particular CSS class and replace them with widgets.
//
RootPanel.get("slot1").add(button);
RootPanel.get("slot2").add(label);
}
}
解决方案 »
- 两台Windows系统与DOS系统电脑间数据传输
- 关于FCK编辑器的问题
- 请求一个固定时间向数据库插入随机数的实例
- tomcat配好以后,那些管理和jsp-example也都能出来,我把一个jsp文件放在jsp-example下,为什么编译不了?
- Struts完全中文显示解决方案,Struts 数据库应用向导,请下载新版的JSPStudio(2003-8-26版本),地址:ftp://210.36.70.51
- 关于Struts配置文件的问题,高手请进
- 求书(300分,但是最多只能放100分在这个问题上,不知怎么回事, 可以通过其它途径给分)
- 自己定义CMP的finder定位器的问题
- 我要学jsp,已经下载了j2ee1.4,需要一个支持jsp引擎的WEB服务器或jsp引擎!!(急,马上给分)
- hibernate并发的问题
- 如何开发电子地图?
- hibernate到底有多少实用价值???
还是不行的话检查一下 href 引用路径是否正确。