當前位置: 首頁>>代碼示例>>Java>>正文


Java LookAndFeelInfo類代碼示例

本文整理匯總了Java中javax.swing.UIManager.LookAndFeelInfo的典型用法代碼示例。如果您正苦於以下問題:Java LookAndFeelInfo類的具體用法?Java LookAndFeelInfo怎麽用?Java LookAndFeelInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LookAndFeelInfo類屬於javax.swing.UIManager包,在下文中一共展示了LookAndFeelInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeLookAndFeel

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void initializeLookAndFeel() {

		try {

			for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {

				if ("Nimbus".equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		}

		catch (Exception exception) {

		}
	}
 
開發者ID:Gallery-of-Kaeon,項目名稱:Kaeon-FUSION,代碼行數:18,代碼來源:IDE.java

示例2: main

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void main(String s[]) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:TableExample.java

示例3: setLookAndFeel

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static boolean setLookAndFeel(String classname, String name) {
	if((classname==null||classname.isEmpty())&&(name==null||name.isEmpty()))
		return false;
	try {
		UIManager.setLookAndFeel(classname);
		usingNimbusLookAndFeel = UIManager.getLookAndFeel().getName().equals("Nimbus");
		return true;
	}	catch(Exception e_a) {
		try {
			for(LookAndFeelInfo look_and_feel:UIManager.getInstalledLookAndFeels())
				if(name.equals(look_and_feel.getName())) {
					UIManager.setLookAndFeel(look_and_feel.getClassName());
					usingNimbusLookAndFeel = UIManager.getLookAndFeel().getName().equals("Nimbus");
					return true;
				}
		} catch(Exception e_b) {}
	}
	return false;
}
 
開發者ID:kristian,項目名稱:JDigitalSimulator,代碼行數:20,代碼來源:Guitilities.java

示例4: main

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:26,代碼來源:TableExample2.java

示例5: main

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void main(String[] args) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample4.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample4();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:TableExample4.java

示例6: runTest

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
private static void runTest() {
    try {
        LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
        for (LookAndFeelInfo info : lafInfo) {
            UIManager.setLookAndFeel(info.getClassName());

            for (Locale locale : LOCALES) {
                for (String key : MNEMONIC_KEYS) {
                    int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale);
                    if (mnemonic != 0) {
                        throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " +
                                "for '" + key + "' " +
                                "in locale '" + locale + "' " +
                                "in Look-and-Feel '"
                                    + UIManager.getLookAndFeel().getClass().getName() + "'");
                    }
                }
            }
        }
        System.out.println("Test passed");
    } catch (Exception e) {
        exception = e;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:25,代碼來源:bug8080628.java

示例7: main

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void main(final String[] args) throws Exception {
    try {
        createGUI();
        for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
            final String name = laf.getName();
            if (name.contains("OS X") || name.contains("Metal")) {
                SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
                SwingUtilities.invokeAndWait(() -> {
                    for (int i = 0; i < 4000; ++i) {
                        SwingUtilities.updateComponentTreeUI(frame);
                    }
                });
            }
        }
    } finally {
        if (frame != null) { EventQueue.invokeAndWait(() -> frame.dispose()); }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:UnninstallUIMemoryLeaks.java

示例8: main

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
    Test7024235 test = new Test7024235();
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        UIManager.setLookAndFeel(info.getClassName());

        test.test();
        try {
            ExtendedRobot robot = new ExtendedRobot();
            robot.waitForIdle(1000);
        }catch(Exception ex) {
            ex.printStackTrace();
            throw new Error("Unexpected Failure");
        }
        test.test();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:Test7024235.java

示例9: main

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void main(final String[] args) throws Exception {
    try {
        createGUI();
        for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
            final String name = laf.getName();
            if (name.contains("OS X") || name.contains("Metal")) {
                SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
                SwingUtilities.invokeAndWait(() -> {
                    for (int i = 0; i < 4000; ++i) {
                        SwingUtilities.updateComponentTreeUI(frame);
                    }
                });
            }
        }
    } finally {
        EventQueue.invokeAndWait(() -> frame.dispose());
    }
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:19,代碼來源:UnninstallUIMemoryLeaks.java

示例10: main

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public static void main(String[] args) {
    // Try to use the "Nimbus" Look and Feel for Java. This is purely aesthetic.
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception e) {
        // If the Nimbus styling is not available, we fall back to normal styling
    }
    JFrame frame = new JFrame("Twitch Chat Analytics");
    frame.setContentPane(new AnalyticsGUI(frame).analyticsPanel);
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.pack();
    frame.setVisible(true);
}
 
開發者ID:SebastianAigner,項目名稱:spasm,代碼行數:20,代碼來源:AnalyticsGUI.java

示例11: setLaf

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
/**
 * Sets the Look And Feel specified by its name.
 * 
 * <p>
 * This method does not log in case of errors, so can be called before the logger is initialized.
 * </p>
 * 
 * @param lafName name of the Look And Feel to be set
 * @return the exception if any was thrown while setting the specified Look and Feel
 */
public static Exception setLaf( final String lafName ) {
	final Holder< Exception > exception = new Holder< >();
	runInEDT( new Runnable() {
		@Override
		public void run() {
			for ( final LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels() )
				if ( lafName.equals( lookAndFeelInfo.getName() ) ) {
					try {
						UIManager.setLookAndFeel( lookAndFeelInfo.getClassName() );
					} catch ( final Exception e ) {
						exception.value = e;
					}
					break;
				}
		}
	} );
	
	return exception.value;
}
 
開發者ID:icza,項目名稱:scelight,代碼行數:30,代碼來源:LGuiUtils.java

示例12: updateLookAndFeels

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
protected void updateLookAndFeels()
   {
clearButtons();
LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel();
String current = currentLookAndFeel == null ? "" : currentLookAndFeel.getName();
LookAndFeelInfo[] infoArray = UIManager.getInstalledLookAndFeels();
if (infoArray == null || infoArray.length == 0) {
    return;
}

for (LookAndFeelInfo info : infoArray) {
    JRadioButtonMenuItem button = new JRadioButtonMenuItem(info.getName());
    button.setActionCommand(info.getClassName());
    if (info.getName().equals(current))
	button.setSelected(true);
    addButton(button);
}
   }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:19,代碼來源:LookAndFeelMenuItem.java

示例13: createLookAndFeelMenu

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
protected JMenu createLookAndFeelMenu() {
        JMenu menu = new LuckMenu();
        menu.setOpaque(true);
//        menu.setBackground(Color.white);
        menu.setName("lookAndFeel");
        
        // Look for toolkit look and feels first
        UIManager.LookAndFeelInfo lookAndFeelInfos[] = UIManager.getInstalledLookAndFeels();
        lookAndFeel = UIManager.getLookAndFeel().getClass().getName();
        lookAndFeelRadioGroup = new ButtonGroup();
        for(UIManager.LookAndFeelInfo lafInfo: lookAndFeelInfos) {
            menu.add(createLookAndFeelItem(lafInfo.getName(), lafInfo.getClassName()));
        }  
        // Now load any look and feels defined externally as service via java.util.ServiceLoader
        LOOK_AND_FEEL_LOADER.iterator();
        for (LookAndFeel laf : LOOK_AND_FEEL_LOADER) {           
            menu.add(createLookAndFeelItem(laf.getName(), laf.getClass().getName()));
        }
         
        return menu;
    }
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:22,代碼來源:SwingSet3.java

示例14: loadLookAndFeel

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
/**
 * we only want to try and load the Nimbus look and feel if it is not
 * for the MAC operating system.
 */
private void loadLookAndFeel() {
	try  {
		for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
			if ("Nimbus".equals(info.getName())) {
				UIManager.setLookAndFeel(info.getClassName());
				break;
			}
		}
	}
	catch(Exception e) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception ex) {
			// we don't care. Cause this should always work.
		}
	}
}
 
開發者ID:jwoehr,項目名稱:ublu,代碼行數:22,代碼來源:My5250.java

示例15: createLAF

import javax.swing.UIManager.LookAndFeelInfo; //導入依賴的package包/類
public void createLAF()
{
	int num = 0;

	LookAndFeelInfo lafs[] = UIManager.getInstalledLookAndFeels();

	for (int i = 0; i < lafs.length; i++)
	{
		lafTitle.put(i, lafs[i].getName());
	}

	lafTitle.put(lafs.length + 0, "Nimrod");
	lafTitle.put(lafs.length + 1, "Nimrod - Burdeos");
	lafTitle.put(lafs.length + 2, "Nimrod - DarkGrey");
	lafTitle.put(lafs.length + 3, "Nimrod - DarkTabaco");
	lafTitle.put(lafs.length + 4, "Nimrod - LightTabaco");
	lafTitle.put(lafs.length + 5, "Nimrod - Night");
	lafTitle.put(lafs.length + 6, "Nimrod - Snow");

	lafOptions = new JComboBox(lafTitle.values().toArray(new String[0]));
}
 
開發者ID:TOMIGalway,項目名稱:cmoct-sourcecode,代碼行數:22,代碼來源:EditableLAFControler.java


注:本文中的javax.swing.UIManager.LookAndFeelInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。