Java Code Examples for javax.swing.JDialog#isDefaultLookAndFeelDecorated()
The following examples show how to use
javax.swing.JDialog#isDefaultLookAndFeelDecorated() .
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: OSPTableInspector.java From osp with GNU General Public License v3.0 | 6 votes |
private void createGUI() { setSize(400, 300); setContentPane(new JPanel(new BorderLayout())); JScrollPane scrollpane = new JScrollPane(table); scrollpane.createHorizontalScrollBar(); getContentPane().add(scrollpane, BorderLayout.CENTER); if(!JDialog.isDefaultLookAndFeelDecorated()) { return; } JPanel panel = new JPanel(new FlowLayout()); JButton closeButton = new JButton(ControlsRes.getString("OSPTableInspector.OK")); //$NON-NLS-1$ panel.add(closeButton); getContentPane().add(panel, BorderLayout.SOUTH); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); dispose(); } }); }
Example 2
Source File: JBRCustomDecorations.java From FlatLaf with Apache License 2.0 | 4 votes |
static void install( Window window ) { if( !isSupported() ) return; // do not enable JBR decorations if LaF provides decorations if( UIManager.getLookAndFeel().getSupportsWindowDecorations() ) return; if( window instanceof JFrame ) { JFrame frame = (JFrame) window; // do not enable JBR decorations if JFrame should use system window decorations // and if not forced to use JBR decorations if( !JFrame.isDefaultLookAndFeelDecorated() && !FlatSystemProperties.getBoolean( FlatSystemProperties.USE_JETBRAINS_CUSTOM_DECORATIONS, false )) return; // do not enable JBR decorations if frame is undecorated if( frame.isUndecorated() ) return; // enable JBR custom window decoration for window setHasCustomDecoration( frame ); // enable Swing window decoration frame.getRootPane().setWindowDecorationStyle( JRootPane.FRAME ); } else if( window instanceof JDialog ) { JDialog dialog = (JDialog) window; // do not enable JBR decorations if JDialog should use system window decorations // and if not forced to use JBR decorations if( !JDialog.isDefaultLookAndFeelDecorated() && !FlatSystemProperties.getBoolean( FlatSystemProperties.USE_JETBRAINS_CUSTOM_DECORATIONS, false )) return; // do not enable JBR decorations if dialog is undecorated if( dialog.isUndecorated() ) return; // enable JBR custom window decoration for window setHasCustomDecoration( dialog ); // enable Swing window decoration dialog.getRootPane().setWindowDecorationStyle( JRootPane.PLAIN_DIALOG ); } }
Example 3
Source File: FlatLaf.java From FlatLaf with Apache License 2.0 | 4 votes |
@Override public void initialize() { if( SystemInfo.IS_MAC ) initializeAqua(); super.initialize(); // install popup factory oldPopupFactory = PopupFactory.getSharedInstance(); PopupFactory.setSharedInstance( new FlatPopupFactory() ); // install mnemonic handler mnemonicHandler = new MnemonicHandler(); mnemonicHandler.install(); // listen to desktop property changes to update UI if system font or scaling changes if( SystemInfo.IS_WINDOWS ) { // Windows 10 allows increasing font size independent of scaling: // Settings > Ease of Access > Display > Make text bigger (100% - 225%) desktopPropertyName = "win.messagebox.font"; } else if( SystemInfo.IS_LINUX ) { // Linux/Gnome allows changing font in "Tweaks" app desktopPropertyName = "gnome.Gtk/FontName"; // Linux/Gnome allows extra scaling and larger text: // Settings > Devices > Displays > Scale (100% or 200%) // Settings > Universal access > Large Text (off or on, 125%) // "Tweaks" app > Fonts > Scaling Factor (0,5 - 3) desktopPropertyName2 = "gnome.Xft/DPI"; } if( desktopPropertyName != null ) { desktopPropertyListener = e -> { String propertyName = e.getPropertyName(); if( desktopPropertyName.equals( propertyName ) || propertyName.equals( desktopPropertyName2 ) ) reSetLookAndFeel(); else if( DESKTOPFONTHINTS.equals( propertyName ) ) { if( UIManager.getLookAndFeel() instanceof FlatLaf ) { putAATextInfo( UIManager.getLookAndFeelDefaults() ); updateUILater(); } } }; Toolkit toolkit = Toolkit.getDefaultToolkit(); toolkit.addPropertyChangeListener( desktopPropertyName, desktopPropertyListener ); if( desktopPropertyName2 != null ) toolkit.addPropertyChangeListener( desktopPropertyName2, desktopPropertyListener ); toolkit.addPropertyChangeListener( DESKTOPFONTHINTS, desktopPropertyListener ); } // Following code should be ideally in initialize(), but needs color from UI defaults. // Do not move this code to getDefaults() to avoid side effects in the case that // getDefaults() is directly invoked from 3rd party code. E.g. `new FlatLightLaf().getDefaults()`. postInitialization = defaults -> { // update link color in HTML text Color linkColor = defaults.getColor( "Component.linkColor" ); if( linkColor != null ) { new HTMLEditorKit().getStyleSheet().addRule( String.format( "a { color: #%06x; }", linkColor.getRGB() & 0xffffff ) ); } }; // enable/disable window decorations, but only if system property is either // "true" or "false"; in other cases it is not changed Boolean useWindowDecorations = FlatSystemProperties.getBooleanStrict( FlatSystemProperties.USE_WINDOW_DECORATIONS, null ); if( useWindowDecorations != null ) { oldFrameWindowDecorated = JFrame.isDefaultLookAndFeelDecorated(); oldDialogWindowDecorated = JDialog.isDefaultLookAndFeelDecorated(); JFrame.setDefaultLookAndFeelDecorated( useWindowDecorations ); JDialog.setDefaultLookAndFeelDecorated( useWindowDecorations ); } }