Java Code Examples for javax.swing.JDialog#setDefaultLookAndFeelDecorated()

The following examples show how to use javax.swing.JDialog#setDefaultLookAndFeelDecorated() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Metalworks.java    From openjdk-8-source with GNU General Public License v2.0 7 votes vote down vote up
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);
}
 
Example 2
Source File: Metalworks.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: BeautyEyeLookAndFeelWin.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
/**
	 * 据BeautyEyeLNFHelper.frameBorderStyle指明的窗口边框类型来
	 * 决定是否使用操作系统相关的窗口装饰样式.
	 */
	static void initLookAndFeelDecorated()
	{
		if(BeautyEyeLNFHelper.frameBorderStyle == FrameBorderStyle.osLookAndFeelDecorated)
		{
			JFrame.setDefaultLookAndFeelDecorated(false);
			JDialog.setDefaultLookAndFeelDecorated(false);
		}
		else
		{
			JFrame.setDefaultLookAndFeelDecorated(true);
			JDialog.setDefaultLookAndFeelDecorated(true);
		}
		
//		UIManager.put("swing.aatext", Boolean.FALSE);
	}
 
Example 4
Source File: Metalworks.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 5
Source File: Metalworks.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 6
Source File: Metalworks.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 7
Source File: QFixMessenger.java    From quickfix-messenger with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static void setLookAndFeel()
{
	try
	{
		String useSystemLookAndFeelProperty = System
				.getProperty("useSystemLaF");
		if (Boolean.valueOf(useSystemLookAndFeelProperty))
		{
			UIManager.setLookAndFeel(UIManager
					.getSystemLookAndFeelClassName());
		} else
		{
			UIManager
					.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceDustLookAndFeel");
			JFrame.setDefaultLookAndFeelDecorated(true);
			JDialog.setDefaultLookAndFeelDecorated(true);
		}
	} catch (Exception ex)
	{
		logger.warn(ex.getMessage(), ex);
	}
}
 
Example 8
Source File: Metalworks.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 9
Source File: Metalworks.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 10
Source File: RegisterTabCloseChangeListener_SpecificMultipleVetoable.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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_SpecificMultipleVetoable().setVisible(true);
    });
}
 
Example 11
Source File: RegisterTabCloseChangeListener_GeneralSingleVetoable.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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_GeneralSingleVetoable().setVisible(true);
    });
}
 
Example 12
Source File: SetSkin_ClassName.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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 SetSkin_ClassName().setVisible(true);
    });
}
 
Example 13
Source File: ResupplyWindow.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
/**
	 * Cancels the currently selected transport item.
	 */
	private void cancelTransportItem() {
		String msg = "Note: you have highlighted a mission on the top-left box 'Incoming Transport Items' and clicked on the 'Discard Mission' button.";

//		if (mainScene != null) {
//			Platform.runLater(() -> {
//				askFX(msg);
//			});
//		}
//		else {
			// Add a dialog box asking the user to confirm "discarding" the mission
			JDialog.setDefaultLookAndFeelDecorated(true);
			final int response = JOptionPane.showConfirmDialog(null, msg, "Confirm",
					JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
			if (response == JOptionPane.NO_OPTION) {
				// "No" button click, do nothing
			} else if (response == JOptionPane.YES_OPTION) {
				// "Yes" button clicked and go ahead with discarding this mission
				Transportable transportItem = (Transportable) incomingListPane.getIncomingList().getSelectedValue();
				if (transportItem != null) {
					// call cancelTransportItem() in TransportManager Class to cancel the selected transport item.
					Simulation.instance().getTransportManager().cancelTransportItem(transportItem);
				}
			} else if (response == JOptionPane.CLOSED_OPTION) {
				// Close the dialogbox, do nothing
			}
//		}
	}
 
Example 14
Source File: SetSkin_Instance.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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 SetSkin_Instance().setVisible(true);
    });
}
 
Example 15
Source File: GetAllTabCloseListeners_Global.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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 BusinessBlackSteelSkin());
        new GetAllTabCloseListeners_Global().setVisible(true);
    });
}
 
Example 16
Source File: RegisterTabCloseChangeListener_GeneralMultipleVetoable.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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_GeneralMultipleVetoable().setVisible(true);
    });
}
 
Example 17
Source File: Principal.java    From java-sistema-vendas with GNU General Public License v3.0 5 votes vote down vote up
private static void lookAndFeel() {

        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true);
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
            JOptionPane.showMessageDialog(null, e, "Erro", JOptionPane.ERROR_MESSAGE);
        }
    }
 
Example 18
Source File: FlatLaf.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 19
Source File: UI.java    From Girinoscope with Apache License 2.0 4 votes vote down vote up
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);
        }
    });
}
 
Example 20
Source File: SeaGlassLookAndFeel.java    From seaglass with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
}