Jumat, 26 Juli 2013

Integrasi Glade Interface Designer Dengan Java




Pembahasan kali ini yaitu tentang Integrasi Glade Interface Designer Dengan Java. Sesuai dengan judulnya, Glade adalahs ebuah software untuk membangun GUI khususnya dilingkungan Gnome. Software nya dapat Anda unduh disni atau apabila Anda menggunakan Ubuntu, Glade sudah ada dalam Software Center nya tinggal install. 
Dengan dijalankan menggunakan Java mudah-mudahan tutorial ini dapat membantu Anda dalam menambah wawasan khususnya dibidang OpenSource.





 
 

Adapun Source Java nya yaitu :

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pglglade;

import java.io.FileNotFoundException;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.gnome.gdk.Event;
import org.gnome.gtk.Builder;
import org.gnome.gtk.Gtk;
import org.gnome.gtk.Widget;
import org.gnome.gtk.Window;

/**
 *
 * @author laptop-1
 */
public class PglGlade {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Gtk.init(args);
        try {
            // TODO code application logic here
            Builder builder = new Builder();
//            builder.addFromFile("TDAService.glade");
            builder.addFromFile("coba1.glade");
//            builder.addFromFile("test1.glade");

//            Window win = (Window) builder.getObject("objectProperties");
//            Window win = (Window) builder.getObject("gunSettingsWindow");
//            Window win = (Window) builder.getObject("dataLinkSetting");
            Window win = (Window) builder.getObject("TDSMonitoring");
//            Window win = (Window) builder.getObject("objectProperties2");
//            Window win = (Window) builder.getObject("objectIdentity");
//            Window win = (Window) builder.getObject("Kinematics");
//            Window win = (Window) builder.getObject("object_ctrl_window");
//            Window win = (Window) builder.getObject("nav_data_ctrl_window");
//            Wind ow win = (Window) builder.getObject("ppi_radar_ctrl_window");
//            Window win = (Window) builder.getObject("video_dist_ctrl_window");
//            Window win = (Window) builder.getObject("pro_mht_ctrl_window");
            win.connect(new Window.DeleteEvent() {

                @Override
                public boolean onDeleteEvent(Widget widget, Event event) {
                    Gtk.mainQuit();
                    return false;
                }
            });
            win.showAll();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(PglGlade.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ParseException ex) {
            Logger.getLogger(PglGlade.class.getName()).log(Level.SEVERE, null, ex);
        }
        Gtk.main();
    }
}



0 komentar:

Posting Komentar