Demo: updated screenshot mode

This commit is contained in:
Karl Tauber
2021-01-28 23:26:16 +01:00
parent e5d9060623
commit 47c4d508e0
3 changed files with 30 additions and 1 deletions

View File

@@ -40,6 +40,9 @@ public class FlatLafDemo
if( SystemInfo.isMacOS && System.getProperty( "apple.laf.useScreenMenuBar" ) == null )
System.setProperty( "apple.laf.useScreenMenuBar", "true" );
if( FlatLafDemo.screenshotsMode && !SystemInfo.isJava_9_orLater && System.getProperty( "flatlaf.uiScale" ) == null )
System.setProperty( "flatlaf.uiScale", "2x" );
SwingUtilities.invokeLater( () -> {
DemoPrefs.init( PREFS_ROOT_PATH );
@@ -61,7 +64,7 @@ public class FlatLafDemo
DemoFrame frame = new DemoFrame();
if( FlatLafDemo.screenshotsMode )
frame.setPreferredSize( new Dimension( 1280, 620 ) );
frame.setPreferredSize( new Dimension( 1660, 840 ) );
// show frame
frame.pack();

View File

@@ -481,6 +481,7 @@ class MoreComponentsPanel
indeterminateCheckBox,
toolTipLabel, toolTip1, toolTip2,
toolBarLabel, toolBar1, toolBar2,
splitPaneLabel, splitPane3,
};
for( Component c : components )

View File

@@ -25,6 +25,8 @@ import javax.swing.*;
import javax.swing.border.*;
import com.formdev.flatlaf.extras.FlatSVGIcon;
import com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon;
import net.miginfocom.layout.AC;
import net.miginfocom.layout.ConstraintParser;
import net.miginfocom.swing.*;
/**
@@ -1009,6 +1011,29 @@ class TabsPanel
tabsPopupPolicyButtonGroup.add(popupAsNeededButton);
tabsPopupPolicyButtonGroup.add(popupNeverButton);
// JFormDesigner - End of component initialization //GEN-END:initComponents
if( FlatLafDemo.screenshotsMode ) {
Component[] components = new Component[] {
tabPlacementLabel, tabPlacementToolBar, tabPlacementTabbedPane,
iconBottomTabbedPane, iconTrailingTabbedPane,
alignLeadingTabbedPane, alignTrailingTabbedPane, alignFillTabbedPane,
panel3, separator2, panel4,
};
for( Component c : components )
c.setVisible( false );
// remove gaps
MigLayout layout1 = (MigLayout) panel1.getLayout();
AC rowSpecs1 = ConstraintParser.parseRowConstraints( (String) layout1.getRowConstraints() );
rowSpecs1.gap( "0!", 0, 1 );
layout1.setRowConstraints( rowSpecs1 );
MigLayout layout2 = (MigLayout) panel2.getLayout();
AC rowSpecs2 = ConstraintParser.parseRowConstraints( (String) layout2.getRowConstraints() );
rowSpecs2.gap( "0!", 2, 4, 8 );
layout2.setRowConstraints( rowSpecs2 );
}
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables