javax.swing.JFrame#setDefaultLookAndFeelDecorated ( )源码实例Demo

下面列出了javax.swing.JFrame#setDefaultLookAndFeelDecorated ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: HubPlayer   文件: Main.java
public static void main(String[] args) {

		try {
			// 设置观感
			UIManager
					.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel");
			// 设置水印
			SubstanceLookAndFeel
					.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceMosaicWatermark");
			// 设置渐变渲染
			SubstanceLookAndFeel
					.setCurrentGradientPainter("org.jvnet.substance.painter.WaveGradientPainter");

			JFrame.setDefaultLookAndFeelDecorated(true);
			JDialog.setDefaultLookAndFeelDecorated(true);
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}

		EventQueue.invokeLater(() -> {
			new HubFrame();
		});

	}
 
源代码2 项目: osrsclient   文件: RSClient.java
public static void main(String[] args) throws IrcException, IOException {

		Toolkit.getDefaultToolkit().setDynamicLayout(true);
		System.setProperty("sun.awt.noerasebackground", "true");
		JFrame.setDefaultLookAndFeelDecorated(true);
		JDialog.setDefaultLookAndFeelDecorated(true);

		try {
			UIManager.setLookAndFeel("de.muntjak.tinylookandfeel.TinyLookAndFeel");

		} catch (Exception e) {
			e.printStackTrace();
		}

		initUI();
	}
 
源代码3 项目: openjdk-8   文件: Metalworks.java
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
源代码4 项目: portecle   文件: FPortecle.java
/**
 * Initialize the application's look and feel.
 */
private static void initLookAndFeel()
{
	try
	{
		// Use the look and feel
		UIManager.setLookAndFeel(PREFS.get(RB.getString("AppPrefs.LookFeel"), FPortecle.DEFAULT_LOOK_FEEL));
	}
	// Didn't work - no matter
	catch (ClassNotFoundException | IllegalAccessException | InstantiationException
	    | UnsupportedLookAndFeelException e)
	{
		// Ignored
	}

	// Use look & feel's decoration?
	boolean bLookFeelDecorated = PREFS.getBoolean(RB.getString("AppPrefs.LookFeelDecor"), false);

	JFrame.setDefaultLookAndFeelDecorated(bLookFeelDecorated);
	JDialog.setDefaultLookAndFeelDecorated(bLookFeelDecorated);
}
 
源代码5 项目: jdk8u-dev-jdk   文件: Metalworks.java
public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println(
                "Metal Look & Feel not supported on this platform. \n"
                + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
 
源代码6 项目: HJMirror   文件: ConnectView.java
@Override
protected void onStart() {
    // Set no titlebar.
    JFrame.setDefaultLookAndFeelDecorated(true);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    // Don't Resize.
    setResizable(false);
    // Set background.
    setBackground(Color.lightGray);
    // Calculator the location and size of window
    Dimension size = HJEnv.getScreenSize();
    int width = size.width / 8;
    int height = size.width / 16;
    Point parentLocation = parent.getLocation();
    Dimension parentSize = parent.getSize();
    int x = parentLocation.x + (parentSize.width - width) / 2;
    int y = parentLocation.y + (parentSize.height - height) / 2;
    setLocation(x, y);
    setPreferredSize(new Dimension(width, height));
    // Set Layout.
    GridLayout gird=new GridLayout(1,1);
    setLayout(gird);
    JPanel panel = new JPanel();
    panel.setLayout(null);
    label = new JLabel();
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setBounds(5, 5, width - 10, height - 10);
    panel.add(label);
    add(panel);
}
 
源代码7 项目: FlatLaf   文件: FlatLaf.java
@Override
public void uninitialize() {
	// remove desktop property listener
	if( desktopPropertyListener != null ) {
		Toolkit toolkit = Toolkit.getDefaultToolkit();
		toolkit.removePropertyChangeListener( desktopPropertyName, desktopPropertyListener );
		if( desktopPropertyName2 != null )
			toolkit.removePropertyChangeListener( desktopPropertyName2, desktopPropertyListener );
		toolkit.removePropertyChangeListener( DESKTOPFONTHINTS, desktopPropertyListener );
		desktopPropertyName = null;
		desktopPropertyName2 = null;
		desktopPropertyListener = null;
	}

	// uninstall popup factory
	if( oldPopupFactory != null ) {
		PopupFactory.setSharedInstance( oldPopupFactory );
		oldPopupFactory = null;
	}

	// uninstall mnemonic handler
	if( mnemonicHandler != null ) {
		mnemonicHandler.uninstall();
		mnemonicHandler = null;
	}

	// restore default link color
	new HTMLEditorKit().getStyleSheet().addRule( "a { color: blue; }" );
	postInitialization = null;

	// restore enable/disable window decorations
	if( oldFrameWindowDecorated != null ) {
		JFrame.setDefaultLookAndFeelDecorated( oldFrameWindowDecorated );
		JDialog.setDefaultLookAndFeelDecorated( oldDialogWindowDecorated );
		oldFrameWindowDecorated = null;
		oldDialogWindowDecorated = null;
	}

	super.uninitialize();
}
 
源代码8 项目: radiance   文件: UnregisterSkinChangeListener.java
/**
 * The main method for <code>this</code> sample. The arguments are ignored.
 * 
 * @param args
 *            Ignored.
 */
public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(() -> {
        SubstanceCortex.GlobalScope.setSkin(new BusinessBlackSteelSkin());
        new UnregisterSkinChangeListener().setVisible(true);
    });
}
 
源代码9 项目: beast-mcmc   文件: SimpleApp.java
public static void setLAF() {
	JFrame.setDefaultLookAndFeelDecorated(true);
	Toolkit.getDefaultToolkit().setDynamicLayout(true);
	System.setProperty("sun.awt.noerasebackground","true");
	try {
		UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
	} catch (Exception e) {
		System.err.println("Failed to set LookAndFeel");
	}
}
 
/**
 * The main method for <code>this</code> sample. The arguments are ignored.
 * 
 * @param args
 *            Ignored.
 */
public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(() -> {
        SubstanceCortex.GlobalScope.setSkin(new BusinessBlackSteelSkin());
        new UnregisterTabCloseChangeListener_General().setVisible(true);
    });
}
 
源代码11 项目: swing_library   文件: MenTest.java
private static void createGUI() {
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("ACME Zoo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    MenTest app = new MenTest();
    frame.setJMenuBar(app.createJMenuBar());
    frame.setContentPane(app.createContentPane());

    frame.setSize(500, 300);
    frame.setVisible(true);
}
 
源代码12 项目: magarena   文件: SimpleApp.java
public static void setLAF() {
	JFrame.setDefaultLookAndFeelDecorated(true);
	Toolkit.getDefaultToolkit().setDynamicLayout(true);
	System.setProperty("sun.awt.noerasebackground","true");
	try {
		UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
	} catch (Exception e) {
		System.err.println("Failed to set LookAndFeel");
	}
}
 
源代码13 项目: radiance   文件: ComponentPreviewPainter.java
/**
 * The main method for <code>this</code> sample. The arguments are ignored.
 * 
 * @param args
 *            Ignored.
 */
public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(() -> {
        SubstanceCortex.GlobalScope.setSkin(new BusinessBlackSteelSkin());
        SubstanceCortex.GlobalScope.setExtraWidgetsPresence(true);
        new ComponentPreviewPainter().setVisible(true);
    });
}
 
/**
 * The main method for <code>this</code> sample. The arguments are ignored.
 * 
 * @param args
 *            Ignored.
 */
public static void main(String[] args) {
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(() -> {
        SubstanceCortex.GlobalScope.setSkin(new NebulaSkin());
        new SetUseConstantThemesOnOptionPanes().setVisible(true);
    });
}
 
源代码15 项目: radiance   文件: TabbedPaneContentBorderKind.java
/**
 * The main method for <code>this</code> sample. The arguments are ignored.
 *
 * @param args Ignored.
 */
public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(() -> {
        SubstanceCortex.GlobalScope.setSkin(new BusinessBlackSteelSkin());
        new TabbedPaneContentBorderKind().setVisible(true);
    });
}
 
源代码16 项目: radiance   文件: ButtonNoMinSize.java
/**
 * The main method for <code>this</code> sample. The arguments are ignored.
 * 
 * @param args
 *            Ignored.
 */
public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(() -> {
        SubstanceCortex.GlobalScope.setSkin(new BusinessBlackSteelSkin());
        new ButtonNoMinSize().setVisible(true);
    });
}
 
/**
 * The main method for <code>this</code> sample. The arguments are ignored.
 * 
 * @param args
 *            Ignored.
 */
public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    SwingUtilities.invokeLater(() -> {
        SubstanceCortex.GlobalScope.setSkin(new BusinessBlackSteelSkin());
        new RegisterTabCloseChangeListener_SpecificSingleVetoable().setVisible(true);
    });
}
 
源代码18 项目: Girinoscope   文件: UI.java
public static void main(String[] args) throws Exception {
    Logger rootLogger = Logger.getLogger("org.hihan.girinoscope");
    rootLogger.setLevel(Level.INFO);

    for (String arg : args) {
        if ("-debug".equals(arg)) {
            ConsoleHandler handler = new ConsoleHandler();
            handler.setFormatter(new SimpleFormatter());
            handler.setLevel(Level.ALL);
            rootLogger.addHandler(handler);
        }
    }

    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    try {
        String[] allLafs = {
            "javax.swing.plaf.nimbus.NimbusLookAndFeel",
            "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel",
            UIManager.getSystemLookAndFeelClassName()
        };
        for (String laf : allLafs) {
            if (setLookAndFeelIfAvailable(laf)) {
                break;
            }
        }
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "When setting the look and feel.", e);
    }

    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            JFrame frame = new UI();
            frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
 
源代码19 项目: dctb-utfpr-2018-1   文件: Sliders.java
public static void main(String[] args) {
	// Create and set up a frame window
	JFrame.setDefaultLookAndFeelDecorated(true);
	JFrame frame = new JFrame("Slider with change listener");
	frame.setSize(500, 500);
	frame.setLayout(new GridLayout(3, 1));
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	// Set the panel to add buttons
	JPanel panel1 = new JPanel();
	JPanel panel2 = new JPanel();
	
	// Add status label to show the status of the slider
	JLabel status = new JLabel("Slide the slider and you can get its value", JLabel.CENTER);
	
	// Set the slider
	JSlider slider = new JSlider();	
	slider.setMinorTickSpacing(10);
	slider.setPaintTicks(true);
	
	// Set the labels to be painted on the slider
	slider.setPaintLabels(true);
	
	// Add positions label in the slider
	Hashtable<Integer, JLabel> position = new Hashtable<Integer, JLabel>();
	position.put(0, new JLabel("0"));
	position.put(50, new JLabel("50"));
	position.put(100, new JLabel("100"));
	
	// Set the label to be drawn
	slider.setLabelTable(position);
	
	// Add change listener to the slider
	slider.addChangeListener(new ChangeListener() {
		public void stateChanged(ChangeEvent e) {
			status.setText("Value of the slider is: " + ((JSlider)e.getSource()).getValue());
		}
	});
	
	// Add the slider to the panel
	panel1.add(slider);
	
	// Set the window to be visible as the default to be false
	frame.add(panel1);
	frame.add(status);
	frame.add(panel2);
	frame.pack();
	frame.setVisible(true);

}
 
源代码20 项目: seaglass   文件: SeaGlassLookAndFeel.java
/**
 * Returns the defaults for SeaGlassLookAndFeel.
 *
 * @return the UI defaults for SeaGlassLookAndFeel.
 */
@Override
public UIDefaults getDefaults() {
    if (uiDefaults == null) {
        uiDefaults =  new UIWrapper(super.getDefaults());

        // Install Keybindings for the operating system.
        if (PlatformUtils.isWindows()) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else if (PlatformUtils.isMac()) {
            MacKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Set the default font.
        defineDefaultFont(uiDefaults);

        // Override some of the Synth UI delegates with copied and modified
        // versions.
        useOurUIs();

        defineBaseColors(uiDefaults);
        defineDefaultBorders(uiDefaults);
        defineArrowButtons(uiDefaults);
        defineButtons(uiDefaults);
        defineComboBoxes(uiDefaults);
        defineDesktopPanes(uiDefaults);
        defineInternalFrames(uiDefaults);
        defineInternalFrameMenuButtons(uiDefaults);
        defineInternalFrameCloseButtons(uiDefaults);
        defineInternalFrameIconifyButtons(uiDefaults);
        defineInternalFrameMaximizeButton(uiDefaults);
        defineLists(uiDefaults);
        defineMenus(uiDefaults);
        definePanels(uiDefaults);
        definePopups(uiDefaults);
        defineProgressBars(uiDefaults);
        defineRootPanes(uiDefaults);
        defineSeparators(uiDefaults);
        defineSpinners(uiDefaults);
        defineScrollBars(uiDefaults);
        defineScrollPane(uiDefaults);
        defineSliders(uiDefaults);
        defineSplitPanes(uiDefaults);
        defineTabbedPanes(uiDefaults);
        defineTables(uiDefaults);
        defineTextControls(uiDefaults);
        defineToolBars(uiDefaults);
        defineTrees(uiDefaults);
        defineToolTips(uiDefaults);
        defineOptionPane(uiDefaults);
        defineFileChooser(uiDefaults);

        if (!PlatformUtils.isMac()) {
            uiDefaults.put("MenuBar[Enabled].backgroundPainter", null);
            uiDefaults.put("MenuBar[Enabled].borderPainter", null);

            // If we're not on a Mac, draw our own title bar.
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true);
        } else {

            // If we're on a Mac, use the screen menu bar.
            System.setProperty("apple.laf.useScreenMenuBar", "true");

            // If we're on a Mac, use Aqua for some things.
            defineAquaSettings(uiDefaults);
        }
    }

    return uiDefaults;
}