A 想让我的 Widget 可拖动。A 使用 GWT 和 d&d。这是我的代码,但它不起作用..
@SuppressWarnings("deprecation")
public class StickWidget extends Composite implements SourcesMouseEvents {
private static StickWidgetUiBinder uiBinder = GWT
.create(StickWidgetUiBinder.class);
@UiField Label title;
@UiField HTML content;
interface StickWidgetUiBinder extends UiBinder<Widget, StickWidget> {
}
public StickWidget(String title, String content, String width, String height) {
super();
initWidget(uiBinder.createAndBindUi(this));
this.content.setText(content);
this.title.setText(title);
this.setWidth(width);
this.setHeight(height);
}
public StickWidget(String title, String content) {
initWidget(uiBinder.createAndBindUi(this));
this.content.setText(content);
this.title.setText(title);
}
@Override
public void addMouseListener(MouseListener listener) {
// TODO Auto-generated method stub
}
@Override
public void removeMouseListener(MouseListener listener) {
// TODO Auto-generated method stub
}
}
和我的入口点的片段:
StickWidget a = new StickWidget("gg", "gg", "20px", "200px");
DropTargetStick dropT = new DropTargetStick(new Label("fdgf"));
PickupDragController dragController = new PickupDragController (RootPanel.get(), false);
dragController.registerDropController(dropT);
dragController.makeDraggable(a);
我想我完成了所有允许我拖放我的小部件的步骤..但它不起作用..