mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
UI defaults inspector: initial commit with basic functionality
This commit is contained in:
@@ -31,6 +31,7 @@ import com.formdev.flatlaf.demo.extras.*;
|
||||
import com.formdev.flatlaf.demo.intellijthemes.*;
|
||||
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
|
||||
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
||||
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
|
||||
import com.formdev.flatlaf.extras.SVGUtils;
|
||||
import com.formdev.flatlaf.ui.JBRCustomDecorations;
|
||||
import net.miginfocom.layout.ConstraintParser;
|
||||
@@ -93,6 +94,10 @@ class DemoFrame
|
||||
state.remove( "hint.themesPanel" );
|
||||
}
|
||||
|
||||
private void showUIDefaultsInspector() {
|
||||
FlatUIDefaultsInspector.show();
|
||||
}
|
||||
|
||||
private void openActionPerformed() {
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.showOpenDialog( this );
|
||||
@@ -104,7 +109,7 @@ class DemoFrame
|
||||
}
|
||||
|
||||
private void exitActionPerformed() {
|
||||
dispose();
|
||||
System.exit( 0 );
|
||||
}
|
||||
|
||||
private void aboutActionPerformed() {
|
||||
@@ -308,6 +313,7 @@ class DemoFrame
|
||||
alwaysShowMnemonicsMenuItem = new JCheckBoxMenuItem();
|
||||
animatedLafChangeMenuItem = new JCheckBoxMenuItem();
|
||||
JMenuItem showHintsMenuItem = new JMenuItem();
|
||||
JMenuItem showUIDefaultsInspectorMenuItem = new JMenuItem();
|
||||
JMenu helpMenu = new JMenu();
|
||||
JMenuItem aboutMenuItem = new JMenuItem();
|
||||
JToolBar toolBar1 = new JToolBar();
|
||||
@@ -331,7 +337,7 @@ class DemoFrame
|
||||
|
||||
//======== this ========
|
||||
setTitle("FlatLaf Demo");
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
Container contentPane = getContentPane();
|
||||
contentPane.setLayout(new BorderLayout());
|
||||
|
||||
@@ -579,6 +585,11 @@ class DemoFrame
|
||||
showHintsMenuItem.setText("Show hints");
|
||||
showHintsMenuItem.addActionListener(e -> showHintsChanged());
|
||||
optionsMenu.add(showHintsMenuItem);
|
||||
|
||||
//---- showUIDefaultsInspectorMenuItem ----
|
||||
showUIDefaultsInspectorMenuItem.setText("Show UIDefaults Inspector");
|
||||
showUIDefaultsInspectorMenuItem.addActionListener(e -> showUIDefaultsInspector());
|
||||
optionsMenu.add(showUIDefaultsInspectorMenuItem);
|
||||
}
|
||||
menuBar1.add(optionsMenu);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ new FormModel {
|
||||
add( new FormWindow( "javax.swing.JFrame", new FormLayoutManager( class java.awt.BorderLayout ) ) {
|
||||
name: "this"
|
||||
"title": "FlatLaf Demo"
|
||||
"defaultCloseOperation": 2
|
||||
"defaultCloseOperation": 3
|
||||
"$locationPolicy": 2
|
||||
"$sizePolicy": 2
|
||||
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
|
||||
@@ -383,6 +383,11 @@ new FormModel {
|
||||
"text": "Show hints"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showHintsChanged", false ) )
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JMenuItem" ) {
|
||||
name: "showUIDefaultsInspectorMenuItem"
|
||||
"text": "Show UIDefaults Inspector"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showUIDefaultsInspector", false ) )
|
||||
} )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "helpMenu"
|
||||
|
||||
@@ -22,6 +22,7 @@ import javax.swing.JFrame;
|
||||
import javax.swing.SwingUtilities;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.extras.FlatInspector;
|
||||
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
|
||||
/**
|
||||
@@ -52,8 +53,9 @@ public class FlatLafDemo
|
||||
// set look and feel
|
||||
DemoPrefs.initLaf( args );
|
||||
|
||||
// install inspector
|
||||
// install inspectors
|
||||
FlatInspector.install( "ctrl shift alt X" );
|
||||
FlatUIDefaultsInspector.install( "ctrl shift alt Y" );
|
||||
|
||||
// create frame
|
||||
DemoFrame frame = new DemoFrame();
|
||||
|
||||
Reference in New Issue
Block a user