Browse Source

REPORT-127437 fix:setui 调整

newui
lemon 4 months ago
parent
commit
8013627bcc
  1. 27
      designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java
  2. 1
      designer-base/src/main/java/com/fr/design/gui/icontainer/UITableScrollPane.java
  3. 11
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIVerticalScrollBar.java

27
designer-base/src/main/java/com/fine/theme/light/ui/FineTableScrollBarPaneUI.java

@ -1,9 +1,11 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatScrollBarUI;
import com.fr.design.gui.iscrollbar.UIVerticalScrollBar;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.plaf.ComponentUI;
import java.awt.Graphics;
import java.awt.Rectangle;
@ -16,12 +18,20 @@ import java.awt.Rectangle;
*/
public class FineTableScrollBarPaneUI extends FlatScrollBarUI {
private final JTable table;
public FineTableScrollBarPaneUI() {
}
public FineTableScrollBarPaneUI(JTable table) {
this.table = table;
/**
* 创建UI
*
* @param c 组件
* @return ComponentUI
*/
public static ComponentUI createUI(JComponent c) {
return new FineTableScrollBarPaneUI();
}
@Override
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
super.paintTrack(g, c, trackBounds);
@ -29,10 +39,13 @@ public class FineTableScrollBarPaneUI extends FlatScrollBarUI {
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
// 确保滚动条滑块不会超过表头区域
Rectangle headerRect = table.getTableHeader().getBounds();
int headerHeight = headerRect.height;
thumbBounds.y = Math.max(thumbBounds.y, headerHeight);
if (c instanceof UIVerticalScrollBar) {
// 确保滚动条滑块不会超过表头区域
JTable table = ((UIVerticalScrollBar) c).getTable();
Rectangle headerRect = table.getTableHeader().getBounds();
int headerHeight = headerRect.height;
thumbBounds.y = Math.max(thumbBounds.y, headerHeight);
}
super.paintThumb(g, c, thumbBounds);
}

1
designer-base/src/main/java/com/fr/design/gui/icontainer/UITableScrollPane.java

@ -1,7 +1,6 @@
package com.fr.design.gui.icontainer;
import com.fr.design.gui.iscrollbar.UIVerticalScrollBar;
import com.fr.design.gui.itable.FineUITable;
import javax.swing.JScrollBar;
import javax.swing.JTable;

11
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIVerticalScrollBar.java

@ -1,7 +1,5 @@
package com.fr.design.gui.iscrollbar;
import com.fine.theme.light.ui.FineTableScrollBarPaneUI;
import javax.swing.JTable;
/**
@ -15,16 +13,19 @@ public class UIVerticalScrollBar extends UIScrollBar {
private static final String UI_CLASS_ID = "TableVerticalBarUI";
private static final long serialVersionUID = 1L;
public UIVerticalScrollBar() {
}
public JTable table;
public UIVerticalScrollBar(JTable table, int orientation) {
super(orientation);
this.setUI(new FineTableScrollBarPaneUI(table));
this.table = table;
}
public String getUIClassID() {
return UI_CLASS_ID;
}
public JTable getTable() {
return this.table;
}
}

Loading…
Cancel
Save