@ -28,6 +28,8 @@ import java.awt.Component;
import java.awt.Dimension ;
import java.awt.GridLayout ;
import java.awt.Insets ;
import java.awt.event.AdjustmentEvent ;
import java.awt.event.AdjustmentListener ;
import java.util.List ;
import static com.fine.swing.ui.layout.Layouts.cell ;
@ -50,6 +52,8 @@ public class UITableEditorPane<T> extends BasicPane {
protected UITableModelAdapter < T > tableModel ;
private String leftLabelName ;
private JPanel buttonPane ;
protected JScrollPane scrollPane ;
protected JPanel verticalScrollBar ;
public UITableEditorPane ( UITableModelAdapter < T > model ) {
this . tableModel = model ;
@ -99,18 +103,25 @@ public class UITableEditorPane<T> extends BasicPane {
* @param scrollPane
* @return
* /
protected Component buildScrollTablePane ( JScrollPane scrollPane ) {
return row (
cell ( scrollPane ) . weight ( 1 ) ,
column (
cell ( new UILabel ( ) ) . with ( it - > {
it . setBorder ( BorderFactory . createMatteBorder ( 1 , 0 , 0 , 1 , UIManager . getColor ( "defaultBorderColor" ) ) ) ;
it . setPreferredSize ( FineUIScale . scale ( new Dimension ( scrollPane . getVerticalScrollBar ( ) . getWidth ( ) , ( int ) editTable . getTableHeader ( ) . getPreferredSize ( ) . getHeight ( ) ) ) ) ;
} ) ,
cell ( scrollPane . getVerticalScrollBar ( ) ) . weight ( 1 ) . with ( it - > {
it . setBorder ( BorderFactory . createMatteBorder ( 1 , 0 , 1 , 1 , UIManager . getColor ( "defaultBorderColor" ) ) ) ;
} ) )
protected JPanel buildScrollTablePane ( JScrollPane scrollPane ) {
verticalScrollBar = column (
cell ( new UILabel ( ) ) . with ( it - > {
it . setBorder ( BorderFactory . createMatteBorder ( 1 , 0 , 0 , 1 , UIManager . getColor ( "defaultBorderColor" ) ) ) ;
it . setPreferredSize ( new Dimension ( scrollPane . getVerticalScrollBar ( ) . getWidth ( ) , ( int ) editTable . getTableHeader ( ) . getPreferredSize ( ) . getHeight ( ) ) ) ;
} ) ,
cell ( scrollPane . getVerticalScrollBar ( ) ) . weight ( 1 ) . with ( it - > {
it . setBorder ( BorderFactory . createMatteBorder ( 1 , 0 , 1 , 1 , UIManager . getColor ( "defaultBorderColor" ) ) ) ;
} )
) . getComponent ( ) ;
scrollPane . getVerticalScrollBar ( ) . addAdjustmentListener ( new AdjustmentListener ( ) {
@Override
public void adjustmentValueChanged ( AdjustmentEvent e ) {
verticalScrollBar . setVisible ( editTable . getHeight ( ) > scrollPane . getViewport ( ) . getHeight ( ) ) ;
verticalScrollBar . repaint ( ) ;
}
} ) ;
return row ( cell ( scrollPane ) . weight ( 1 ) , cell ( verticalScrollBar ) ) . getComponent ( ) ;
}
public UITableModelAdapter < T > getTableModel ( ) {