How to make web based a wordpad using gwt


gwt is one of the best ways to develop user frendly web applications this is my first project done using
gwt i want be able to put the complete code because its too long but i'll put a few useful codes
Creating a menuBar(this goes in the class that extends EntryPoint)
MenuBar menu = new MenuBar();
menu.setAutoOpen(true);
menu.setWidth("500px");
menu.setAnimationEnabled(true);
// Create the file menu
MenuBar fileMenu = new MenuBar(true);
fileMenu.setAnimationEnabled(true);
menu.addItem(new MenuItem(constants.cwMenuBarFileCategory(), fileMenu));
String[] fileOptions = {"New","Open","Save","Save As","Print","Print Preview","Exit"};
for (int i = 0; i <fileOptions.length; i++) {
fileMenu.addItem(fileOptions[i], menuCommand);
fileMenu.addSeparator();
}
// Create the edit menu
MenuBar editMenu = new MenuBar(true);
menu.addItem(new MenuItem(constants.cwMenuBarEditCategory(), editMenu));
String[] editOptions = {"Undo","Cut","Copy","Paste","SelcetAll","Clear"};
for (int i = 0; i <editOptions.length; i++) {
editMenu.addItem(editOptions[i], menuCommand);
}
}Now menuCommand is were you put the coding for the action when the link is clicked you will have to useone for each here i only used one.first make another class
CommandHere.java
Command menuCommand = new Command() {
public void execute() {
Window.alert("you just clicked it");
}
};
public Command getMenuCommand() {
return menuCommand;
}
Using a dialogBox to insert Bullets into a text area and how to use popups to make it user frendly
Button bullets=new Button();
RichTextArea ta=new RichTextArea();
final DecoratedPopupPanel bulletpop=new DecoratedPopupPanel(true, false);
bulletpop.ensureDebugId("cwBasicPopup-simplePopup");
bulletpop.setWidth("10px");
bullets.addMouseOverHandler(new MouseOverHandler() {
public void onMouseOver(MouseOverEvent event) {
int left = 620;
int top = 55;
bulletpop.setPopupPosition(left, top);
bulletpop.setWidget(new Label("bullets"));
bulletpop.show();
}
});
bullets.addMouseOutHandler(new MouseOutHandler() {
public void onMouseOut(MouseOutEvent event) {
bulletpop.hide();
}
});
bullets.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
ta.getExtendedFormatter().insertUnorderedList();
}
});
Comments
Post a Comment