Example usage for javax.swing UIManager put

List of usage examples for javax.swing UIManager put

Introduction

In this page you can find the example usage for javax.swing UIManager put.

Prototype

public static Object put(Object key, Object value) 

Source Link

Document

Stores an object in the developer defaults.

Usage

From source file:components.TextFieldDemo.java

public static void main(String args[]) {
    //Schedule a job for the event dispatch thread:
    //creating and showing this application's GUI.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            //Turn off metal's use of bold fonts
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            new TextFieldDemo().setVisible(true);
        }/* ww w.  jav  a 2s.  c o m*/
    });
}

From source file:TextAreaDemo.java

public static void main(String args[]) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            // Turn off metal's use of bold fonts
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            new TextAreaDemo().setVisible(true);
        }/*from  ww  w  . ja v  a2 s .  c o m*/
    });
}

From source file:TextFieldDemo.java

public static void main(String args[]) {
    // Schedule a job for the event dispatch thread:
    // creating and showing this application's GUI.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            // Turn off metal's use of bold fonts
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            new TextFieldDemo().setVisible(true);
        }//from w  ww.j  av  a2  s . c  o  m
    });
}

From source file:TopLevelTransferHandlerDemo.java

public static void main(final String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            //Turn off metal's use of bold fonts
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            createAndShowGUI(args);/*from w  w  w  . j  a  v  a  2 s .c om*/
        }
    });
}

From source file:MonitorSaurausRex.MainMenu.java

/**
 * @param args the command line arguments
 *//*from ww  w . j a  v a 2s.  co m*/
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    }
    //</editor-fold>
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new MainMenu().setVisible(true);
        }
    });

    /* Use an appropriate Look and Feel */
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException
            | ClassNotFoundException ex) {
    }
    /* Turn off metal's use of bold fonts */
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    //Schedule a job for the event-dispatching thread:
    //adding TrayIcon.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
}

From source file:modnlp.capte.AlignmentInterfaceWS.java

public static void main(String args[]) {
    try {/*from  www .jav  a2 s  .  c  om*/
        //set splitting action equal to true
        //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        doSplit = true;
        //default AlreadyRun to false
        AlreadyRun = false;
        //lineConvert = true;
        lineConvert = true;
        // Read config file
        boolean isMac = false;
        boolean isWin = false;
        boolean isUnix = false;
        String tmp = "";
        String winsep = "\\";
        String unixsep = "/";
        String ostype = System.getProperty("os.name").toLowerCase();
        System.out.println("Operating system type =>" + ostype);
        if (ostype.indexOf("win") >= 0) {
            isWin = true;
            isUnix = false;
            isMac = false;
        } else if ((ostype.indexOf("nix") >= 0) || (ostype.indexOf("nux") >= 0)) {
            isUnix = true;
            isWin = false;
            isMac = false;
        } else if (ostype.indexOf("mac") >= 0) {
            isWin = false;
            isUnix = false;
            isMac = true;
        } else {
            throw new UnsupportedOperationException("your OS is not supported!");
        }
        //creating and showing this application's GUI.
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                //Turn off metal's use of bold fonts
                UIManager.put("swing.boldMetal", Boolean.FALSE);
                createAndShowGUI();
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void setFontSize(int size) {

    for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {

        Object key = keys.nextElement();

        Object value = UIManager.get(key);

        if (value instanceof FontUIResource) {

            UIManager.put(key, ((FontUIResource) value).deriveFont((float) size));

        }//from  w w w  .  j  a v a 2  s .  c  o m

    }

}

From source file:Main.java

public static void lookNimbus(Component comp) {
    UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo look : looks) {
        if (look.getClassName().matches("(?i).*nimbus.*")) {
            try {
                UIManager.setLookAndFeel(look.getClassName());

                //                UIManager.put("control", Color.decode("#cccccc"));
                UIManager.put("info", Color.decode("#ff9900"));
                //                UIManager.put("nimbusAlertYellow", Color.decode("#ff0000"));
                //                UIManager.put("nimbusBase", Color.decode("#4e5a66"));
                //                UIManager.put("nimbusDisabledText", Color.decode("#9900ff"));
                UIManager.put("nimbusFocus", Color.decode("#ff9933"));
                //                UIManager.put("nimbusGreen", new Color(130, 133, 37));
                //                UIManager.put("nimbusInfoBlue", Color.decode("#9900ff"));
                //                UIManager.put("nimbusLightBackground", Color.decode("#9900ff"));
                //                UIManager.put("nimbusOrange", new Color(191, 98, 4));
                //                UIManager.put("nimbusRed", new Color(169, 46, 34));
                //                UIManager.put("nimbusSelectedText", Color.decode("#ff00ff"));
                UIManager.put("nimbusSelectionBackground", Color.decode("#465059"));
                //                UIManager.put("text", new Color(0, 0, 0));

                UIManager.put("nimbusSelection", Color.decode("#465059"));
                //                UIManager.put("Menu.background", Color.decode("#0066ff"));
                //                UIManager.put("Menu[Enabled+Selected].backgroundPainter", Color.BLUE);

                SwingUtilities.updateComponentTreeUI(comp);
                return;
            } catch (Exception e) {
                e.printStackTrace();//w w  w . j  av  a2  s. co m
            }
        }
    }
}

From source file:Main.java

public static void setUIFont(FontUIResource f) {
    ///*from ww  w  .  j  a v a  2s  .  c  o m*/
    // sets the default FONT for all Swing components.
    // ex.
    // setUIFont (new javax.swing.plaf.FontUIResource
    // ("Serif",Font.ITALIC,12));
    //
    Enumeration<Object> keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof FontUIResource)
            UIManager.put(key, f);
    }
}

From source file:Main.java

public static void setUIFont(Font f) {
    ////  w w  w . j  a v  a  2s .  c  o  m
    // sets the default font for all Swing components.
    // ex. 
    //  setUIFont (new javax.swing.plaf.FontUIResource("Serif",Font.ITALIC,12));
    //
    FontUIResource fur = new FontUIResource(f);
    java.util.Enumeration keys = UIManager.getDefaults().keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        Object value = UIManager.get(key);
        if (value instanceof javax.swing.plaf.FontUIResource)
            UIManager.put(key, fur);
    }
}