mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
FlatContainerTest:
- replaced "more tabs" checkbox and spinner with "tab count" spinner - avoid right-to-left for tabbed pane control panel - use other color for trailing component
This commit is contained in:
@@ -35,9 +35,6 @@ import net.miginfocom.swing.*;
|
|||||||
public class FlatContainerTest
|
public class FlatContainerTest
|
||||||
extends FlatTestPanel
|
extends FlatTestPanel
|
||||||
{
|
{
|
||||||
private final int initialTabCount;
|
|
||||||
private boolean autoMoreTabs;
|
|
||||||
|
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
SwingUtilities.invokeLater( () -> {
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" );
|
||||||
@@ -49,8 +46,7 @@ public class FlatContainerTest
|
|||||||
public FlatContainerTest() {
|
public FlatContainerTest() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
addInitialTabs( tabbedPane1, tabbedPane2, tabbedPane3, tabbedPane4 );
|
tabCountChanged();
|
||||||
initialTabCount = tabbedPane1.getTabCount();
|
|
||||||
|
|
||||||
tabsClosableCheckBox.setSelected( true );
|
tabsClosableCheckBox.setSelected( true );
|
||||||
tabsClosableChanged();
|
tabsClosableChanged();
|
||||||
@@ -67,15 +63,11 @@ public class FlatContainerTest
|
|||||||
tabbedPane3.setTabLayoutPolicy( tabLayoutPolicy );
|
tabbedPane3.setTabLayoutPolicy( tabLayoutPolicy );
|
||||||
tabbedPane4.setTabLayoutPolicy( tabLayoutPolicy );
|
tabbedPane4.setTabLayoutPolicy( tabLayoutPolicy );
|
||||||
|
|
||||||
if( !autoMoreTabs && tabScrollCheckBox.isSelected() && !moreTabsCheckBox.isSelected() ) {
|
int tabCount = (Integer) tabCountSpinner.getValue();
|
||||||
moreTabsCheckBox.setSelected( true );
|
if( tabLayoutPolicy == JTabbedPane.SCROLL_TAB_LAYOUT && tabCount == 4 )
|
||||||
moreTabsChanged();
|
tabCountSpinner.setValue( 8 );
|
||||||
autoMoreTabs = true;
|
else if( tabLayoutPolicy == JTabbedPane.WRAP_TAB_LAYOUT && tabCount == 8 )
|
||||||
} else if( autoMoreTabs && !tabScrollCheckBox.isSelected() && moreTabsCheckBox.isSelected() ) {
|
tabCountSpinner.setValue( 4 );
|
||||||
moreTabsCheckBox.setSelected( false );
|
|
||||||
moreTabsChanged();
|
|
||||||
autoMoreTabs = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showTabSeparatorsChanged() {
|
private void showTabSeparatorsChanged() {
|
||||||
@@ -100,52 +92,56 @@ public class FlatContainerTest
|
|||||||
tabbedPane4.putClientProperty( key, value );
|
tabbedPane4.putClientProperty( key, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moreTabsChanged() {
|
private void tabCountChanged() {
|
||||||
moreTabsSpinnerChanged();
|
tabCountChanged( tabbedPane1 );
|
||||||
|
tabCountChanged( tabbedPane2 );
|
||||||
autoMoreTabs = false;
|
tabCountChanged( tabbedPane3 );
|
||||||
|
tabCountChanged( tabbedPane4 );
|
||||||
moreTabsSpinner.setEnabled( moreTabsCheckBox.isSelected() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moreTabsSpinnerChanged() {
|
private void tabCountChanged( JTabbedPane tabbedPane ) {
|
||||||
addRemoveMoreTabs( tabbedPane1 );
|
|
||||||
addRemoveMoreTabs( tabbedPane2 );
|
|
||||||
addRemoveMoreTabs( tabbedPane3 );
|
|
||||||
addRemoveMoreTabs( tabbedPane4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addRemoveMoreTabs( JTabbedPane tabbedPane ) {
|
|
||||||
int oldTabCount = tabbedPane.getTabCount();
|
int oldTabCount = tabbedPane.getTabCount();
|
||||||
int newTabCount = initialTabCount + (moreTabsCheckBox.isSelected() ? (Integer) moreTabsSpinner.getValue() : 0);
|
int newTabCount = (Integer) tabCountSpinner.getValue();
|
||||||
|
|
||||||
if( newTabCount > oldTabCount ) {
|
if( newTabCount > oldTabCount ) {
|
||||||
for( int i = oldTabCount + 1; i <= newTabCount; i++ )
|
for( int i = oldTabCount + 1; i <= newTabCount; i++ )
|
||||||
addTab( tabbedPane, "Tab " + i, "tab content " + i );
|
addTab( tabbedPane );
|
||||||
} else if( newTabCount < oldTabCount ) {
|
} else if( newTabCount < oldTabCount ) {
|
||||||
while( tabbedPane.getTabCount() > newTabCount )
|
while( tabbedPane.getTabCount() > newTabCount )
|
||||||
tabbedPane.removeTabAt( tabbedPane.getTabCount() - 1 );
|
tabbedPane.removeTabAt( tabbedPane.getTabCount() - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
customTabsChanged( tabbedPane );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInitialTabs( JTabbedPane... tabbedPanes ) {
|
private void addTab( JTabbedPane tabbedPane ) {
|
||||||
for( JTabbedPane tabbedPane : tabbedPanes ) {
|
switch( tabbedPane.getTabCount() ) {
|
||||||
tabbedPane.addTab( "Tab 1", null, new Panel1(), "First tab." );
|
case 0:
|
||||||
|
tabbedPane.addTab( "Tab 1", null, new Panel1(), "First tab." );
|
||||||
|
break;
|
||||||
|
|
||||||
JComponent tab2 = new Panel2();
|
case 1:
|
||||||
tab2.setBorder( new LineBorder( Color.magenta ) );
|
JComponent tab2 = new Panel2();
|
||||||
tabbedPane.addTab( "Second Tab", null, tab2, "This is the second tab." );
|
tab2.setBorder( new LineBorder( Color.magenta ) );
|
||||||
|
tabbedPane.addTab( "Second Tab", null, tab2, "This is the second tab." );
|
||||||
|
break;
|
||||||
|
|
||||||
addTab( tabbedPane, "Disabled", "tab content 3" );
|
case 2:
|
||||||
tabbedPane.setEnabledAt( 2, false );
|
tabbedPane.addTab( "Disabled", createTab( "tab content 3" ) );
|
||||||
tabbedPane.setToolTipTextAt( 2, "Disabled tab." );
|
tabbedPane.setEnabledAt( 2, false );
|
||||||
|
tabbedPane.setToolTipTextAt( 2, "Disabled tab." );
|
||||||
|
break;
|
||||||
|
|
||||||
tabbedPane.addTab( "Tab 4", new JLabel( "non-opaque content", SwingConstants.CENTER ) );
|
case 3:
|
||||||
|
tabbedPane.addTab( "Tab 4", new JLabel( "non-opaque content", SwingConstants.CENTER ) );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
int index = tabbedPane.getTabCount() + 1;
|
||||||
|
tabbedPane.addTab( "Tab " + index, createTab( "tab content " + index ) );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void addTab( JTabbedPane tabbedPane, String title, String text ) {
|
|
||||||
tabbedPane.addTab( title, createTab( text ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JComponent createTab( String text ) {
|
private JComponent createTab( String text ) {
|
||||||
@@ -197,13 +193,14 @@ public class FlatContainerTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void customTabsChanged( JTabbedPane tabbedPane ) {
|
private void customTabsChanged( JTabbedPane tabbedPane ) {
|
||||||
if( customTabsCheckBox.isSelected() ) {
|
boolean customTabs = customTabsCheckBox.isSelected();
|
||||||
tabbedPane.setTabComponentAt( 1, new JButton( tabbedPane1.getTitleAt( 1 ) ) );
|
int tabCount = tabbedPane.getTabCount();
|
||||||
tabbedPane.setTabComponentAt( 3, createCustomTab( tabbedPane1.getTitleAt( 3 ) ) );
|
if( tabCount >= 2 )
|
||||||
} else {
|
tabbedPane.setTabComponentAt( 1, customTabs ? new JButton( tabbedPane.getTitleAt( 1 ) ) : null );
|
||||||
tabbedPane.setTabComponentAt( 1, null );
|
if( tabCount >= 4 )
|
||||||
tabbedPane.setTabComponentAt( 3, null );
|
tabbedPane.setTabComponentAt( 3, customTabs ? createCustomTab( tabbedPane.getTitleAt( 3 ) ) : null );
|
||||||
}
|
if( tabCount >= 6 )
|
||||||
|
tabbedPane.setTabComponentAt( 5, customTabs ? new JCheckBox( tabbedPane.getTitleAt( 5 ) ) : null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component createCustomTab( String tabTitle ) {
|
private Component createCustomTab( String tabTitle ) {
|
||||||
@@ -268,7 +265,7 @@ public class FlatContainerTest
|
|||||||
if( enabled ) {
|
if( enabled ) {
|
||||||
c = new JLabel( text );
|
c = new JLabel( text );
|
||||||
c.setOpaque( true );
|
c.setOpaque( true );
|
||||||
c.setBackground( Color.cyan );
|
c.setBackground( key.equals( TABBED_PANE_LEADING_COMPONENT ) ? Color.cyan : Color.orange );
|
||||||
c.setBorder( new EmptyBorder( gap, gap, gap, gap ) );
|
c.setBorder( new EmptyBorder( gap, gap, gap, gap ) );
|
||||||
}
|
}
|
||||||
tabbedPane.putClientProperty( key, c );
|
tabbedPane.putClientProperty( key, c );
|
||||||
@@ -339,9 +336,9 @@ public class FlatContainerTest
|
|||||||
tabbedPane3 = new JTabbedPane();
|
tabbedPane3 = new JTabbedPane();
|
||||||
tabbedPane2 = new JTabbedPane();
|
tabbedPane2 = new JTabbedPane();
|
||||||
tabbedPane4 = new JTabbedPane();
|
tabbedPane4 = new JTabbedPane();
|
||||||
JPanel panel14 = new JPanel();
|
FlatTestFrame.NoRightToLeftPanel tabbedPaneControlPanel = new FlatTestFrame.NoRightToLeftPanel();
|
||||||
moreTabsCheckBox = new JCheckBox();
|
JLabel tabCountLabel = new JLabel();
|
||||||
moreTabsSpinner = new JSpinner();
|
tabCountSpinner = new JSpinner();
|
||||||
tabScrollCheckBox = new JCheckBox();
|
tabScrollCheckBox = new JCheckBox();
|
||||||
showTabSeparatorsCheckBox = new JCheckBox();
|
showTabSeparatorsCheckBox = new JCheckBox();
|
||||||
hideContentSeparatorCheckBox = new JCheckBox();
|
hideContentSeparatorCheckBox = new JCheckBox();
|
||||||
@@ -461,10 +458,10 @@ public class FlatContainerTest
|
|||||||
}
|
}
|
||||||
panel9.add(tabbedPane4, cc.xy(3, 9));
|
panel9.add(tabbedPane4, cc.xy(3, 9));
|
||||||
|
|
||||||
//======== panel14 ========
|
//======== tabbedPaneControlPanel ========
|
||||||
{
|
{
|
||||||
panel14.setOpaque(false);
|
tabbedPaneControlPanel.setOpaque(false);
|
||||||
panel14.setLayout(new MigLayout(
|
tabbedPaneControlPanel.setLayout(new MigLayout(
|
||||||
"insets 0,hidemode 3",
|
"insets 0,hidemode 3",
|
||||||
// columns
|
// columns
|
||||||
"[]" +
|
"[]" +
|
||||||
@@ -479,63 +476,60 @@ public class FlatContainerTest
|
|||||||
"[]" +
|
"[]" +
|
||||||
"[]"));
|
"[]"));
|
||||||
|
|
||||||
//---- moreTabsCheckBox ----
|
//---- tabCountLabel ----
|
||||||
moreTabsCheckBox.setText("More tabs");
|
tabCountLabel.setText("Tab count:");
|
||||||
moreTabsCheckBox.setMnemonic('M');
|
tabbedPaneControlPanel.add(tabCountLabel, "cell 0 0");
|
||||||
moreTabsCheckBox.addActionListener(e -> moreTabsChanged());
|
|
||||||
panel14.add(moreTabsCheckBox, "cell 0 0");
|
|
||||||
|
|
||||||
//---- moreTabsSpinner ----
|
//---- tabCountSpinner ----
|
||||||
moreTabsSpinner.setModel(new SpinnerNumberModel(4, 0, null, 1));
|
tabCountSpinner.setModel(new SpinnerNumberModel(4, 0, null, 1));
|
||||||
moreTabsSpinner.setEnabled(false);
|
tabCountSpinner.addChangeListener(e -> tabCountChanged());
|
||||||
moreTabsSpinner.addChangeListener(e -> moreTabsSpinnerChanged());
|
tabbedPaneControlPanel.add(tabCountSpinner, "cell 1 0");
|
||||||
panel14.add(moreTabsSpinner, "cell 1 0");
|
|
||||||
|
|
||||||
//---- tabScrollCheckBox ----
|
//---- tabScrollCheckBox ----
|
||||||
tabScrollCheckBox.setText("Use scroll layout");
|
tabScrollCheckBox.setText("Use scroll layout");
|
||||||
tabScrollCheckBox.setMnemonic('S');
|
tabScrollCheckBox.setMnemonic('S');
|
||||||
tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
|
tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
|
||||||
panel14.add(tabScrollCheckBox, "cell 2 0,alignx left,growx 0");
|
tabbedPaneControlPanel.add(tabScrollCheckBox, "cell 2 0,alignx left,growx 0");
|
||||||
|
|
||||||
//---- showTabSeparatorsCheckBox ----
|
//---- showTabSeparatorsCheckBox ----
|
||||||
showTabSeparatorsCheckBox.setText("Show tab separators");
|
showTabSeparatorsCheckBox.setText("Show tab separators");
|
||||||
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
|
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
|
||||||
panel14.add(showTabSeparatorsCheckBox, "cell 3 0");
|
tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 3 0");
|
||||||
|
|
||||||
//---- hideContentSeparatorCheckBox ----
|
//---- hideContentSeparatorCheckBox ----
|
||||||
hideContentSeparatorCheckBox.setText("Hide content separator");
|
hideContentSeparatorCheckBox.setText("Hide content separator");
|
||||||
hideContentSeparatorCheckBox.addActionListener(e -> hideContentSeparatorChanged());
|
hideContentSeparatorCheckBox.addActionListener(e -> hideContentSeparatorChanged());
|
||||||
panel14.add(hideContentSeparatorCheckBox, "cell 4 0");
|
tabbedPaneControlPanel.add(hideContentSeparatorCheckBox, "cell 4 0");
|
||||||
|
|
||||||
//---- tabIconsCheckBox ----
|
//---- tabIconsCheckBox ----
|
||||||
tabIconsCheckBox.setText("Tab icons");
|
tabIconsCheckBox.setText("Tab icons");
|
||||||
tabIconsCheckBox.addActionListener(e -> tabIconsChanged());
|
tabIconsCheckBox.addActionListener(e -> tabIconsChanged());
|
||||||
panel14.add(tabIconsCheckBox, "cell 0 1");
|
tabbedPaneControlPanel.add(tabIconsCheckBox, "cell 0 1");
|
||||||
|
|
||||||
//---- tabIconSizeSpinner ----
|
//---- tabIconSizeSpinner ----
|
||||||
tabIconSizeSpinner.setModel(new SpinnerListModel(new String[] {"16", "24", "32", "48", "64"}));
|
tabIconSizeSpinner.setModel(new SpinnerListModel(new String[] {"16", "24", "32", "48", "64"}));
|
||||||
tabIconSizeSpinner.setEnabled(false);
|
tabIconSizeSpinner.setEnabled(false);
|
||||||
tabIconSizeSpinner.addChangeListener(e -> tabIconsChanged());
|
tabIconSizeSpinner.addChangeListener(e -> tabIconsChanged());
|
||||||
panel14.add(tabIconSizeSpinner, "cell 1 1");
|
tabbedPaneControlPanel.add(tabIconSizeSpinner, "cell 1 1");
|
||||||
|
|
||||||
//---- customBorderCheckBox ----
|
//---- customBorderCheckBox ----
|
||||||
customBorderCheckBox.setText("Custom border");
|
customBorderCheckBox.setText("Custom border");
|
||||||
customBorderCheckBox.addActionListener(e -> customBorderChanged());
|
customBorderCheckBox.addActionListener(e -> customBorderChanged());
|
||||||
panel14.add(customBorderCheckBox, "cell 2 1");
|
tabbedPaneControlPanel.add(customBorderCheckBox, "cell 2 1");
|
||||||
|
|
||||||
//---- customTabsCheckBox ----
|
//---- customTabsCheckBox ----
|
||||||
customTabsCheckBox.setText("Custom tabs");
|
customTabsCheckBox.setText("Custom tabs");
|
||||||
customTabsCheckBox.addActionListener(e -> customTabsChanged());
|
customTabsCheckBox.addActionListener(e -> customTabsChanged());
|
||||||
panel14.add(customTabsCheckBox, "cell 3 1");
|
tabbedPaneControlPanel.add(customTabsCheckBox, "cell 3 1");
|
||||||
|
|
||||||
//---- hasFullBorderCheckBox ----
|
//---- hasFullBorderCheckBox ----
|
||||||
hasFullBorderCheckBox.setText("Show content border");
|
hasFullBorderCheckBox.setText("Show content border");
|
||||||
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
|
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
|
||||||
panel14.add(hasFullBorderCheckBox, "cell 4 1,alignx left,growx 0");
|
tabbedPaneControlPanel.add(hasFullBorderCheckBox, "cell 4 1,alignx left,growx 0");
|
||||||
|
|
||||||
//---- tabPlacementLabel ----
|
//---- tabPlacementLabel ----
|
||||||
tabPlacementLabel.setText("Tab placement:");
|
tabPlacementLabel.setText("Tab placement:");
|
||||||
panel14.add(tabPlacementLabel, "cell 0 2");
|
tabbedPaneControlPanel.add(tabPlacementLabel, "cell 0 2");
|
||||||
|
|
||||||
//---- tabPlacementField ----
|
//---- tabPlacementField ----
|
||||||
tabPlacementField.setModel(new DefaultComboBoxModel<>(new String[] {
|
tabPlacementField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||||
@@ -546,11 +540,11 @@ public class FlatContainerTest
|
|||||||
"right"
|
"right"
|
||||||
}));
|
}));
|
||||||
tabPlacementField.addActionListener(e -> tabPlacementChanged());
|
tabPlacementField.addActionListener(e -> tabPlacementChanged());
|
||||||
panel14.add(tabPlacementField, "cell 1 2");
|
tabbedPaneControlPanel.add(tabPlacementField, "cell 1 2");
|
||||||
|
|
||||||
//---- hiddenTabsNavigationLabel ----
|
//---- hiddenTabsNavigationLabel ----
|
||||||
hiddenTabsNavigationLabel.setText("Hidden tabs navigation:");
|
hiddenTabsNavigationLabel.setText("Hidden tabs navigation:");
|
||||||
panel14.add(hiddenTabsNavigationLabel, "cell 2 2");
|
tabbedPaneControlPanel.add(hiddenTabsNavigationLabel, "cell 2 2");
|
||||||
|
|
||||||
//---- hiddenTabsNavigationField ----
|
//---- hiddenTabsNavigationField ----
|
||||||
hiddenTabsNavigationField.setModel(new DefaultComboBoxModel<>(new String[] {
|
hiddenTabsNavigationField.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||||
@@ -559,49 +553,49 @@ public class FlatContainerTest
|
|||||||
"arrowButtons"
|
"arrowButtons"
|
||||||
}));
|
}));
|
||||||
hiddenTabsNavigationField.addActionListener(e -> hiddenTabsNavigationChanged());
|
hiddenTabsNavigationField.addActionListener(e -> hiddenTabsNavigationChanged());
|
||||||
panel14.add(hiddenTabsNavigationField, "cell 3 2");
|
tabbedPaneControlPanel.add(hiddenTabsNavigationField, "cell 3 2");
|
||||||
|
|
||||||
//---- tabBackForegroundCheckBox ----
|
//---- tabBackForegroundCheckBox ----
|
||||||
tabBackForegroundCheckBox.setText("Tab back/foreground");
|
tabBackForegroundCheckBox.setText("Tab back/foreground");
|
||||||
tabBackForegroundCheckBox.addActionListener(e -> tabBackForegroundChanged());
|
tabBackForegroundCheckBox.addActionListener(e -> tabBackForegroundChanged());
|
||||||
panel14.add(tabBackForegroundCheckBox, "cell 4 2");
|
tabbedPaneControlPanel.add(tabBackForegroundCheckBox, "cell 4 2");
|
||||||
|
|
||||||
//---- leadingComponentCheckBox ----
|
//---- leadingComponentCheckBox ----
|
||||||
leadingComponentCheckBox.setText("Leading");
|
leadingComponentCheckBox.setText("Leading");
|
||||||
leadingComponentCheckBox.addActionListener(e -> leadingComponentChanged());
|
leadingComponentCheckBox.addActionListener(e -> leadingComponentChanged());
|
||||||
panel14.add(leadingComponentCheckBox, "cell 0 3");
|
tabbedPaneControlPanel.add(leadingComponentCheckBox, "cell 0 3");
|
||||||
|
|
||||||
//---- trailingComponentCheckBox ----
|
//---- trailingComponentCheckBox ----
|
||||||
trailingComponentCheckBox.setText("Trailing");
|
trailingComponentCheckBox.setText("Trailing");
|
||||||
trailingComponentCheckBox.addActionListener(e -> trailingComponentChanged());
|
trailingComponentCheckBox.addActionListener(e -> trailingComponentChanged());
|
||||||
panel14.add(trailingComponentCheckBox, "cell 1 3");
|
tabbedPaneControlPanel.add(trailingComponentCheckBox, "cell 1 3");
|
||||||
|
|
||||||
//---- tabsClosableCheckBox ----
|
//---- tabsClosableCheckBox ----
|
||||||
tabsClosableCheckBox.setText("Tabs closable");
|
tabsClosableCheckBox.setText("Tabs closable");
|
||||||
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
|
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
|
||||||
panel14.add(tabsClosableCheckBox, "cell 2 3");
|
tabbedPaneControlPanel.add(tabsClosableCheckBox, "cell 2 3");
|
||||||
|
|
||||||
//---- secondTabClosableCheckBox ----
|
//---- secondTabClosableCheckBox ----
|
||||||
secondTabClosableCheckBox.setText("Second Tab closable");
|
secondTabClosableCheckBox.setText("Second Tab closable");
|
||||||
secondTabClosableCheckBox.addActionListener(e -> secondTabClosableChanged());
|
secondTabClosableCheckBox.addActionListener(e -> secondTabClosableChanged());
|
||||||
panel14.add(secondTabClosableCheckBox, "cell 3 3");
|
tabbedPaneControlPanel.add(secondTabClosableCheckBox, "cell 3 3");
|
||||||
|
|
||||||
//---- smallerTabHeightCheckBox ----
|
//---- smallerTabHeightCheckBox ----
|
||||||
smallerTabHeightCheckBox.setText("Smaller tab height");
|
smallerTabHeightCheckBox.setText("Smaller tab height (26)");
|
||||||
smallerTabHeightCheckBox.addActionListener(e -> smallerTabHeightChanged());
|
smallerTabHeightCheckBox.addActionListener(e -> smallerTabHeightChanged());
|
||||||
panel14.add(smallerTabHeightCheckBox, "cell 0 4 2 1");
|
tabbedPaneControlPanel.add(smallerTabHeightCheckBox, "cell 0 4 2 1");
|
||||||
|
|
||||||
//---- smallerInsetsCheckBox ----
|
//---- smallerInsetsCheckBox ----
|
||||||
smallerInsetsCheckBox.setText("Smaller insets");
|
smallerInsetsCheckBox.setText("Smaller insets (2,2,2,2)");
|
||||||
smallerInsetsCheckBox.addActionListener(e -> smallerInsetsChanged());
|
smallerInsetsCheckBox.addActionListener(e -> smallerInsetsChanged());
|
||||||
panel14.add(smallerInsetsCheckBox, "cell 2 4");
|
tabbedPaneControlPanel.add(smallerInsetsCheckBox, "cell 2 4");
|
||||||
|
|
||||||
//---- secondTabWiderCheckBox ----
|
//---- secondTabWiderCheckBox ----
|
||||||
secondTabWiderCheckBox.setText("Second Tab wider");
|
secondTabWiderCheckBox.setText("Second Tab wider (4,20,4,20)");
|
||||||
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged());
|
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged());
|
||||||
panel14.add(secondTabWiderCheckBox, "cell 3 4");
|
tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 3 4 2 1");
|
||||||
}
|
}
|
||||||
panel9.add(panel14, cc.xywh(1, 11, 3, 1));
|
panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1));
|
||||||
}
|
}
|
||||||
add(panel9, "cell 0 0");
|
add(panel9, "cell 0 0");
|
||||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
@@ -612,8 +606,7 @@ public class FlatContainerTest
|
|||||||
private JTabbedPane tabbedPane3;
|
private JTabbedPane tabbedPane3;
|
||||||
private JTabbedPane tabbedPane2;
|
private JTabbedPane tabbedPane2;
|
||||||
private JTabbedPane tabbedPane4;
|
private JTabbedPane tabbedPane4;
|
||||||
private JCheckBox moreTabsCheckBox;
|
private JSpinner tabCountSpinner;
|
||||||
private JSpinner moreTabsSpinner;
|
|
||||||
private JCheckBox tabScrollCheckBox;
|
private JCheckBox tabScrollCheckBox;
|
||||||
private JCheckBox showTabSeparatorsCheckBox;
|
private JCheckBox showTabSeparatorsCheckBox;
|
||||||
private JCheckBox hideContentSeparatorCheckBox;
|
private JCheckBox hideContentSeparatorCheckBox;
|
||||||
|
|||||||
@@ -129,35 +129,29 @@ new FormModel {
|
|||||||
"gridX": 3
|
"gridX": 3
|
||||||
"gridY": 9
|
"gridY": 9
|
||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestFrame$NoRightToLeftPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "insets 0,hidemode 3"
|
"$layoutConstraints": "insets 0,hidemode 3"
|
||||||
"$columnConstraints": "[][fill][][][fill]"
|
"$columnConstraints": "[][fill][][][fill]"
|
||||||
"$rowConstraints": "[center][][][][]"
|
"$rowConstraints": "[center][][][][]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "panel14"
|
name: "tabbedPaneControlPanel"
|
||||||
"opaque": false
|
"opaque": false
|
||||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "moreTabsCheckBox"
|
name: "tabCountLabel"
|
||||||
"text": "More tabs"
|
"text": "Tab count:"
|
||||||
"mnemonic": 77
|
|
||||||
auxiliary() {
|
|
||||||
"JavaCodeGenerator.variableLocal": false
|
|
||||||
}
|
|
||||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "moreTabsChanged", false ) )
|
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 0"
|
"value": "cell 0 0"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||||
name: "moreTabsSpinner"
|
name: "tabCountSpinner"
|
||||||
"model": new javax.swing.SpinnerNumberModel {
|
"model": new javax.swing.SpinnerNumberModel {
|
||||||
minimum: 0
|
minimum: 0
|
||||||
value: 4
|
value: 4
|
||||||
}
|
}
|
||||||
"enabled": false
|
|
||||||
auxiliary() {
|
auxiliary() {
|
||||||
"JavaCodeGenerator.variableLocal": false
|
"JavaCodeGenerator.variableLocal": false
|
||||||
}
|
}
|
||||||
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "moreTabsSpinnerChanged", false ) )
|
addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "tabCountChanged", false ) )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 0"
|
"value": "cell 1 0"
|
||||||
} )
|
} )
|
||||||
@@ -349,7 +343,7 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
name: "smallerTabHeightCheckBox"
|
name: "smallerTabHeightCheckBox"
|
||||||
"text": "Smaller tab height"
|
"text": "Smaller tab height (26)"
|
||||||
auxiliary() {
|
auxiliary() {
|
||||||
"JavaCodeGenerator.variableLocal": false
|
"JavaCodeGenerator.variableLocal": false
|
||||||
}
|
}
|
||||||
@@ -359,7 +353,7 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
name: "smallerInsetsCheckBox"
|
name: "smallerInsetsCheckBox"
|
||||||
"text": "Smaller insets"
|
"text": "Smaller insets (2,2,2,2)"
|
||||||
auxiliary() {
|
auxiliary() {
|
||||||
"JavaCodeGenerator.variableLocal": false
|
"JavaCodeGenerator.variableLocal": false
|
||||||
}
|
}
|
||||||
@@ -369,13 +363,13 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
name: "secondTabWiderCheckBox"
|
name: "secondTabWiderCheckBox"
|
||||||
"text": "Second Tab wider"
|
"text": "Second Tab wider (4,20,4,20)"
|
||||||
auxiliary() {
|
auxiliary() {
|
||||||
"JavaCodeGenerator.variableLocal": false
|
"JavaCodeGenerator.variableLocal": false
|
||||||
}
|
}
|
||||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabWiderChanged", false ) )
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabWiderChanged", false ) )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 3 4"
|
"value": "cell 3 4 2 1"
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||||
"gridY": 11
|
"gridY": 11
|
||||||
@@ -386,7 +380,7 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
"size": new java.awt.Dimension( 810, 570 )
|
"size": new java.awt.Dimension( 810, 655 )
|
||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "hidemode 3,align center center"
|
"$layoutConstraints": "hidemode 3,align center center"
|
||||||
@@ -416,7 +410,7 @@ new FormModel {
|
|||||||
"value": "cell 2 0"
|
"value": "cell 2 0"
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 595 )
|
"location": new java.awt.Point( 0, 680 )
|
||||||
"size": new java.awt.Dimension( 291, 118 )
|
"size": new java.awt.Dimension( 291, 118 )
|
||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
@@ -441,7 +435,7 @@ new FormModel {
|
|||||||
"value": "cell 1 0"
|
"value": "cell 1 0"
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 340, 595 )
|
"location": new java.awt.Point( 340, 680 )
|
||||||
"size": new java.awt.Dimension( 291, 118 )
|
"size": new java.awt.Dimension( 291, 118 )
|
||||||
} )
|
} )
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -788,4 +788,18 @@ public class FlatTestFrame
|
|||||||
private JButton closeButton;
|
private JButton closeButton;
|
||||||
private IJThemesPanel themesPanel;
|
private IJThemesPanel themesPanel;
|
||||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||||
|
|
||||||
|
//---- class NoRightToLeftPanel -------------------------------------------
|
||||||
|
|
||||||
|
public static class NoRightToLeftPanel
|
||||||
|
extends JPanel
|
||||||
|
{
|
||||||
|
public NoRightToLeftPanel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyComponentOrientation( ComponentOrientation o ) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user