From 452019169e5c15652b6e3fac4c422e0349695340 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Thu, 25 May 2017 09:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E7=94=A8IOUtils=E7=9A=84?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=96=B9=E6=B3=95=E8=AF=BB=E5=8F=96Icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/cell/render/TitleCellRender.java | 4 ++-- .../alphafine/component/AlphaFineDialog.java | 12 ++++-------- .../mainframe/chart/gui/type/ChartImagePane.java | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java index 339815d5c9..5926d4e210 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java @@ -37,8 +37,8 @@ public class TitleCellRender implements ListCellRenderer { panel.add(this.more, BorderLayout.EAST); } if (moreModel.isLoading()) { - ImageIcon imageIcon = new ImageIcon(IOUtils.getResource("/com/fr/design/mainframe/alphafine/images/loading.gif", getClass())); - + ImageIcon imageIcon = (ImageIcon) IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/loading.gif"); + //设置cell的加载动画 imageIcon.setImageObserver(list); UILabel loadingLabel = new UILabel(imageIcon); diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 6ac98a2c86..169f1a492f 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -83,7 +83,7 @@ public class AlphaFineDialog extends UIDialog { searchTextField.setBorderPainted(false); searchTextField.initKeyListener(this); JPanel topPane = new JPanel(new BorderLayout()); - UILabel iconLabel = new UILabel(new ImageIcon(IOUtils.getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png", getClass()))); + UILabel iconLabel = new UILabel(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/bigsearch.png")); iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); iconLabel.setOpaque(true); iconLabel.setBackground(Color.white); @@ -99,7 +99,7 @@ public class AlphaFineDialog extends UIDialog { }; closeButton.setContentAreaFilled(false); closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); - closeButton.setIcon(new ImageIcon(IOUtils.getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png", getClass()))); + closeButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/alphafine_close.png")); closeButton.set4ToolbarButton(); closeButton.addActionListener(new ActionListener() { @Override @@ -371,11 +371,7 @@ public class AlphaFineDialog extends UIDialog { try { bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); } catch (IOException e) { - try { - bufferedImage = ImageIO.read(IOUtils.getResource("/com/fr/design/mainframe/alphafine/images/default_product.png", getClass())); - } catch (IOException e1) { - FRLogger.getLogger().error(e.getMessage()); - } + bufferedImage = IOUtils.readImage("/com/fr/design/mainframe/alphafine/images/default_product.png"); } return bufferedImage; } @@ -418,7 +414,7 @@ public class AlphaFineDialog extends UIDialog { private void showDefaultPreviewPane() { rightSearchResultPane.removeAll(); - UILabel label = new UILabel(new ImageIcon(IOUtils.getResource("/com/fr/design/mainframe/alphafine/images/opening.gif", getClass()))); + UILabel label = new UILabel(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/opening.gif")); label.setBorder(BorderFactory.createEmptyBorder(120,0,0,0)); rightSearchResultPane.add(label, BorderLayout.CENTER); validate(); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java index 247dd5c080..7b35b8d8dc 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java @@ -15,7 +15,7 @@ public class ChartImagePane extends ChartSelectDemoPane { public boolean isDoubleClicked = false; public ChartImagePane(String iconPath, String tipName) {// 建立太复杂? 耗费内存.. - UILabel image = new UILabel(new ImageIcon(IOUtils.getResource(iconPath, getClass()))); + UILabel image = new UILabel(IOUtils.readIcon(iconPath)); this.setLayout(new BorderLayout()); this.add(image, BorderLayout.CENTER); addMouseListener(this); @@ -30,7 +30,7 @@ public class ChartImagePane extends ChartSelectDemoPane { private void constructImagePane(String fullIconPath, String tipName, boolean isDrawRightLine){ - UILabel image = new UILabel(new ImageIcon(IOUtils.getResource(fullIconPath, getClass()))); + UILabel image = new UILabel(IOUtils.readIcon(fullIconPath)); this.setLayout(new BorderLayout()); this.add(image, BorderLayout.CENTER); addMouseListener(this);