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

The following examples show how to use javax.swing.JFrame#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: InputMethodJFrame.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 2
Source File: InputMethodJFrame.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 3
Source File: InputMethodJFrame.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 4
Source File: InputMethodJFrame.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 5
Source File: InputMethodJFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 6
Source File: InputMethodJFrame.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 7
Source File: InputMethodJFrame.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 8
Source File: InputMethodJFrame.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 9
Source File: InputMethodJFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 10
Source File: InputMethodJFrame.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 11
Source File: InputMethodJFrame.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 12
Source File: InputMethodJFrame.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 13
Source File: InputMethodJFrame.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 14
Source File: InputMethodJFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a Swing based input method window.
 */
public InputMethodJFrame(String title, InputContext context) {
    super(title);
    //InputMethodJFrame never has LookAndFeel decoration
    if(JFrame.isDefaultLookAndFeelDecorated())
    {
       this.setUndecorated(true);
       this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
    }
    if (context != null) {
        this.inputContext = context;
    }
    setFocusableWindowState(false);
}
 
Example 15
Source File: Launcher.java    From osp with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Sets the look and feel.
 *
 * @param lf OSPRuntime name of look and feel
 * @param always true to set LnF even if already set
 * @return a new Launcher
 */
protected Launcher setLookAndFeel(final String lf, final boolean always) {
  if(lf==null) {
    return null;
  }
  lookAndFeel = lf;
  boolean newDecorations = true;
  boolean currentDecorations = JFrame.isDefaultLookAndFeelDecorated();
  if(lf.equals(OSPRuntime.SYSTEM_LF)) {
    systemLFItem.setSelected(true);
  } else if(lf.equals(OSPRuntime.CROSS_PLATFORM_LF)) {
    javaLFItem.setSelected(true);
  } else if(lf.equals(OSPRuntime.DEFAULT_LF)) {
    newDecorations = OSPRuntime.DEFAULT_LOOK_AND_FEEL_DECORATIONS;
    defaultLFItem.setSelected(true);
  } else if(genericLFGroup.getSelection()!=null) {
    genericLFGroup.remove(systemLFItem);
    genericLFGroup.remove(javaLFItem);
    genericLFGroup.remove(defaultLFItem);
    systemLFItem.setSelected(false);
    javaLFItem.setSelected(false);
    defaultLFItem.setSelected(false);
    genericLFGroup.add(systemLFItem);
    genericLFGroup.add(javaLFItem);
    genericLFGroup.add(defaultLFItem);
  }
  Object lfType = OSPRuntime.LOOK_AND_FEEL_TYPES.get(lf);
  LookAndFeel currentLF = UIManager.getLookAndFeel();
  if(!always&&(newDecorations==currentDecorations)&&currentLF.getClass().getName().equals(lfType)) {
    return null;
  }
  if(!isVisible()) {
    frame.addWindowListener(new WindowAdapter() {
      public void windowOpened(WindowEvent e) {
        setLookAndFeel(lf, always);
        frame.removeWindowListener(this);
      }

    });
    return null;
  }
  OSPRuntime.setLookAndFeel(newDecorations, lf);
  if(spawner!=null) {
    spawner = spawner.setLookAndFeel(lf, true);
  }
  exitCurrentApps();
  LauncherUndo undoManager = Launcher.this.undoManager;
  UndoableEditSupport undoSupport = Launcher.this.undoSupport;
  LaunchNode node = Launcher.this.getSelectedNode();
  Point loc = Launcher.this.frame.getLocation();
  Launcher.this.frame.dispose();
  Launcher launcher;
  LaunchSet tabset = new LaunchSet(Launcher.this, tabSetName);
  XMLControlElement control = new XMLControlElement(tabset);
  // set null password so LaunchBuilder opens without verification
  control.setPassword(null);
  if(Launcher.this instanceof LaunchBuilder) {
    launcher = new LaunchBuilder(control.toXML());
  } else {
    launcher = new Launcher(control.toXML());
  }
  launcher.setSelectedNode(node.getPathString());
  undoManager.setLauncher(launcher);
  launcher.undoManager = undoManager;
  launcher.undoSupport = undoSupport;
  launcher.tabSetName = tabSetName;
  launcher.password = password;
  launcher.spawner = spawner;
  launcher.jarBasePath = jarBasePath;
  launcher.frame.setDefaultCloseOperation(Launcher.this.frame.getDefaultCloseOperation());
  launcher.refreshGUI();
  launcher.frame.setLocation(loc);
  launcher.setVisible(true);
  launcher.frame.pack();
  SwingUtilities.updateComponentTreeUI(OSPLog.getOSPLog());
  return launcher;
}
 
Example 16
Source File: JBRCustomDecorations.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
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 17
Source File: PreferencesAction.java    From keystore-explorer with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Display the preferences dialog and store the user's choices.
 */
public void showPreferences() {
	ApplicationSettings applicationSettings = ApplicationSettings.getInstance();

	File caCertificatesFile = applicationSettings.getCaCertificatesFile();

	DPreferences dPreferences = new DPreferences(frame, applicationSettings.getUseCaCertificates(),
			caCertificatesFile, applicationSettings.getUseWindowsTrustedRootCertificates(),
			applicationSettings.getEnableImportTrustedCertTrustCheck(),
			applicationSettings.getEnableImportCaReplyTrustCheck(), applicationSettings.getPasswordQualityConfig(),
			applicationSettings.getDefaultDN(), applicationSettings.getLanguage(),
			applicationSettings.isAutoUpdateCheckEnabled(), applicationSettings.getAutoUpdateCheckInterval(),
			applicationSettings.getKeyStoreTableColumns());
	dPreferences.setLocationRelativeTo(frame);
	dPreferences.setVisible(true);

	if (dPreferences.wasCancelled()) {
		return;
	}

	File tmpFile = dPreferences.getCaCertificatesFile();

	if (!tmpFile.equals(caCertificatesFile)) {
		AuthorityCertificates authorityCertificates = AuthorityCertificates.getInstance();
		authorityCertificates.setCaCertificates(null);
	}

	caCertificatesFile = tmpFile;

	applicationSettings.setCaCertificatesFile(caCertificatesFile);
	applicationSettings.setUseCaCertificates(dPreferences.getUseCaCertificates());
	applicationSettings.setUseWindowsTrustedRootCertificates(dPreferences.getUseWinTrustRootCertificates());
	applicationSettings.setEnableImportTrustedCertTrustCheck(dPreferences.getEnableImportTrustedCertTrustCheck());
	applicationSettings.setEnableImportCaReplyTrustCheck(dPreferences.getEnableImportCaReplyTrustCheck());
	applicationSettings.setPasswordQualityConfig(dPreferences.getPasswordQualityConfig());
	applicationSettings.setDefaultDN(dPreferences.getDefaultDN());
	applicationSettings.setAutoUpdateCheckEnabled(dPreferences.isAutoUpdateChecksEnabled());
	applicationSettings.setAutoUpdateCheckInterval(dPreferences.getAutoUpdateChecksInterval());

	UIManager.LookAndFeelInfo lookFeelInfo = dPreferences.getLookFeelInfo();
	applicationSettings.setLookAndFeelClass(lookFeelInfo.getClassName());

	boolean lookAndFeelDecorated = dPreferences.getLookFeelDecoration();
	applicationSettings.setLookAndFeelDecorated(lookAndFeelDecorated);

	String language = dPreferences.getLanguage();
	boolean languageHasChanged = !language.equals(applicationSettings.getLanguage());
	applicationSettings.setLanguage(language);

	if (dPreferences.columnsChanged()) {
		applicationSettings.setKeyStoreTableColumns(dPreferences.getColumns());
		kseFrame.redrawKeyStores(applicationSettings);
	}

	if ((!lookFeelInfo.getClassName().equals(UIManager.getLookAndFeel().getClass().getName()))
			|| (lookAndFeelDecorated != JFrame.isDefaultLookAndFeelDecorated())
			|| languageHasChanged) {
		// L&F or language changed - restart required for upgrade to take effect
		JOptionPane.showMessageDialog(frame, res.getString("PreferencesAction.LookFeelChanged.message"),
				res.getString("PreferencesAction.LookFeelChanged.Title"), JOptionPane.INFORMATION_MESSAGE);

		exitApplication(true);
	}
}
 
Example 18
Source File: FPortecle.java    From portecle with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Display the options dialog and store the user's choices.
 */
private void showOptions()
{
	DOptions dOptions = new DOptions(this, m_bUseCaCerts, m_fCaCertsFile);
	dOptions.setLocationRelativeTo(this);
	SwingHelper.showAndWait(dOptions);

	// Store/apply the chosen options:

	// CA certificates file
	File fTmp = dOptions.getCaCertsFile();

	if (!fTmp.equals(m_fCaCertsFile))
	{
		// CA certificates file changed - any stored CA certificates keystore is now invalid
		m_caCertsKeyStore = null;
	}

	m_fCaCertsFile = fTmp;

	// Use CA certificates?
	m_bUseCaCerts = dOptions.isUseCaCerts();

	// Look & feel
	String newLookFeelClassName = dOptions.getLookFeelClassName();

	// Look & feel decoration
	boolean bLookFeelDecoration = dOptions.isLookFeelDecoration();

	// Look & feel/decoration changed?
	// Note: UIManager.LookAndFeelInfo.getName() and LookAndFeel.getName() can be different for the same
	// L&F (one example is the GTK+ one in J2SE 5 RC2 (Linux), where the former is "GTK+" and the latter
	// is "GTK look and feel"). Therefore, compare the class names instead.
	if (newLookFeelClassName != null &&
	    (!newLookFeelClassName.equals(UIManager.getLookAndFeel().getClass().getName()) ||
	        bLookFeelDecoration != JFrame.isDefaultLookAndFeelDecorated()))
	{
		// Yes - save selections to be picked up by application preferences,
		lookFeelClassName = newLookFeelClassName;
		m_bLookFeelDecorationOptions = bLookFeelDecoration;
		saveAppPrefs();

		JFrame.setDefaultLookAndFeelDecorated(bLookFeelDecoration);
		JDialog.setDefaultLookAndFeelDecorated(bLookFeelDecoration);
		try
		{
			UIManager.setLookAndFeel(lookFeelClassName);
			SwingUtilities.updateComponentTreeUI(getRootPane());
			pack();
		}
		catch (Exception e)
		{
			DThrowable.showAndWait(this, null, e);
		}
	}
}
 
Example 19
Source File: FlatLaf.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
@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 );
	}
}
 
Example 20
Source File: OSPRuntime.java    From osp with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns true if newly created <code>JFrame</code>s or <code>JDialog</code>s should have their
 * Window decorations provided by the current look and feel. This is only
 * a hint, as certain look and feels may not support this feature.
 *
 * @return true if look and feel should provide Window decorations.
 * @since 1.4
 */
public static boolean isDefaultLookAndFeelDecorated() {
  return JFrame.isDefaultLookAndFeelDecorated();
}