|
|
@ -9,6 +9,7 @@ import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.icontainer.UIScrollPane; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
|
|
|
import com.fr.design.gui.iscrollbar.UIScrollBar; |
|
|
|
import com.fr.design.gui.itextarea.DescriptionTextArea; |
|
|
|
import com.fr.design.gui.itextarea.DescriptionTextArea; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
@ -270,7 +271,7 @@ public class CustomIconPane extends BasicPane { |
|
|
|
// 不知道怎么动态布局,就这么傻傻的调一下大小
|
|
|
|
// 不知道怎么动态布局,就这么傻傻的调一下大小
|
|
|
|
private void refreshIconPane(boolean down) { |
|
|
|
private void refreshIconPane(boolean down) { |
|
|
|
iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP)); |
|
|
|
iconPane.setPreferredSize(new Dimension(THE_WIDTH, (iconButtonMap.size() / HORIZONTAL_COUNT + 1) * HEIGHT_PER + GAP)); |
|
|
|
JScrollBar jsBar = jsPane.createVerticalScrollBar(); |
|
|
|
UIScrollBar jsBar = jsPane.createVerticalScrollBar(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (down) { |
|
|
|
if (down) { |
|
|
|
// 将滚动条滚到最后
|
|
|
|
// 将滚动条滚到最后
|
|
|
@ -287,6 +288,8 @@ public class CustomIconPane extends BasicPane { |
|
|
|
private String iconName; |
|
|
|
private String iconName; |
|
|
|
private Image iconImage = null; |
|
|
|
private Image iconImage = null; |
|
|
|
private static final int ICON_BUTTON_SIZE = 24; |
|
|
|
private static final int ICON_BUTTON_SIZE = 24; |
|
|
|
|
|
|
|
private static final int ICON_X = 4; |
|
|
|
|
|
|
|
private static final int ICON_Y = 4; |
|
|
|
public IconButton(String name) { |
|
|
|
public IconButton(String name) { |
|
|
|
this.iconName = name; |
|
|
|
this.iconName = name; |
|
|
|
this.addActionListener(this); |
|
|
|
this.addActionListener(this); |
|
|
@ -311,7 +314,7 @@ public class CustomIconPane extends BasicPane { |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
// carl:这里缩放显示 16 × 16
|
|
|
|
// carl:这里缩放显示 16 × 16
|
|
|
|
if (iconImage != null) { |
|
|
|
if (iconImage != null) { |
|
|
|
g2d.drawImage(iconImage, 4, 4, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); |
|
|
|
g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.iconName != null && ComparatorUtils.equals(this.iconName, selectedIconName)) { |
|
|
|
if (this.iconName != null && ComparatorUtils.equals(this.iconName, selectedIconName)) { |
|
|
|
g2d.setPaint(Color.RED); |
|
|
|
g2d.setPaint(Color.RED); |
|
|
@ -378,6 +381,7 @@ public class CustomIconPane extends BasicPane { |
|
|
|
// 焦点丢失时看看名称是否已经存在
|
|
|
|
// 焦点丢失时看看名称是否已经存在
|
|
|
|
nameTextField.addFocusListener(new FocusListener() { |
|
|
|
nameTextField.addFocusListener(new FocusListener() { |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
public void focusGained(FocusEvent e) { |
|
|
|
|
|
|
|
// do nothing
|
|
|
|
} |
|
|
|
} |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
|
public void focusLost(FocusEvent e) { |
|
|
|
if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) { |
|
|
|
if (oldName != null && ComparatorUtils.equals(oldName, nameTextField.getText())) { |
|
|
|