From 1111fa17002835d30b076bf81002ee6ecc6ee8b6 Mon Sep 17 00:00:00 2001 From: renekton Date: Tue, 22 Oct 2024 17:55:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=B8=8D=E8=83=BD=E9=80=89=E4=B8=AD=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/light/ui/FineTableHeaderUI.java | 6 +++++- .../design/write/submit/DBManipulationPane.java | 16 +++++++++++++++- .../submit/SmartInsertDBManipulationPane.java | 10 ++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java index 89a5e738ab..c5a9244561 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java @@ -84,6 +84,10 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { setHorizontalAlignment(SwingConstants.LEFT); } + public boolean checkSelected(boolean isSelected, Class columnClass) { + return isSelected && columnClass != Boolean.class; + } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Class columnClass = table.getColumnClass(0); @@ -95,7 +99,7 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { border = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor")), UIManager.getBorder("Table.cellNoFocusBorder")); } - if (isSelected && columnClass != Boolean.class) { + if (checkSelected(isSelected, columnClass)) { selectionBackground = UIManager.getColor( "Table.selectionBackground"); } else { selectionBackground = UIManager.getColor("Table.background"); diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index ed477aab2c..17849321fd 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -1220,6 +1220,11 @@ public class DBManipulationPane extends BasicBeanPane { return this; } + + @Override + public boolean checkSelected(boolean isSelected, Class columnClass) { + return isSelected; + } } /* @@ -1245,6 +1250,11 @@ public class DBManipulationPane extends BasicBeanPane { return this; } + + @Override + public boolean checkSelected(boolean isSelected, Class columnClass) { + return isSelected; + } } /** @@ -1263,7 +1273,11 @@ public class DBManipulationPane extends BasicBeanPane { setSelected((value != null && ((Boolean) value).booleanValue())); setUI(getUICheckBoxUI()); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, UIManager.getColor("defaultBorderColor"))); - setBackground(Color.WHITE); + if (isSelected) { + setBackground(UIManager.getColor( "Table.selectionBackground")); + } else { + setBackground(UIManager.getColor("Table.background")); + } return this; } } diff --git a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java index 819b817796..7c2ded7244 100644 --- a/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java +++ b/designer-realize/src/main/java/com/fr/design/write/submit/SmartInsertDBManipulationPane.java @@ -580,6 +580,11 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { return this; } + + @Override + public boolean checkSelected(boolean isSelected, Class columnClass) { + return isSelected; + } } private class ColumnRowGroupCellRenderer2 extends FineTableHeaderUI.TableRenderer { @@ -613,6 +618,11 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane { return this; } + + @Override + public boolean checkSelected(boolean isSelected, Class columnClass) { + return isSelected; + } } } } From 28c9e9d3864f628048877bf9b5999082e9db6689 Mon Sep 17 00:00:00 2001 From: renekton Date: Tue, 22 Oct 2024 18:00:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fine/theme/light/ui/FineTableHeaderUI.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java index c5a9244561..da6a4c9c5e 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineTableHeaderUI.java @@ -84,6 +84,12 @@ public class FineTableHeaderUI extends FlatTableHeaderUI { setHorizontalAlignment(SwingConstants.LEFT); } + /** + * 是否选中修改背景 + * @param isSelected 被选中 + * @param columnClass 列类型 + * @return 是否修改 + */ public boolean checkSelected(boolean isSelected, Class columnClass) { return isSelected && columnClass != Boolean.class; }