Browse Source

REPORT-65124 【模板主题】单元格样式编辑的效果有问题

【问题原因】
虽然ListCellRenderer中去除了icon,但是JNamedList实现还使用了icon的宽度来绘制内容,导致
渲染出来的编辑框有问题

【改动思路】
重新实现一个图表宽度为0的JNamedList
bugfix/11.0
Starryi 3 years ago
parent
commit
e1beb6c99d
  1. 15
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

15
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -30,9 +30,11 @@ import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.ListModel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
@ -101,7 +103,7 @@ public class CellStyleListEditPane extends JListControlPane {
@Override
protected JNameEdList createJNameList() {
JNameEdList nameEdList = super.createJNameList();
JNameEdList nameEdList = new NoIconNamedList(new DefaultListModel());
nameEdList.setCellEditor(new UnEditableListCellEditor(new UITextField()));
nameEdList.setCellRenderer(new NoIconNameableListCellRenderer());
return nameEdList;
@ -294,6 +296,17 @@ public class CellStyleListEditPane extends JListControlPane {
return component;
}
}
private class NoIconNamedList extends JNameEdList {
public NoIconNamedList(ListModel dataModel) {
super(dataModel);
}
@Override
public int getIconWidth() {
return 0;
}
}
private class UnEditableListCellEditor extends DefaultListCellEditor {
public UnEditableListCellEditor(UITextField textField) {

Loading…
Cancel
Save