本文整理汇总了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) {
}
}
示例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();
}
示例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;
}
示例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]);
}
示例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();
}
示例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;
}
}
示例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()); }
}
}
示例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();
}
}
示例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());
}
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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.
}
}
}
示例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]));
}