Browse Source

直接用IOUtils的工具方法读取Icon

master
juhaoyu 7 years ago
parent
commit
452019169e
  1. 2
      designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java
  2. 12
      designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  3. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/type/ChartImagePane.java

2
designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java

@ -37,7 +37,7 @@ public class TitleCellRender implements ListCellRenderer<Object> {
panel.add(this.more, BorderLayout.EAST); panel.add(this.more, BorderLayout.EAST);
} }
if (moreModel.isLoading()) { 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的加载动画 //设置cell的加载动画
imageIcon.setImageObserver(list); imageIcon.setImageObserver(list);

12
designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -83,7 +83,7 @@ public class AlphaFineDialog extends UIDialog {
searchTextField.setBorderPainted(false); searchTextField.setBorderPainted(false);
searchTextField.initKeyListener(this); searchTextField.initKeyListener(this);
JPanel topPane = new JPanel(new BorderLayout()); 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.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE);
iconLabel.setOpaque(true); iconLabel.setOpaque(true);
iconLabel.setBackground(Color.white); iconLabel.setBackground(Color.white);
@ -99,7 +99,7 @@ public class AlphaFineDialog extends UIDialog {
}; };
closeButton.setContentAreaFilled(false); closeButton.setContentAreaFilled(false);
closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); 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.set4ToolbarButton();
closeButton.addActionListener(new ActionListener() { closeButton.addActionListener(new ActionListener() {
@Override @Override
@ -371,11 +371,7 @@ public class AlphaFineDialog extends UIDialog {
try { try {
bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl()));
} catch (IOException e) { } catch (IOException e) {
try { bufferedImage = IOUtils.readImage("/com/fr/design/mainframe/alphafine/images/default_product.png");
bufferedImage = ImageIO.read(IOUtils.getResource("/com/fr/design/mainframe/alphafine/images/default_product.png", getClass()));
} catch (IOException e1) {
FRLogger.getLogger().error(e.getMessage());
}
} }
return bufferedImage; return bufferedImage;
} }
@ -418,7 +414,7 @@ public class AlphaFineDialog extends UIDialog {
private void showDefaultPreviewPane() { private void showDefaultPreviewPane() {
rightSearchResultPane.removeAll(); 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)); label.setBorder(BorderFactory.createEmptyBorder(120,0,0,0));
rightSearchResultPane.add(label, BorderLayout.CENTER); rightSearchResultPane.add(label, BorderLayout.CENTER);
validate(); validate();

4
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 boolean isDoubleClicked = false;
public ChartImagePane(String iconPath, String tipName) {// 建立太复杂? 耗费内存.. 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.setLayout(new BorderLayout());
this.add(image, BorderLayout.CENTER); this.add(image, BorderLayout.CENTER);
addMouseListener(this); addMouseListener(this);
@ -30,7 +30,7 @@ public class ChartImagePane extends ChartSelectDemoPane {
private void constructImagePane(String fullIconPath, String tipName, boolean isDrawRightLine){ 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.setLayout(new BorderLayout());
this.add(image, BorderLayout.CENTER); this.add(image, BorderLayout.CENTER);
addMouseListener(this); addMouseListener(this);

Loading…
Cancel
Save