• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WindowsLookAndFeel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.java.swing.plaf.windows.WindowsLookAndFeel的典型用法代码示例。如果您正苦于以下问题:Java WindowsLookAndFeel类的具体用法?Java WindowsLookAndFeel怎么用?Java WindowsLookAndFeel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WindowsLookAndFeel类属于com.sun.java.swing.plaf.windows包,在下文中一共展示了WindowsLookAndFeel类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    OSType type = OSInfo.getOSType();
    if (type != OSType.WINDOWS) {
        System.out.println("This test is for Windows only... skipping!");
        return;
    }

    SwingUtilities.invokeAndWait(() -> {
        try {
            UIManager.setLookAndFeel(new WindowsLookAndFeel());
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }
        System.out.println("Creating JFileChooser...");
        JFileChooser fileChooser = new JFileChooser();
        System.out.println("Test passed: chooser = " + fileChooser);
    });
    // Test fails if creating JFileChooser hangs
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:bug8046391.java


示例2: main

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        e.printStackTrace();

        return;
    }

    TestPanel panel = new TestPanel();

    JFrame frame = new JFrame();

    frame.setContentPane(panel);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:bug6524424.java


示例3: getLookAndFeelClassNamePreferOceanToWindows

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
/**
 * This method can be called in an override of getLookAndFeelClassName in case the simulation needs Ocean instead of Windows L&F
 * <p/>
 * The behavior is:
 * >> - Aqua on Mac
 * >> - Windows LAF for Window JDK 1.4.2
 * >> - default LAF (Ocean) for Windows with JDK 1.5
 * >> - default LAF for all other cases (eg, Linux)
 *
 * @return the class name for the look and feel.
 */
protected String getLookAndFeelClassNamePreferOceanToWindows() {
    String javaVersion = System.getProperty( "java.version" );
    boolean oldJava = javaVersion.toLowerCase().startsWith( "1.4" ) || javaVersion.startsWith( "1.3" );
    String lafClassName = null;
    if ( PhetUtilities.getOperatingSystem() == PhetUtilities.OS_WINDOWS ) {
        if ( oldJava ) {
            lafClassName = WindowsLookAndFeel.class.getName();
        }
        else {
            lafClassName = UIManager.getCrossPlatformLookAndFeelClassName();
        }
    }
    else {
        lafClassName = UIManager.getSystemLookAndFeelClassName();
    }
    return lafClassName;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:29,代码来源:PhetLookAndFeel.java


示例4: MainPanel

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
private MainPanel() {
    super();
    showMnemonicsCheck.setSelected(UIManager.getBoolean(SHOW_MNEMONICS));
    showMnemonicsCheck.setMnemonic(KeyEvent.VK_B);
    showMnemonicsCheck.addActionListener(e -> {
        UIManager.put(SHOW_MNEMONICS, ((JCheckBox) e.getSource()).isSelected());
        if (UIManager.getLookAndFeel() instanceof WindowsLookAndFeel) {
            System.out.println("isMnemonicHidden: " + WindowsLookAndFeel.isMnemonicHidden());
            WindowsLookAndFeel.setMnemonicHidden(true);
            SwingUtilities.getRoot(this).repaint();
        }
    });
    add(showMnemonicsCheck);

    JButton button = new JButton("Dummy");
    button.setMnemonic(KeyEvent.VK_D);
    add(button);

    setPreferredSize(new Dimension(320, 240));
}
 
开发者ID:aterai,项目名称:java-swing-tips,代码行数:21,代码来源:MainPanel.java


示例5: main

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    robot.setAutoDelay(50);
    SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
    try {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (javax.swing.UnsupportedLookAndFeelException ulafe) {
        System.out.println(ulafe.getMessage());
        System.out.println("The test is considered PASSED");
        return;
    }
    SwingUtilities.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            createAndShowGUI();
        }
    });

    toolkit.realSync();

    Point point = Util.invokeOnEDT(new Callable<Point>() {

        @Override
        public Point call() throws Exception {
            Rectangle rect = tree.getRowBounds(2);
            Point p = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
            SwingUtilities.convertPointToScreen(p, tree);
            return p;
        }
    });

    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    toolkit.realSync();

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:bug8004298.java


示例6: main

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    robot.setAutoDelay(50);
    try {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (javax.swing.UnsupportedLookAndFeelException ulafe) {
        System.out.println(ulafe.getMessage());
        System.out.println("The test is considered PASSED");
        return;
    }
    SwingUtilities.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            createAndShowGUI();
        }
    });

    robot.waitForIdle();

    Point point = Util.invokeOnEDT(new Callable<Point>() {

        @Override
        public Point call() throws Exception {
            Rectangle rect = tree.getRowBounds(2);
            Point p = new Point(rect.x + rect.width / 2, rect.y + rect.height / 2);
            SwingUtilities.convertPointToScreen(p, tree);
            return p;
        }
    });

    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.waitForIdle();

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:bug8004298.java


示例7: main

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS
            && OSInfo.getWindowsVersion() == OSInfo.WINDOWS_XP) {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
        testButtonBorder();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:bug4796987.java


示例8: initTheme

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
/**
 * 初始化look and feel
 */
public static void initTheme() {

    try {
        switch (configer.getTheme()) {
            case "BeautyEye":
                BeautyEyeLNFHelper.launchBeautyEyeLNF();
                UIManager.put("RootPane.setupButtonVisible", false);
                break;
            case "weblaf":
                UIManager.setLookAndFeel(new WebLookAndFeel());
                break;
            case "系统默认":
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                break;
            case "Windows":
                UIManager.setLookAndFeel(WindowsLookAndFeel.class.getName());
                break;
            case "Nimbus":
                UIManager.setLookAndFeel(NimbusLookAndFeel.class.getName());
                break;
            case "Metal":
                UIManager.setLookAndFeel(MetalLookAndFeel.class.getName());
                break;
            case "Motif":
                UIManager.setLookAndFeel(MotifLookAndFeel.class.getName());
                break;
            case "Darcula(推荐)":
            default:
                UIManager.setLookAndFeel("com.bulenkov.darcula.DarculaLaf");
        }
    } catch (Exception e) {
        logger.error(e);
    }

}
 
开发者ID:rememberber,项目名称:WePush,代码行数:39,代码来源:Init.java


示例9: main

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public static void main( String args[] ) throws Exception {
  UIManager.setLookAndFeel( WindowsLookAndFeel.class.getName() );
  IModelFieldGroup groups[] = new IModelFieldGroup[] {
    new ModelFieldGroup( "A", "A" )
      .withChild( new ModelField( "B", "B" ) )
      .withChild( new ModelField( "C", "C" ).withRowspan( 2 ) ),
    new ModelFieldGroup( "D", "D" )
      .withChild( new ModelField( "E", "E" ) )
      .withChild( new ModelField( "F", "F" ) ),
    new ModelField( "G", "G" ),
    new ModelFieldGroup( "H", "H" )
      .withChild( new ModelFieldGroup( "I", "I" )
                    .withChild( new ModelField( "J", "J" ) ) )
      .withChild( new ModelField( "K", "K" ) )
      .withChild( new ModelFieldGroup( "L", "L" )
                    .withChild( new ModelField( "M", "M" ) )
                    .withChild( new ModelField( "N", "N" ) ) )
  };
  ModelData data = new ModelData( groups );
  ModelField fields[] = ModelFieldGroup.getBottomFields( groups );
  ModelRow rows[] = new ModelRow[ 10 ];
  for ( int i = 0; i < rows.length; i++ ) {
    rows[ i ] = new ModelRow( fields.length );
    for ( int j = 0; j < fields.length; j++ )
      rows[ i ].setValue( j, j == 1 || j == 2 ? rows[ i ].getValue( 0 ) : i == j ? "sort me" : fields[ j ].getCaption() + i );
  }
  data.setRows( rows );
  JBroTable table = new JBroTable( data );
  table.setAutoCreateRowSorter( true );
  table.setUI( new JBroTableUI().withSpan( new ModelSpan( "B", "B" ).withColumns( "B", "C", "E" ).withDrawAsHeader( true ) )
                                .withSpan( new ModelSpan( "G", "G" ).withColumns( "G", "J" ) ) );
  JFrame frame = new JFrame( "Testing" );
  frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
  frame.setLayout( new FlowLayout() );
  frame.add( table.getScrollPane() );
  frame.pack();
  frame.setLocationRelativeTo( null );
  frame.setVisible( true );
}
 
开发者ID:Qualtagh,项目名称:JBroTable,代码行数:40,代码来源:JBroTableUIShowcase.java


示例10: main

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
//		UIManager.setLookAndFeel(new NimbusLookAndFeel());
		UIManager.setLookAndFeel(new WindowsLookAndFeel());
		JFileChooser fileChooser = new JFileChooser();
		if(fileChooser.showOpenDialog(null)==JFileChooser.APPROVE_OPTION){
			File file = fileChooser.getSelectedFile();
			Scanner sc = new Scanner(file);
			while(sc.hasNext()){
				System.out.println(sc.nextLine());
			}
			sc.close();
		}else{
			System.out.println("No file is selected");
		}
	}
 
开发者ID:guodongxiaren,项目名称:JFC,代码行数:16,代码来源:JFileChooserDemo.java


示例11: MushroomGUI

import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; //导入依赖的package包/类
public MushroomGUI(String name){
	super(name);
	try {
		UIManager.setLookAndFeel(new WindowsLookAndFeel());
	} catch (UnsupportedLookAndFeelException e) {}
}
 
开发者ID:MushroomLT,项目名称:MushroomAPI,代码行数:7,代码来源:MushroomGUI.java



注:本文中的com.sun.java.swing.plaf.windows.WindowsLookAndFeel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JCAnnotatedType类代码示例发布时间:2022-05-21
下一篇:
Java MenuItemPeer类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap