|
|
@ -22,8 +22,6 @@ import javax.swing.ImageIcon; |
|
|
|
public class ToolBarButton extends UIButton implements MouseListener { |
|
|
|
public class ToolBarButton extends UIButton implements MouseListener { |
|
|
|
private Widget widget; |
|
|
|
private Widget widget; |
|
|
|
private WidgetOption no; |
|
|
|
private WidgetOption no; |
|
|
|
private final int ICON_WIDTH = FineUIScale.scale(16); |
|
|
|
|
|
|
|
private final int ICON_HEIGHT = FineUIScale.scale(16); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ToolBarButton(Icon icon, Widget widget) { |
|
|
|
public ToolBarButton(Icon icon, Widget widget) { |
|
|
|
this(null, icon, widget); |
|
|
|
this(null, icon, widget); |
|
|
@ -55,7 +53,7 @@ public class ToolBarButton extends UIButton implements MouseListener { |
|
|
|
if (icon instanceof ImageIcon) { |
|
|
|
if (icon instanceof ImageIcon) { |
|
|
|
//自定义上传的图标在设计器工具栏显示需要按照16*16进行缩放
|
|
|
|
//自定义上传的图标在设计器工具栏显示需要按照16*16进行缩放
|
|
|
|
Image originalImage = ((ImageIcon) icon).getImage(); |
|
|
|
Image originalImage = ((ImageIcon) icon).getImage(); |
|
|
|
Image scaledImage = originalImage.getScaledInstance(ICON_WIDTH, ICON_HEIGHT, Image.SCALE_SMOOTH); |
|
|
|
Image scaledImage = originalImage.getScaledInstance(FineUIScale.scale(16), FineUIScale.scale(16), Image.SCALE_SMOOTH); |
|
|
|
icon = new ImageIcon(scaledImage); |
|
|
|
icon = new ImageIcon(scaledImage); |
|
|
|
} |
|
|
|
} |
|
|
|
super.setIcon(icon); |
|
|
|
super.setIcon(icon); |
|
|
|