mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
Table: fixed missing upper right corner (e.g. in SwingX JXTable with column control visible)
This commit is contained in:
@@ -12,6 +12,8 @@ FlatLaf Change Log
|
|||||||
#17)
|
#17)
|
||||||
- Button: Hover and pressed background colors are now derived from actual button
|
- Button: Hover and pressed background colors are now derived from actual button
|
||||||
background color. (issue #21)
|
background color. (issue #21)
|
||||||
|
- Table: Fixed missing upper right corner (e.g. in SwingX JXTable with column
|
||||||
|
control visible).
|
||||||
|
|
||||||
|
|
||||||
## 0.16
|
## 0.16
|
||||||
|
|||||||
@@ -17,10 +17,8 @@
|
|||||||
package com.formdev.flatlaf.ui;
|
package com.formdev.flatlaf.ui;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Container;
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.awt.event.ContainerEvent;
|
import java.awt.event.ContainerEvent;
|
||||||
import java.awt.event.ContainerListener;
|
import java.awt.event.ContainerListener;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
@@ -30,10 +28,8 @@ import javax.swing.JComponent;
|
|||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JViewport;
|
import javax.swing.JViewport;
|
||||||
import javax.swing.LookAndFeel;
|
import javax.swing.LookAndFeel;
|
||||||
import javax.swing.ScrollPaneLayout;
|
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.UIResource;
|
|
||||||
import javax.swing.plaf.basic.BasicScrollPaneUI;
|
import javax.swing.plaf.basic.BasicScrollPaneUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,9 +50,6 @@ public class FlatScrollPaneUI
|
|||||||
public void installUI( JComponent c ) {
|
public void installUI( JComponent c ) {
|
||||||
super.installUI( c );
|
super.installUI( c );
|
||||||
|
|
||||||
if( scrollpane.getLayout() instanceof UIResource )
|
|
||||||
scrollpane.setLayout( new FlatScrollPaneLayout() );
|
|
||||||
|
|
||||||
int focusWidth = UIManager.getInt( "Component.focusWidth" );
|
int focusWidth = UIManager.getInt( "Component.focusWidth" );
|
||||||
LookAndFeel.installProperty( c, "opaque", focusWidth == 0 );
|
LookAndFeel.installProperty( c, "opaque", focusWidth == 0 );
|
||||||
|
|
||||||
@@ -65,9 +58,6 @@ public class FlatScrollPaneUI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void uninstallUI( JComponent c ) {
|
public void uninstallUI( JComponent c ) {
|
||||||
if( scrollpane.getLayout() instanceof FlatScrollPaneLayout )
|
|
||||||
scrollpane.setLayout( new ScrollPaneLayout.UIResource() );
|
|
||||||
|
|
||||||
MigLayoutVisualPadding.uninstall( scrollpane );
|
MigLayoutVisualPadding.uninstall( scrollpane );
|
||||||
|
|
||||||
super.uninstallUI( c );
|
super.uninstallUI( c );
|
||||||
@@ -173,27 +163,4 @@ public class FlatScrollPaneUI
|
|||||||
scrollpane.repaint();
|
scrollpane.repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- class FlatScrollPaneLayout -----------------------------------------
|
|
||||||
|
|
||||||
private static class FlatScrollPaneLayout
|
|
||||||
extends ScrollPaneLayout
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void layoutContainer( Container parent ) {
|
|
||||||
super.layoutContainer( parent );
|
|
||||||
|
|
||||||
// increase height of vertical scroll bar so that it also fills the upper right corner
|
|
||||||
if( colHead != null && vsb != null && colHead.isVisible() && vsb.isVisible() ) {
|
|
||||||
Rectangle colHeadBounds = colHead.getBounds();
|
|
||||||
Rectangle vsbBounds = vsb.getBounds();
|
|
||||||
|
|
||||||
if( vsbBounds.y > colHeadBounds.y ) {
|
|
||||||
vsbBounds.height += (vsbBounds.y - colHeadBounds.y);
|
|
||||||
vsbBounds.y = colHeadBounds.y;
|
|
||||||
vsb.setBounds( vsbBounds );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,6 +278,7 @@ ScrollBar.width=10
|
|||||||
|
|
||||||
ScrollPane.border=com.formdev.flatlaf.ui.FlatBorder
|
ScrollPane.border=com.formdev.flatlaf.ui.FlatBorder
|
||||||
ScrollPane.background=@@ScrollBar.track
|
ScrollPane.background=@@ScrollBar.track
|
||||||
|
ScrollPane.fillUpperCorner=true
|
||||||
|
|
||||||
|
|
||||||
#---- Separator ----
|
#---- Separator ----
|
||||||
|
|||||||
Reference in New Issue
Block a user