Demo: "Tabs" tab: improved demo of leading and trailing tab area components by using toolbars

This commit is contained in:
Karl Tauber
2020-11-13 23:25:19 +01:00
parent c98ec041d4
commit afccdc4749
6 changed files with 40 additions and 13 deletions

View File

@@ -162,26 +162,28 @@ class TabsPanel
}
private void initCustomComponentsTabs( JTabbedPane tabbedPane ) {
addDefaultTabsNoContent( tabbedPane, 3 );
addDefaultTabsNoContent( tabbedPane, 2 );
customComponentsChanged();
}
private void customComponentsChanged() {
JComponent leading = null;
JComponent trailing = null;
JToolBar leading = null;
JToolBar trailing = null;
if( leadingComponentButton.isSelected() ) {
leading = new JLabel( "Leading" );
leading.setOpaque( true );
leading.setBackground( new Color( UIManager.getColor( "Objects.Green" ).getRGB() ) );
leading.setForeground( Color.black );
leading.setBorder( new EmptyBorder( 4, 4, 4, 4 ) );
leading = new JToolBar();
leading.setFloatable( false );
leading.setBorder( null );
leading.add( new JButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/project.svg" ) ) );
}
if( trailingComponentButton.isSelected() ) {
trailing = new JLabel( "Trailing" );
trailing.setOpaque( true );
trailing.setBackground( new Color( UIManager.getColor( "Objects.Purple" ).getRGB() ) );
trailing.setForeground( Color.black );
trailing.setBorder( new EmptyBorder( 4, 4, 4, 4 ) );
trailing = new JToolBar();
trailing.setFloatable( false );
trailing.setBorder( null );
trailing.add( new JButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/buildLoadChanges.svg" ) ) );
trailing.add( Box.createHorizontalGlue() );
trailing.add( new JButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/commit.svg" ) ) );
trailing.add( new JButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/diff.svg" ) ) );
trailing.add( new JButton( new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/listFiles.svg" ) ) );
}
customComponentsTabbedPane.putClientProperty( TABBED_PANE_LEADING_COMPONENT, leading );
customComponentsTabbedPane.putClientProperty( TABBED_PANE_TRAILING_COMPONENT, trailing );

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="#389FD6" fill-rule="evenodd" d="M14.0431479,8.44999981 L14.3048222,13.4430431 L12.574725,11.885269 C11.4741571,13.1817306 9.83248424,14.0044386 7.99865879,14.0044386 C5.03921121,14.0044386 2.58020312,11.8617896 2.08827651,9.04314243 L3.94798986,9.10858763 C4.43427312,10.8903005 6.0642585,12.2000519 8.00015362,12.2000519 C9.30169687,12.2000519 10.4649641,11.6080237 11.2353504,10.6785714 L9.05000019,8.71167959 L14.0431479,8.44999981 Z M7.99865879,2.00443857 C10.9184669,2.00443857 13.3511517,4.09007371 13.888219,6.85284133 L12.0226275,6.7880427 C11.5024638,5.05933714 9.89836709,3.8000774 8.00015362,3.8000774 C6.69883692,3.8000774 5.53574811,4.39189956 4.76535914,5.32107268 L6.95482203,7.29304326 L1.96167436,7.55472304 L1.70000005,2.56167973 L3.42768119,4.11762166 C4.52821742,2.82461451 6.1676575,2.00443857 7.99865879,2.00443857 Z" transform="rotate(3 8.002 8.004)"/>
</svg>

After

Width:  |  Height:  |  Size: 981 B

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<polygon fill="#59A869" points="13.789 2.09 15.535 3.837 6.292 13.08 1.95 8.738 3.698 6.99 6.293 9.585"/>
</svg>

After

Width:  |  Height:  |  Size: 199 B

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="#389FD6" fill-rule="evenodd" transform="translate(1)">
<path d="M10.9000003,4.89999992 L14.0999999,4.89999992 L9.9000001,9.09999973 L5.70000029,4.89999992 L8.90000027,4.89999992 L8.90000027,0.899999917 L10.9000003,0.899999917 L10.9000003,4.89999992 Z" transform="rotate(90 9.9 5)"/>
<path d="M5.0999999,10.9000001 L8.29999971,10.9000001 L4.0999999,15.0999999 L-0.0999999046,10.9000001 L3.0999999,10.9000001 L3.0999999,6.9000001 L5.0999999,6.9000001 L5.0999999,10.9000001 Z" transform="matrix(0 1 1 0 -6.9 6.9)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 630 B

View File

@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<rect width="12" height="2" x="2" y="3" fill="#6E6E6E"/>
<rect width="12" height="2" x="2" y="7" fill="#6E6E6E"/>
<rect width="12" height="2" x="2" y="11" fill="#6E6E6E"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 320 B

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<g fill="none" fill-rule="evenodd">
<path fill="#9AA7B0" fill-opacity=".8" d="M1,1 L15,1 L15,14 L1,14 L1,1 Z M2,4 L2,13 L14,13 L14,4 L2,4 Z"/>
<rect width="10" height="7" x="3" y="5" fill="#40B6E0" fill-opacity=".6"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 326 B