Website Tutorial and Download Program, Design, And News Technology and Lifestyle. We Have Free Download Source Code Project and Update Tutorial. We Sharing For Learning.

Membuat Design aplikasi mengggunakan LnF quaqua(disertakan Project)

Di dalam membangun sebuah aplikasi design atau tampilan adalah salah satu hal yang harus diperhitungkan. di java untuk urusan tampilan sudah banyak library untuk memperindah tampilan aplikasi bertebaran di internet salah satunya adlah quaqua.
kali ini saya akan membahas bagaimana membuat tampilan menggunakan library quaqua


Pertama yang harus kita lakukan adalah membuat project
klik file>New Project selanjutnya isi sesuai dengan keinginan anda masing-masing
Selanjutnya buatlah Jframe From dengan klik di package>New>Jframe Form
lalu masuk ke source mode dan masukan code dibawah ini untuk memanggil LnF  quaqua sebelumnya pastikan anda telah menambahkan library quaqua kedalam project

 public static void main(String args[]) {
      final long start = System.currentTimeMillis();

        final java.util.List argList = Arrays.asList(args);
        // Explicitly turn on font antialiasing.
        try {
            System.setProperty("swing.aatext", "true");
        } catch (AccessControlException e) {
            // can't do anything about this
        }

        // Use screen menu bar, if not switched off explicitly
        try {
            if (System.getProperty("apple.laf.useScreenMenuBar") == null
                    && System.getProperty("com.apple.macos.useScreenMenuBar") == null) {
                System.setProperty("apple.laf.useScreenMenuBar", "true");
                System.setProperty("com.apple.macos.useScreenMenuBar", "true");
            }
        } catch (AccessControlException e) {
            // can't do anything about this
        }

        // Add Quaqua to the lafs
        ArrayList infos = new ArrayList(Arrays.asList(UIManager.getInstalledLookAndFeels()));
        infos.add(new UIManager.LookAndFeelInfo("Quaqua", QuaquaManager.getLookAndFeelClassName()));
        UIManager.setInstalledLookAndFeels(infos.toArray(new UIManager.LookAndFeelInfo[infos.size()]));

        // Turn on look and feel decoration when not running on Mac OS X or Darwin.
        // This will still not look pretty, because we haven't got cast shadows
        // for the frame on other operating systems.
        boolean useDefaultLookAndFeelDecoration =
                !System.getProperty("os.name").toLowerCase().startsWith("mac")
                && !System.getProperty("os.name").toLowerCase().startsWith("darwin");
        int index = argList.indexOf("-decoration");
        if (index != -1 && index < argList.size() - 1) {
            useDefaultLookAndFeelDecoration = argList.get(index + 1).equals("true");
        }

        if (useDefaultLookAndFeelDecoration) {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true);
        }

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
               long edtEnd = System.currentTimeMillis();
                int index;
                index = argList.indexOf("-include");
                if (index != -1 && index < argList.size() - 1) {
                    HashSet includes = new HashSet();
                    includes.addAll(Arrays.asList(((String) argList.get(index + 1)).split(",")));

                    QuaquaManager.setIncludedUIs(includes);
                }
                index = argList.indexOf("-exclude");
                if (index != -1 && index < argList.size() - 1) {
                    HashSet excludes = new HashSet();
                    excludes.addAll(Arrays.asList(((String) argList.get(index + 1)).split(",")));

                    QuaquaManager.setExcludedUIs(excludes);
                }
                index = argList.indexOf("-laf");
                String lafName;
                if (index != -1 && index < argList.size() - 1) {
                    lafName = (String) argList.get(index + 1);
                } else {
                    lafName = QuaquaManager.getLookAndFeelClassName();
                }
                long lafCreate = 0;
                if (!lafName.equals("default")) {

                    if (lafName.equals("system")) {
                        lafName = UIManager.getSystemLookAndFeelClassName();
                    } else if (lafName.equals("crossplatform")) {
                        lafName = UIManager.getCrossPlatformLookAndFeelClassName();
                    }

                    try {
                        //UIManager.setLookAndFeel(lafName);
                        System.out.println("   CREATING LAF   " + lafName);

                        LookAndFeel laf = (LookAndFeel) Class.forName(lafName).newInstance();
                        lafCreate = System.currentTimeMillis();
                        System.out.println("   LAF CREATED   ");
                        System.out.println("   SETTING LAF  ");
                        UIManager.setLookAndFeel(laf);
                        System.out.println("   LAF SET   ");
                    } catch (Exception e) {
                        System.err.println("Error setting " + lafName + " in UIManager.");
                        e.printStackTrace();
                        // can't do anything about this
                    }
                }
                long lafEnd = System.currentTimeMillis();
                JFrame f = new JFrame();
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.setTitle(UIManager.getLookAndFeel().getName() + " "
                        + QuaquaManager.getVersion()
                        + " on Java " + System.getProperty("java.version")
                        + " " + System.getProperty("os.arch"));
                MenuUtama ex = new MenuUtama();
                ex.setVisible(true);
                long end = System.currentTimeMillis();
                System.out.println("QuaquaTest EDT latency=" + (edtEnd - start));
                if (!lafName.equals("default")) {
                    System.out.println("QuaquaTest laf create latency=" + (lafCreate - edtEnd));
                    System.out.println("QuaquaTest set laf latency=" + (lafEnd - lafCreate));
                }
             
                //System.out.println("Main pack latency  ="+(packEnd - createEnd));
                System.out.println("QuaquaTest total startup latency=" + (end - start));
            }
        });

untuk mempermudah bagi kalian yang ingin mempelajari tentang Look and Fell quaqua saya telah menyiapkan project untuk pembelajaran disini

Terima Kasih

Labels: design GUI, full project, java, Java Programing, look and fell, Open Source, programing, quaqua, tutorial

Thanks for reading Membuat Design aplikasi mengggunakan LnF quaqua(disertakan Project). Please share...!

0 Comment for "Membuat Design aplikasi mengggunakan LnF quaqua(disertakan Project)"

Back To Top