Example usage for com.jgoodies.common.base SystemUtils IS_OS_WINDOWS

List of usage examples for com.jgoodies.common.base SystemUtils IS_OS_WINDOWS

Introduction

In this page you can find the example usage for com.jgoodies.common.base SystemUtils IS_OS_WINDOWS.

Prototype

boolean IS_OS_WINDOWS

To view the source code for com.jgoodies.common.base SystemUtils IS_OS_WINDOWS.

Click Source Link

Document

True if this is Windows.

Usage

From source file:de.htwk_leipzig.naoteam.motion.editor.gui.MainApplication.java

License:Open Source License

/**
 * Initialize the Look'n'Feel for the Application
 *///  w ww  . ja  va  2  s .co  m
protected void initializeLookAndFeel() {
    try {
        if (SystemUtils.IS_OS_WINDOWS) {
            UIManager.setLookAndFeel("com.jgoodies.looks.windows.WindowsLookAndFeel");
        } else if (SystemUtils.IS_OS_MAC) {
            // do nothing, use the Mac Aqua L&f
        } else {
            UIManager.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceModerateLookAndFeel");
        }
    } catch (final Exception e) {
        // Likely the Looks library is not in the class path; ignore.
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
}

From source file:org.epri.pt2.gui.TestExecutionTask.java

License:Open Source License

public void executeTask() {
    Thread thread = new Thread(new Runnable() {
        public void run() {
            try {
                String command = testCase.getCommand() + testScript.getParams();

                if (SystemUtils.IS_OS_WINDOWS) {
                    p = Runtime.getRuntime().exec(command, new String[] {}, new File(testCase.getDirectory()));
                } else {
                    p = Runtime.getRuntime().exec(
                            new String[] { "bash", "-c", "cd " + testCase.getDirectory() + "; " + command });
                }//from w ww .  java 2 s  .  c  o  m

                Field f = p.getClass().getDeclaredField("pid");
                f.setAccessible(true);
                pid = f.get(p);

                BufferedReader buffRead = new BufferedReader(new InputStreamReader(p.getInputStream()));

                String line = "";

                statusArea = StatusArea.getInstance()
                        .addRunTab("(" + testCase.getId() + ") " + testCase.getName(), TestExecutionTask.this);

                statusArea.append(testCase.getCommand() + testScript.getParams() + "\r\n");
                statusArea.append("cd " + testCase.getDirectory() + "; " + command);

                while ((line = buffRead.readLine()) != null) {
                    statusArea.append(line + "\r\n");
                    Thread.sleep(250);
                }

                int exitVal = p.waitFor();

                statusArea.append("ExitCode: " + exitVal);

            } catch (IOException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    });

    thread.start();

}