类javax.swing.UIManager.LookAndFeelInfo源码实例Demo

下面列出了怎么用javax.swing.UIManager.LookAndFeelInfo的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: TableExample2.java
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]);
}
 
源代码2 项目: dragonwell8_jdk   文件: TableExample4.java
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();
}
 
源代码3 项目: jdk8u-dev-jdk   文件: TableExample.java
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();
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: TableExample2.java
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 项目: openjdk-jdk9   文件: UnninstallUIMemoryLeaks.java
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());
    }
}
 
源代码6 项目: jdk8u-jdk   文件: TableExample.java
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();
}
 
源代码7 项目: jdk8u-jdk   文件: TableExample.java
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();
}
 
源代码8 项目: jdk8u-jdk   文件: TableExample4.java
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();
}
 
源代码9 项目: jdk8u-jdk   文件: TableExample2.java
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]);
}
 
源代码10 项目: openjdk-8   文件: TableExample2.java
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]);
}
 
源代码11 项目: netbeans   文件: LafPanel.java
protected boolean store() {
    prefs.putBoolean(WinSysPrefs.MAXIMIZE_NATIVE_LAF, checkMaximizeNativeLaF.isSelected());
    System.setProperty("nb.native.filechooser", checkMaximizeNativeLaF.isSelected() ? "true" : "false"); //NOI18N

    int selLaFIndex = comboLaf.getSelectedIndex();
    if( selLaFIndex != defaultLookAndFeelIndex && !isForcedLaF() ) {
        LookAndFeelInfo li = lafs.get( comboLaf.getSelectedIndex() );
        NbPreferences.root().node( "laf" ).put( "laf", li.getClassName() ); //NOI18N
        if (NO_RESTART_ON_LAF_CHANGE) {
            try {
                UIManager.setLookAndFeel(li.getClassName());
                WindowManager wmgr = Lookup.getDefault().lookup(WindowManager.class);
                wmgr.updateUI();
            } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException ex) {
                askForRestart();
            }
        } else {
            askForRestart();
        }
    }

    return false;
}
 
源代码12 项目: openjdk-8-source   文件: TableExample2.java
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]);
}
 
源代码13 项目: jdk8u_jdk   文件: bug8080628.java
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;
    }
}
 
源代码14 项目: scelight   文件: LGuiUtils.java
/**
 * 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;
}
 
源代码15 项目: slick2d-maven   文件: Hiero.java
public static void main(String[] args) throws Exception {
	SwingUtilities.invokeLater(new Runnable() {
		@Override
		public void run() {
			LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();
			for (int i = 0, n = lookAndFeels.length; i < n; i++) {
				if ("Nimbus".equals(lookAndFeels[i].getName())) {
					try {
						UIManager.setLookAndFeel(lookAndFeels[i].getClassName());
					} catch (Exception ignored) {
					}
					break;
				}
			}
			try {
				new Hiero();
			} catch (SlickException ex) {
				throw new RuntimeException(ex);
			}
		}
	});
}
 
源代码16 项目: openjdk-jdk8u   文件: TableExample4.java
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();
}
 
源代码17 项目: pentaho-reporting   文件: ReportDesigner.java
public void run() {
  int indent = 0;
  try {
    final String lnfName = WorkspaceSettings.getInstance().getLNF();
    if ( !StringUtils.isEmpty( lnfName ) ) {
      final LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
      for ( final LookAndFeelInfo lnf : lnfs ) {
        if ( lnf.getName().equals( lnfName ) ) {
          UIManager.setLookAndFeel( lnf.getClassName() );
          return;
        }
      }
    }

    UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
    indent = 5; //PRD-4583
  } catch ( Throwable t ) {
    UncaughtExceptionsModel.getInstance().addException( t );
  }

  final UIDefaults uiDefaults = UIManager.getDefaults();
  uiDefaults.put( "Table.gridColor", uiDefaults.get( "Panel.background" ) );// NON-NLS
  uiDefaults.put( "Tree.leftChildIndent", indent );//PRD-4419
}
 
源代码18 项目: openjdk-jdk8u   文件: Test6981576.java
public void run() {
    if (this.infos == null) {
        this.infos = UIManager.getInstalledLookAndFeels();
        Thread.currentThread().setUncaughtExceptionHandler(this);
        JPanel panel = new JPanel();
        panel.setBorder(this);
        this.frame = new JFrame(getClass().getSimpleName());
        this.frame.add(panel);
        this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        this.frame.setVisible(true);
    }
    if (this.index == this.infos.length) {
        this.frame.dispose();
    }
    else {
        LookAndFeelInfo info = this.infos[this.index % this.infos.length];
        try {
            UIManager.setLookAndFeel(info.getClassName());
        }
        catch (Exception exception) {
            System.err.println("could not change look and feel");
        }
        SwingUtilities.updateComponentTreeUI(this.frame);
        this.frame.pack();
        this.frame.setLocationRelativeTo(null);
        this.index++;
        SwingUtilities.invokeLater(this);
    }
}
 
源代码19 项目: FlatLaf   文件: LookAndFeelsComboBox.java
@SuppressWarnings( "unchecked" )
public LookAndFeelsComboBox() {
	setRenderer( new BasicComboBoxRenderer() {
		@Override
		@SuppressWarnings( "rawtypes" )
		public Component getListCellRendererComponent( JList list, Object value,
			int index, boolean isSelected, boolean cellHasFocus )
		{
			value = (value != null)
				? ((LookAndFeelInfo)value).getName()
				: UIManager.getLookAndFeel().getName();
			return super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
		}
	} );
}
 
源代码20 项目: jdk8u_jdk   文件: UITest.java
public static boolean hasLAF(String name, LookAndFeelInfo[] lafInfo) {

        for (int counter = 0; counter < lafInfo.length; counter++) {
            if (lafInfo[counter].getName().toLowerCase().indexOf(name) != -1) {
                return true;
            }
        }
        return false;
    }
 
源代码21 项目: FlatLaf   文件: LookAndFeelsComboBox.java
public int getIndexOfLookAndFeel( String className ) {
	ComboBoxModel<LookAndFeelInfo> model = getModel();
	int size = model.getSize();
	for( int i = 0; i < size; i++ ) {
		if( className.equals( model.getElementAt( i ).getClassName() ) )
			return i;
	}
	return -1;
}
 
源代码22 项目: Ardulink-2   文件: LAFUtil.java
public static void setLookAndFeel(String lafName) throws ClassNotFoundException,
		InstantiationException, IllegalAccessException,
		UnsupportedLookAndFeelException {
	for (LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
		if (lafName.equals(laf.getName())) {
			UIManager.setLookAndFeel(laf.getClassName());
		}
	}
}
 
源代码23 项目: jdk8u-jdk   文件: bug8002077.java
public static void main(String[] args) throws Exception {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            runTest();
            break;
        }
    }
}
 
源代码24 项目: openjdk-jdk9   文件: bug8081411.java
private static boolean checkAndSetNimbusLookAndFeel() {
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                return true;
            }
        }
        return false;
    } catch (Exception ignore) {
        return false;
    }
}
 
源代码25 项目: openjdk-8-source   文件: UITest.java
public static boolean hasLAF(String name, LookAndFeelInfo[] lafInfo) {

        for (int counter = 0; counter < lafInfo.length; counter++) {
            if (lafInfo[counter].getName().toLowerCase().indexOf(name) != -1) {
                return true;
            }
        }
        return false;
    }
 
源代码26 项目: dragonwell8_jdk   文件: bug8002077.java
public static void main(String[] args) throws Exception {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            UIManager.put("FileChooser.openButtonMnemonic", KeyEvent.VK_O);
            UIManager.put("FileChooser.saveButtonMnemonic", KeyEvent.VK_S);
            runTest();
            break;
        }
    }
}
 
源代码27 项目: zxpoly   文件: Application.java
public static void main(final String[] args) {
  if (args.length > 0) {
    switch (args[0]) {
      case "sliceImage": {
        System.exit(new SliceImageCmd().process(Arrays.copyOfRange(args, 1, args.length)));
      }
      break;
      default: {
        System.err.println("Unexpected command : " + args[0]);
        System.exit(1);
      }
    }
  }

  java.util.Locale.setDefault(Locale.ROOT);

  try {
    for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
      if ("Nimbus".equals(info.getName())) {
        UIManager.setLookAndFeel(info.getClassName());
        break;
      }
    }
  } catch (Exception e) {
    e.printStackTrace();
  }

  SwingUtilities.invokeLater(() -> {
    final JFrame frame = new MainFrame();
    frame.setVisible(true);
  });

}
 
源代码28 项目: dragonwell8_jdk   文件: Test6981576.java
public void run() {
    if (this.infos == null) {
        this.infos = UIManager.getInstalledLookAndFeels();
        Thread.currentThread().setUncaughtExceptionHandler(this);
        JPanel panel = new JPanel();
        panel.setBorder(this);
        this.frame = new JFrame(getClass().getSimpleName());
        this.frame.add(panel);
        this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        this.frame.setVisible(true);
    }
    if (this.index == this.infos.length) {
        this.frame.dispose();
    }
    else {
        LookAndFeelInfo info = this.infos[this.index % this.infos.length];
        try {
            UIManager.setLookAndFeel(info.getClassName());
        }
        catch (Exception exception) {
            System.err.println("could not change look and feel");
        }
        SwingUtilities.updateComponentTreeUI(this.frame);
        this.frame.pack();
        this.frame.setLocationRelativeTo(null);
        this.index++;
        SwingUtilities.invokeLater(this);
    }
}
 
源代码29 项目: openjdk-jdk9   文件: Test7163696.java
private void test() throws Exception {
    Robot robot = new Robot();
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        UIManager.setLookAndFeel(info.getClassName());

        SwingUtilities.invokeAndWait(this);
        robot.waitForIdle(); // after creation
        Thread.sleep(1000);

        Point point = this.bar.getLocation();
        SwingUtilities.convertPointToScreen(point, this.bar);
        point.x += this.bar.getWidth() >> 2;
        point.y += this.bar.getHeight() >> 1;
        robot.mouseMove(point.x, point.y);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);

        robot.waitForIdle(); // before validation
        Thread.sleep(1000);
        SwingUtilities.invokeAndWait(this);

        if (this.bar != null) {
            this.bar = null; // allows to reuse the instance
            if (AUTO) { // error reporting only for automatic testing
                throw new Error("TEST FAILED");
            }
        }
    }
}
 
源代码30 项目: dragonwell8_jdk   文件: Test6199676.java
public synchronized void run() {
    if (this.chooser == null) {
        this.chooser = new JColorChooser();

        JFrame frame = new JFrame(getClass().getName());
        frame.add(this.chooser);
        frame.setVisible(true);
    }
    else if (this.updated) {
        if (isShowing(this.chooser.getPreviewPanel())) {
            exit("custom preview panel is showing");
        }
        exit(null);
    }
    else {
        Component component = this.chooser.getPreviewPanel();
        if (component == null) {
            component = getPreview(this.chooser);
        }
        if (!isShowing(component)) {
            exit("default preview panel is not showing");
        }
        this.updated = true;
        this.chooser.setPreviewPanel(new JPanel());
    }
    LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
    LookAndFeelInfo info = infos[++this.index % infos.length];
    try {
        UIManager.setLookAndFeel(info.getClassName());
    }
    catch (Exception exception) {
        exit("could not change L&F");
    }
    SwingUtilities.updateComponentTreeUI(this.chooser);
    SwingUtilities.invokeLater(this);
}
 
 类所在包
 类方法
 同包方法