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

The following examples show how to use javax.swing.JFrame#setDefaultLookAndFeelDecorated() . These examples are extracted from open source projects. 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 Project: HubPlayer   File: Main.java    License: GNU General Public License v3.0 6 votes vote down vote up
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();
		});

	}
 
Example 2
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();
	}
 
Example 3
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 4
Source Project: portecle   File: FPortecle.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 5
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 Project: HJMirror   File: ConnectView.java    License: MIT License 5 votes vote down vote up
@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);
}
 
Example 7
Source Project: FlatLaf   File: FlatLaf.java    License: 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 8
/**
 * 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);
    });
}
 
Example 9
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");
	}
}
 
Example 10
/**
 * 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);
    });
}
 
Example 11
Source Project: swing_library   File: MenTest.java    License: MIT License 5 votes vote down vote up
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);
}
 
Example 12
Source Project: magarena   File: SimpleApp.java    License: GNU General Public License v3.0 5 votes vote down vote up
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");
	}
}
 
Example 13
/**
 * 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);
    });
}
 
Example 14
/**
 * 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);
    });
}
 
Example 15
/**
 * 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);
    });
}
 
Example 16
/**
 * 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);
    });
}
 
Example 17
/**
 * 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);
    });
}
 
Example 18
Source Project: Girinoscope   File: UI.java    License: 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 19
Source Project: dctb-utfpr-2018-1   File: Sliders.java    License: Apache License 2.0 4 votes vote down vote up
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);

}
 
Example 20
Source Project: seaglass   File: SeaGlassLookAndFeel.java    License: 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;
}