[英]GWT Drag and drop
I created a simple application: 我创建了一个简单的应用程序:
public class GWTDradAndDrop implements EntryPoint {
public void onModuleLoad() {
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.setSpacing(10);
verticalPanel.add(new DrugButton("test"));
RootPanel.get().add(verticalPanel);
}
}
DrugButton
class: DrugButton
类:
public class DrugButton extends Button {
private static DrugButton dragging = null;
public DrugButton(String text) {
super(text);
setWidth("200px");
initClick();
}
private void initClick() {
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.alert("dsdsdsa");
}
});
}
}
Tell me how can I add a drag event to this widget (button)? 告诉我如何将拖动事件添加到此小部件(按钮)?
You need add handlers to your button for a set of drag events. 您需要为按钮的一组添加事件添加处理程序。
Here the documentation: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/FocusWidget.html#addDragHandler-com.google.gwt.event.dom.client.DragHandler- 此处的文档: http : //www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/FocusWidget.html#addDragHandler-com.google.gwt.event.dom.client.DragHandler-
And here a bunch of demos about drag and drop, hopefully seeing some code will make the issue more clear: https://gwt-dnd.appspot.com/ 这里是一堆有关拖放的演示,希望看到一些代码可以使问题更加清楚: https : //gwt-dnd.appspot.com/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.