Java 8 LookAndFeel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LookAndFeel class.

This code example shows how to use the following methods:getClass, getID
            return (LayoutStyle)layoutImpl; 
        } 
        LookAndFeel currentLAF = UIManager.getLookAndFeel();
        if (layoutStyle == null || currentLAF != laf) {
            laf = currentLAF;
            String lafID= laf.getID();
            if (USE_CORE_LAYOUT_STYLE) {
                if ("Aqua" == lafID) {
                    try { 
                        currentLAF.getClass().getDeclaredMethod("getLayoutStyle", new Class[0]);
                        layoutStyle = new SwingLayoutStyle();
                    } catch (NoSuchMethodException nsfex) {
                        // getLayoutStyle() not overriden => use our own (issue 52) 
                        layoutStyle = new AquaLayoutStyle();
                    } 
                } else { 
                    layoutStyle = new SwingLayoutStyle();
                } 
            } else if ("Metal" == lafID) {
                layoutStyle = new MetalLayoutStyle();
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getDefaults, initialize
        String name = UIManager.getSystemLookAndFeelClassName();
        if (name != null) {
            try { 
                Class<?> clazz = Class.forName(name);
                LookAndFeel lf = (LookAndFeel) clazz.newInstance();
                lf.initialize();
                UIDefaults def = lf.getDefaults();
                ret = def.getUI(c);
            } catch (ExceptionInInitializerError e) {
            } catch (ClassNotFoundException e) {
            } catch (LinkageError e) {
            } catch (IllegalAccessException e) {
            } catch (InstantiationException e) {
            } catch (SecurityException e) {
            } catch (ClassCastException e) {
            } 
        } 
 
        // if any of those failed, default to the current UI. 
        if (ret == null)
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:isSupportedLookAndFeel
    public boolean haveLookAndFeel( String look )
    { 
        try { 
            Class lookClass = this.getClass().forName( look );
            LookAndFeel newLook = (LookAndFeel) ( lookClass.newInstance() );
            return newLook.isSupportedLookAndFeel();
        } 
        catch ( Exception e ) {
            return false; 
        } 
    } 
 
    /** 
     * Add all the known themes to another menu. 
     */ 
    protected void addThemes() 
    { 
        //  Add colour theme support. 
        themeMenu = new JMenu( "Colour theme" );
        targetMenu.add( themeMenu );
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getClass, getName
        lafDefaults = UIManager.getLookAndFeelDefaults();
        if (lookAndFeel instanceof MetalLookAndFeel) {
            WINDOW = lafDefaults.getColor("window");
            WINDOW_BORDER = lafDefaults.getColor("windowBorder");
        } else 
        if(lookAndFeel.getClass().getSimpleName().equalsIgnoreCase("NimbusLookAndFeel")) {
            WINDOW = lafDefaults.getColor("Panel.background");
            WINDOW_BORDER = lafDefaults.getColor("nimbusBorder");
        } else { 
            logger.error("Look and Feel reference is invalid: "
                    + lookAndFeel.getName() + ". MCT is closing.");
            System.exit(1);
        } 
        MENUBAR_BACKGROUND = lafDefaults.getColor("MenuBar.background");
        TREE_SELECTION_BACKGROUND = lafDefaults.getColor("Tree.selectionBackground");
        TEXT_HIGHLIGHT = lafDefaults.getColor("textHighlight");
 
        LafColor.refresh(); 
    } 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:uninitialize
	/* (non-Javadoc) 
	 * @see com.projity.pm.graphic.laf.LafManager1#clean() 
	 */ 
	public void clean(){ 
		if (plaf!=null){
			plaf.uninitialize();
			plaf = null;
		} 
	} 
 
    public static boolean isLafOk() { 
    	if (lafOK == null) {
	    	UIDefaults d = UIManager.getDefaults();
	    	Object cl = d.get("ClassLoader");
	    	JPanel target = new JPanel();
	    	ClassLoader uiClassLoader =
	    		(cl != null) ? (ClassLoader)cl : target.getClass().getClassLoader();
	    	Class uiClass = d.getUIClass(target.getUIClassID(), uiClassLoader);
	    	lafOK = (uiClass != null);
    	} 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 LookAndFeel Methods: