Home Java Java Web Programming การพัฒนาโปรแกรม Google Web Toolkit Framework บน Google App Engine
Add Site to FavoritesAdd Page to FavoritesMake HomepageShare This PageEmail This PagePrint This PageSave Page as PDF
Back to Top

Designed by:
VPS hosting Joomla Templates
Web hosting services
การพัฒนาโปรแกรม Google Web Toolkit Framework บน Google App Engine PDF Print E-mail
Written by Administrator   
Sunday, 04 October 2009 15:30

Google Web Toolkit (GWT)เป็น Web Application Framework ที่พัฒนาขึ้นมาโดย Google เพื่อให้นักพัฒนาโปรแกรมสามารถเขียนโปรแกรม Rich Internet Applications (RIAs) แบบ AJAX โดยไม่ต้องเขียนโปรแกรมภาษา JavaScriptแต่สามารถที่จะใช้ภาษา Java ในการพัฒนาได้โดยตรง

 

แบบฝึกหัดนี้เป็นการนำโปรแกรม NetBeans เพื่อมาพัฒนาโปรแกรมโดยใช้ GWT Frameworks แล้วทดลองพัฒนาโปรแกรมเบื้องต้นเพื่อทดสอบการทำงานบน Google App Engine โดยมีขั้นตอนการพัฒนาโปรแกรมดังนี้

  • การติดตั้ง GWT และ ปลั๊กอินของ NetBeans
  • การสร้าง Web Application Project
  • ศึกษาโครงสร้างโปรแกรม Google Web Toolkit
  • การพัฒนาโปรแกรม Client-Side Code

เราสามารถทดสอบโปรแกรมนี้ได้ที่นี http://thaigwtapp.appspot.com/

 

ผู้สนใจสามารถ ดาวน์โหลดเอกสารที่เป็นไฟล์ PDF ได้ที่นี่ => GWTGoogle.pdf


โปรเจ็คไฟล์สำหรับ NetBeans และ Sourcecode สามารถดาวน์โหลดได้ที่นี่ => GWTGoogle.zip

 

 

sourcecode สำหรับไฟล์ MainEntryPoint.java
package org.thaijavadev.client;
 
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
 
/**
 * Main entry point.
 *
 * @author Administrator
 */
public class MainEntryPoint implements EntryPoint {
 
    /**
     * Creates a new instance of MainEntryPoint
     */
    public MainEntryPoint() {
    }
 
    /** 
     * The entry point method, called automatically by loading a module
     * that declares an implementing class as an entry-point
     */
    public void onModuleLoad() {
        final TextBox username = new TextBox();
        final PasswordTextBox password = new PasswordTextBox();
        final Button button = new Button("Logon");
        final VerticalPanel panel = new VerticalPanel();
        panel.add(new Label("username"));
        panel.add(username);
        panel.add(new Label("password"));
        panel.add(password);
        panel.add(button);
        RootPanel.get().add(panel);
 
        button.addClickListener(new ClickListener() {
 
            public void onClick(Widget sender) {
                if ("secret".equals(password.getText())) {
                    Window.alert("Welcome " + username.getText());
                } else {
                    Window.alert("Invalid authentication");
                }
            }
        });
    }
}

 


 




Powered by jWarlock jwFacebook Comments
Last Updated on Thursday, 29 October 2009 07:47
 

Add comment


Security code
Refresh

Thai Java Developers, Powered by Joomla! and designed by SiteGround web hosting