mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-15 00:07:12 -06:00
Table: ascendingSortIcon and descendingSortIcon icons added
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 FormDev Software GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.formdev.flatlaf.icons;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.geom.Path2D;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "ascendingSort" icon for {@link javax.swing.table.JTableHeader}.
|
||||||
|
*
|
||||||
|
* @uiDefault Table.sortIconColor Color
|
||||||
|
*
|
||||||
|
* @author Karl Tauber
|
||||||
|
*/
|
||||||
|
public class FlatAscendingSortIcon
|
||||||
|
extends FlatAbstractIcon
|
||||||
|
{
|
||||||
|
protected final Color sortIconColor = UIManager.getColor( "Table.sortIconColor" );
|
||||||
|
|
||||||
|
public FlatAscendingSortIcon() {
|
||||||
|
super( 10, 5, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void paintIcon( Component c, Graphics2D g ) {
|
||||||
|
Path2D arrow = new Path2D.Float();
|
||||||
|
arrow.moveTo( 0.5, 5 );
|
||||||
|
arrow.lineTo( 9.5, 5 );
|
||||||
|
arrow.lineTo( 5, 0 );
|
||||||
|
arrow.closePath();
|
||||||
|
|
||||||
|
g.setColor( sortIconColor );
|
||||||
|
g.fill( arrow );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 FormDev Software GmbH
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.formdev.flatlaf.icons;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.geom.Path2D;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "descendingSort" icon for {@link javax.swing.table.JTableHeader}.
|
||||||
|
*
|
||||||
|
* @uiDefault Table.sortIconColor Color
|
||||||
|
*
|
||||||
|
* @author Karl Tauber
|
||||||
|
*/
|
||||||
|
public class FlatDescendingSortIcon
|
||||||
|
extends FlatAbstractIcon
|
||||||
|
{
|
||||||
|
protected final Color sortIconColor = UIManager.getColor( "Table.sortIconColor" );
|
||||||
|
|
||||||
|
public FlatDescendingSortIcon() {
|
||||||
|
super( 10, 5, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void paintIcon( Component c, Graphics2D g ) {
|
||||||
|
Path2D arrow = new Path2D.Float();
|
||||||
|
arrow.moveTo( 0.5, 0 );
|
||||||
|
arrow.lineTo( 9.5, 0 );
|
||||||
|
arrow.lineTo( 5, 5 );
|
||||||
|
arrow.closePath();
|
||||||
|
|
||||||
|
g.setColor( sortIconColor );
|
||||||
|
g.fill( arrow );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -216,6 +216,13 @@ TabbedPane.tabsOverlapBorder=true
|
|||||||
TabbedPane.shadow=@@ComboBox.buttonArrowColor
|
TabbedPane.shadow=@@ComboBox.buttonArrowColor
|
||||||
|
|
||||||
|
|
||||||
|
#---- Table ----
|
||||||
|
|
||||||
|
Table.ascendingSortIcon=com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
||||||
|
Table.descendingSortIcon=com.formdev.flatlaf.icons.FlatDescendingSortIcon
|
||||||
|
Table.sortIconColor=@icon
|
||||||
|
|
||||||
|
|
||||||
#---- TableHeader ----
|
#---- TableHeader ----
|
||||||
|
|
||||||
TableHeader.height=25
|
TableHeader.height=25
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ public class FlatComponents2Test
|
|||||||
"December"
|
"December"
|
||||||
}))));
|
}))));
|
||||||
}
|
}
|
||||||
|
table1.setAutoCreateRowSorter(true);
|
||||||
scrollPane5.setViewportView(table1);
|
scrollPane5.setViewportView(table1);
|
||||||
}
|
}
|
||||||
add(scrollPane5, "cell 1 4 2 1,growx,width 300");
|
add(scrollPane5, "cell 1 4 2 1,growx,width 300");
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ new FormModel {
|
|||||||
add( new com.jformdesigner.model.SwingTableColumn( new java.lang.Object[ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], 0, 0, 0, true ) )
|
add( new com.jformdesigner.model.SwingTableColumn( new java.lang.Object[ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], 0, 0, 0, true ) )
|
||||||
add( null )
|
add( null )
|
||||||
} )
|
} )
|
||||||
|
"autoCreateRowSorter": true
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 4 2 1,growx,width 300"
|
"value": "cell 1 4 2 1,growx,width 300"
|
||||||
|
|||||||
@@ -179,6 +179,11 @@ TabbedPane.focusColor=dddddd
|
|||||||
TabbedPane.contentAreaColor=bbbbbb
|
TabbedPane.contentAreaColor=bbbbbb
|
||||||
|
|
||||||
|
|
||||||
|
#---- Table ----
|
||||||
|
|
||||||
|
Table.sortIconColor=ffff00
|
||||||
|
|
||||||
|
|
||||||
#---- TableHeader ----
|
#---- TableHeader ----
|
||||||
|
|
||||||
TableHeader.background=4444ff
|
TableHeader.background=4444ff
|
||||||
|
|||||||
Reference in New Issue
Block a user