本文整理汇总了Java中javax.swing.UIManager.getInstalledLookAndFeels方法的典型用法代码示例。如果您正苦于以下问题:Java UIManager.getInstalledLookAndFeels方法的具体用法?Java UIManager.getInstalledLookAndFeels怎么用?Java UIManager.getInstalledLookAndFeels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.UIManager
的用法示例。
在下文中一共展示了UIManager.getInstalledLookAndFeels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.swing.UIManager; //导入方法依赖的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();
}
示例2: main
import javax.swing.UIManager; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
robot = new Robot();
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
String lookAndFeelString = lookAndFeelItem.getClassName();
if (tryLookAndFeel(lookAndFeelString)) {
createUI();
robot.waitForIdle();
executeTest();
robot.delay(1000);
}
}
if (!"".equals(errorMessage)) {
throw new RuntimeException(errorMessage);
}
}
示例3: main
import javax.swing.UIManager; //导入方法依赖的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]);
}
示例4: runTest
import javax.swing.UIManager; //导入方法依赖的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;
}
}
示例5: main
import javax.swing.UIManager; //导入方法依赖的package包/类
public static void main (String[] args) throws Exception {
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;
}
}
new Hiero();
}
示例6: setJMenuExtraLnF
import javax.swing.UIManager; //导入方法依赖的package包/类
/**
* Set the JMenue for the look and feel.
*/
private void setJMenuExtraLnF() {
UIManager.LookAndFeelInfo installedLnF[] = UIManager.getInstalledLookAndFeels();
for (int i = 0, n = installedLnF.length; i < n; i++) {
boolean setBold = installedLnF[i].getClassName().equals(Application.getGlobalInfo().getAppLookAndFeelClassName());
jMenuExtraLnF.add(new JMenuItmenLnF(installedLnF[i].getName(), installedLnF[i].getClassName(), setBold));
}
}
示例7: main
import javax.swing.UIManager; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
robot = new Robot();
robot.delay(2000);
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
executeCase(lookAndFeelItem.getClassName());
}
if (!"".equals(errorString)) {
throw new RuntimeException("Error Log:\n" + errorString);
}
}
示例8: main
import javax.swing.UIManager; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
robot = new Robot();
robot.delay(1000);
UIManager.LookAndFeelInfo[] lookAndFeelArray
= UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
executeCase(lookAndFeelItem.getClassName(),
lookAndFeelItem.getName());
}
if (!"".equals(errorString)) {
throw new RuntimeException("Error Log:\n" + errorString);
}
}
示例9: run
import javax.swing.UIManager; //导入方法依赖的package包/类
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);
}
示例10: main
import javax.swing.UIManager; //导入方法依赖的package包/类
/**
* The main method.
*
* @param args - Contains the supplied command-line arguments.
*/
public static void main(String [] args){
try {
for(LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()){
if("Windows".equals(info.getName())){
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
}
Runner RUNNER = new Runner();
RUNNER.start();
}
示例11: test
import javax.swing.UIManager; //导入方法依赖的package包/类
public static void test() throws Exception {
final UIManager.LookAndFeelInfo[] infos = UIManager
.getInstalledLookAndFeels();
for (final UIManager.LookAndFeelInfo info : infos) {
SwingUtilities.invokeAndWait(() -> {
final JFileChooser chooser = new JFileChooser();
setLookAndFeel(info);
chooser.setAcceptAllFileFilterUsed(false);
chooser.setFileFilter(new CustomFileFilter());
SwingUtilities.updateComponentTreeUI(chooser);
chooser.showDialog(null, "Open");
});
}
}
示例12: run
import javax.swing.UIManager; //导入方法依赖的package包/类
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);
}
}
示例13: pegaNimbus
import javax.swing.UIManager; //导入方法依赖的package包/类
public static void pegaNimbus() {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
System.out.println("Erro: " + e.getMessage());
}
}
示例14: main
import javax.swing.UIManager; //导入方法依赖的package包/类
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;
}
}
}
示例15: main
import javax.swing.UIManager; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
robot = new Robot();
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
UIManager.LookAndFeelInfo[] lookAndFeelArray =
UIManager.getInstalledLookAndFeels();
for (GraphicsDevice sd : ge.getScreenDevices()) {
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
executeCase(lookAndFeelItem.getClassName(), sd);
robot.waitForIdle();
}
}
}