Example usage for weka.gui LookAndFeel setLookAndFeel

List of usage examples for weka.gui LookAndFeel setLookAndFeel

Introduction

In this page you can find the example usage for weka.gui LookAndFeel setLookAndFeel.

Prototype

public static boolean setLookAndFeel() 

Source Link

Document

sets the look and feel to the one in the props-file or if not set the default one of the system

Usage

From source file:meka.gui.dataviewer.DataViewer.java

License:Open Source License

/**
 * shows the frame and it tries to load all the arff files that were provided
 * as arguments./*from ww  w .  j  av a  2s  .co m*/
 *
 * @param args the commandline parameters
 * @throws Exception if something goes wrong
 */
public static void main(String[] args) throws Exception {
    weka.core.logging.Logger.log(weka.core.logging.Logger.Level.INFO, "Logging started");
    LookAndFeel.setLookAndFeel();

    try {
        // uncomment to disable the memory management:
        // m_Memory.setEnabled(false);

        m_Viewer = new DataViewer();
        m_Viewer.setExitOnClose(true);
        m_Viewer.setVisible(true);
        m_FilesLoaded = false;
        m_Args = args;

        Thread memMonitor = new Thread() {
            @Override
            public void run() {
                while (true) {
                    // try {
                    if ((m_Args.length > 0) && (!m_FilesLoaded)) {
                        for (int i = 0; i < m_Args.length; i++) {
                            System.out.println(
                                    "Loading " + (i + 1) + "/" + m_Args.length + ": '" + m_Args[i] + "'...");
                            m_Viewer.getMainPanel().loadFile(m_Args[i]);
                        }
                        m_Viewer.getMainPanel().getTabbedPane().setSelectedIndex(0);
                        System.out.println("Finished!");
                        m_FilesLoaded = true;
                    }

                    // System.out.println("before sleeping");
                    // Thread.sleep(10);

                    if (m_Memory.isOutOfMemory()) {
                        // clean up
                        m_Viewer.dispose();
                        m_Viewer = null;
                        System.gc();

                        // display error
                        System.err.println("\ndisplayed message:");
                        m_Memory.showOutOfMemory();
                        System.err.println("\nrestarting...");

                        // restart GUI
                        System.gc();
                        m_Viewer = new DataViewer();
                        m_Viewer.setExitOnClose(true);
                        m_Viewer.setVisible(true);
                        // Note: no re-loading of datasets, otherwise we could end up
                        // in an endless loop!
                    }
                    // } catch (InterruptedException ex) {
                    // ex.printStackTrace();
                    // }
                }
            }
        };

        memMonitor.setPriority(Thread.NORM_PRIORITY);
        memMonitor.start();
    } catch (Exception ex) {
        ex.printStackTrace();
        System.err.println(ex.getMessage());
    }
}