Demo: fixed too large gap between themes list and control bar

This commit is contained in:
Karl Tauber
2020-08-31 18:25:01 +02:00
parent 5923ac65df
commit 3b71fcd690

View File

@@ -30,6 +30,9 @@ import com.formdev.flatlaf.*;
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
import com.formdev.flatlaf.util.SystemInfo;
import com.formdev.flatlaf.util.UIScale;
import net.miginfocom.layout.ConstraintParser;
import net.miginfocom.layout.LC;
import net.miginfocom.layout.UnitValue;
import net.miginfocom.swing.*;
/**
@@ -44,6 +47,18 @@ class ControlBar
ControlBar() {
initComponents();
// remove top insets
MigLayout layout = (MigLayout) getLayout();
LC lc = ConstraintParser.parseLayoutConstraint( (String) layout.getLayoutConstraints() );
UnitValue[] insets = lc.getInsets();
lc.setInsets( new UnitValue[] {
new UnitValue( 0, UnitValue.PIXEL, null ),
insets[1],
insets[2],
insets[3]
} );
layout.setLayoutConstraints( lc );
// initialize look and feels combo box
DefaultComboBoxModel<LookAndFeelInfo> lafModel = new DefaultComboBoxModel<>();
lafModel.addElement( new LookAndFeelInfo( "Flat Light (F1)", FlatLightLaf.class.getName() ) );