Browse Source

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

master
juhaoyu 7 years ago
parent
commit
452019169e
  1. 4
      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

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

@ -37,8 +37,8 @@ public class TitleCellRender implements ListCellRenderer<Object> {
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);

12
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();

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 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);

Loading…
Cancel
Save