mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 14:30:56 +03:00
Demo:
- keep "Options > Window decorations" selected for JetBrains Runtime - disable "Options > Use underline menu selection" on macOS - added font size `11`
This commit is contained in:
@@ -35,6 +35,7 @@ import com.formdev.flatlaf.extras.components.FlatButton;
|
|||||||
import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
|
import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
|
||||||
import com.formdev.flatlaf.extras.FlatSVGUtils;
|
import com.formdev.flatlaf.extras.FlatSVGUtils;
|
||||||
import com.formdev.flatlaf.ui.JBRCustomDecorations;
|
import com.formdev.flatlaf.ui.JBRCustomDecorations;
|
||||||
|
import com.formdev.flatlaf.util.SystemInfo;
|
||||||
import net.miginfocom.layout.ConstraintParser;
|
import net.miginfocom.layout.ConstraintParser;
|
||||||
import net.miginfocom.layout.LC;
|
import net.miginfocom.layout.LC;
|
||||||
import net.miginfocom.layout.UnitValue;
|
import net.miginfocom.layout.UnitValue;
|
||||||
@@ -264,7 +265,7 @@ class DemoFrame
|
|||||||
// add font sizes
|
// add font sizes
|
||||||
fontMenu.addSeparator();
|
fontMenu.addSeparator();
|
||||||
ArrayList<String> sizes = new ArrayList<>( Arrays.asList(
|
ArrayList<String> sizes = new ArrayList<>( Arrays.asList(
|
||||||
"10", "12", "14", "16", "18", "20", "24", "28" ) );
|
"10", "11", "12", "14", "16", "18", "20", "24", "28" ) );
|
||||||
if( !sizes.contains( currentSize ) )
|
if( !sizes.contains( currentSize ) )
|
||||||
sizes.add( currentSize );
|
sizes.add( currentSize );
|
||||||
sizes.sort( String.CASE_INSENSITIVE_ORDER );
|
sizes.sort( String.CASE_INSENSITIVE_ORDER );
|
||||||
@@ -586,7 +587,7 @@ class DemoFrame
|
|||||||
optionsMenu.add(menuBarEmbeddedCheckBoxMenuItem);
|
optionsMenu.add(menuBarEmbeddedCheckBoxMenuItem);
|
||||||
|
|
||||||
//---- unifiedTitleBarMenuItem ----
|
//---- unifiedTitleBarMenuItem ----
|
||||||
unifiedTitleBarMenuItem.setText("Unified Title Bar");
|
unifiedTitleBarMenuItem.setText("Unified window title bar");
|
||||||
unifiedTitleBarMenuItem.addActionListener(e -> unifiedTitleBar());
|
unifiedTitleBarMenuItem.addActionListener(e -> unifiedTitleBar());
|
||||||
optionsMenu.add(unifiedTitleBarMenuItem);
|
optionsMenu.add(unifiedTitleBarMenuItem);
|
||||||
|
|
||||||
@@ -732,21 +733,21 @@ class DemoFrame
|
|||||||
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
|
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
|
||||||
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
|
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
|
||||||
|
|
||||||
boolean supportsWindowDecorations = FlatLaf.supportsNativeWindowDecorations();
|
if( FlatLaf.supportsNativeWindowDecorations() ) {
|
||||||
|
if( JBRCustomDecorations.isSupported() ) {
|
||||||
// If the JetBrainsRuntime is used, it forces the use of it's own custom
|
// If the JetBrains Runtime is used, it forces the use of it's own custom
|
||||||
// window decoration, meaning we can't use our own.
|
// window decoration, which can not disabled.
|
||||||
if( !supportsWindowDecorations || JBRCustomDecorations.isSupported() ) {
|
|
||||||
windowDecorationsCheckBoxMenuItem.setEnabled( false );
|
windowDecorationsCheckBoxMenuItem.setEnabled( false );
|
||||||
windowDecorationsCheckBoxMenuItem.setSelected( false );
|
|
||||||
windowDecorationsCheckBoxMenuItem.setToolTipText( "Not supported on your system." );
|
|
||||||
}
|
}
|
||||||
if( !supportsWindowDecorations ) {
|
} else {
|
||||||
menuBarEmbeddedCheckBoxMenuItem.setEnabled( false );
|
unsupported( windowDecorationsCheckBoxMenuItem );
|
||||||
menuBarEmbeddedCheckBoxMenuItem.setSelected( false );
|
unsupported( menuBarEmbeddedCheckBoxMenuItem );
|
||||||
menuBarEmbeddedCheckBoxMenuItem.setToolTipText( "Not supported on your system." );
|
unsupported( unifiedTitleBarMenuItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( SystemInfo.isMacOS )
|
||||||
|
unsupported( underlineMenuSelectionMenuItem );
|
||||||
|
|
||||||
// remove contentPanel bottom insets
|
// remove contentPanel bottom insets
|
||||||
MigLayout layout = (MigLayout) contentPanel.getLayout();
|
MigLayout layout = (MigLayout) contentPanel.getLayout();
|
||||||
LC lc = ConstraintParser.parseLayoutConstraint( (String) layout.getLayoutConstraints() );
|
LC lc = ConstraintParser.parseLayoutConstraint( (String) layout.getLayoutConstraints() );
|
||||||
@@ -760,6 +761,12 @@ class DemoFrame
|
|||||||
layout.setLayoutConstraints( lc );
|
layout.setLayoutConstraints( lc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void unsupported( JCheckBoxMenuItem menuItem ) {
|
||||||
|
menuItem.setEnabled( false );
|
||||||
|
menuItem.setSelected( false );
|
||||||
|
menuItem.setToolTipText( "Not supported on your system." );
|
||||||
|
}
|
||||||
|
|
||||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
private JMenu fontMenu;
|
private JMenu fontMenu;
|
||||||
private JMenu optionsMenu;
|
private JMenu optionsMenu;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
JFDML JFormDesigner: "7.0.3.1.342" Java: "16" encoding: "UTF-8"
|
||||||
|
|
||||||
new FormModel {
|
new FormModel {
|
||||||
contentType: "form/swing"
|
contentType: "form/swing"
|
||||||
@@ -362,7 +362,7 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
|
||||||
name: "unifiedTitleBarMenuItem"
|
name: "unifiedTitleBarMenuItem"
|
||||||
"text": "Unified Title Bar"
|
"text": "Unified window title bar"
|
||||||
auxiliary() {
|
auxiliary() {
|
||||||
"JavaCodeGenerator.variableLocal": false
|
"JavaCodeGenerator.variableLocal": false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user