diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index ba23714212..74fbf8e015 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -4,6 +4,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; +import com.fr.stable.resource.ResourceLoader; import javax.swing.*; import java.awt.*; @@ -33,7 +34,7 @@ public class ContentCellRender implements ListCellRenderer { AlphaCellModel model = (AlphaCellModel) value; name.setText(model.getName()); String iconUrl = "/com/fr/design/mainframe/alphafine/images/alphafine" + model.getType().getTypeValue() + ".png"; - name.setIcon(new ImageIcon(getClass().getResource(iconUrl))); + name.setIcon(new ImageIcon(ResourceLoader.getResource(iconUrl, getClass()))); name.setFont(AlphaFineConstants.MEDIUM_FONT); name.setForeground(AlphaFineConstants.BLACK); name.setVerticalTextPosition(SwingConstants.CENTER); 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 84784ecdb3..f607f8fecd 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 @@ -3,6 +3,8 @@ package com.fr.design.mainframe.alphafine.cell.render; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; +import com.fr.stable.resource.ResourceLoader; + import javax.swing.*; import java.awt.*; @@ -35,7 +37,7 @@ public class TitleCellRender implements ListCellRenderer { panel.add(this.more, BorderLayout.EAST); } if (moreModel.isLoading()) { - ImageIcon imageIcon = new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/loading.gif")); + ImageIcon imageIcon = new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/loading.gif", getClass())); //设置cell的加载动画 imageIcon.setImageObserver(list); 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 00e1744fc5..5f93957acf 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -10,8 +10,8 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.cell.CellModelHelper; -import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.cell.model.*; +import com.fr.design.mainframe.alphafine.cell.render.ContentCellRender; import com.fr.design.mainframe.alphafine.listener.ComponentHandler; import com.fr.design.mainframe.alphafine.listener.DocumentAdapter; import com.fr.design.mainframe.alphafine.model.SearchListModel; @@ -36,6 +36,7 @@ import com.fr.main.impl.WorkBook; import com.fr.stable.CodeUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; +import com.fr.stable.resource.ResourceLoader; import javax.imageio.ImageIO; import javax.swing.*; @@ -45,7 +46,7 @@ import javax.swing.event.ListSelectionListener; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; -import java.io.*; +import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; @@ -82,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(getClass().getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png"))); + UILabel iconLabel = new UILabel(new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/bigsearch.png", getClass()))); iconLabel.setPreferredSize(AlphaFineConstants.ICON_LABEL_SIZE); iconLabel.setOpaque(true); iconLabel.setBackground(Color.white); @@ -98,7 +99,7 @@ public class AlphaFineDialog extends UIDialog { }; closeButton.setContentAreaFilled(false); closeButton.setPreferredSize(AlphaFineConstants.CLOSE_BUTTON_SIZE); - closeButton.setIcon(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png"))); + closeButton.setIcon(new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/alphafine_close.png", getClass()))); closeButton.set4ToolbarButton(); closeButton.addActionListener(new ActionListener() { @Override @@ -371,7 +372,7 @@ public class AlphaFineDialog extends UIDialog { bufferedImage = ImageIO.read(new URL(((PluginModel) selectedValue).getImageUrl())); } catch (IOException e) { try { - bufferedImage = ImageIO.read(getClass().getResource("/com/fr/design/mainframe/alphafine/images/default_product.png")); + bufferedImage = ImageIO.read(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/default_product.png", getClass())); } catch (IOException e1) { FRLogger.getLogger().error(e.getMessage()); } @@ -417,7 +418,7 @@ public class AlphaFineDialog extends UIDialog { private void showDefaultPreviewPane() { rightSearchResultPane.removeAll(); - UILabel label = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/mainframe/alphafine/images/opening.gif"))); + UILabel label = new UILabel(new ImageIcon(ResourceLoader.getResource("/com/fr/design/mainframe/alphafine/images/opening.gif", getClass()))); label.setBorder(BorderFactory.createEmptyBorder(120,0,0,0)); rightSearchResultPane.add(label, BorderLayout.CENTER); validate(); diff --git a/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java b/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java index 121929e090..77f2c2fab0 100644 --- a/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java +++ b/designer/src/com/fr/design/mainframe/bbs/BBSConstants.java @@ -4,6 +4,7 @@ package com.fr.design.mainframe.bbs; import com.fr.stable.StringUtils; +import com.fr.stable.resource.ResourceLoader; import java.util.Properties; @@ -43,7 +44,7 @@ public class BBSConstants { if (PROP == null) { PROP = new Properties(); try { - PROP.load(BBSConstants.class.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties")); + PROP.load(ResourceLoader.getResourceAsStream("/com/fr/design/mainframe/bbs/bbs.properties", BBSConstants.class)); } catch (Exception e) { } } diff --git a/designer_base/src/com/fr/design/dialog/InformationWarnPane.java b/designer_base/src/com/fr/design/dialog/InformationWarnPane.java index e5dd4fd9fb..c6282ca67c 100644 --- a/designer_base/src/com/fr/design/dialog/InformationWarnPane.java +++ b/designer_base/src/com/fr/design/dialog/InformationWarnPane.java @@ -25,6 +25,7 @@ import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.Inter; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.resource.ResourceLoader; public class InformationWarnPane extends JPanel{ private UITextArea moreText; @@ -42,7 +43,7 @@ public class InformationWarnPane extends JPanel{ this.title = title; this.setLayout(null); this.setBounds(5,5,410,130); - UILabel image = new UILabel(new ImageIcon(getClass().getResource("/com/fr/design/images/buttonicon/warn.png"))); + UILabel image = new UILabel(new ImageIcon(ResourceLoader.getResource("/com/fr/design/images/buttonicon/warn.png", getClass()))); image.setBounds(10, 25, 80, 80); UITextArea warnLabel = new UITextArea(infor); warnLabel.setLineWrap(true); diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java index f3c96d2194..04211e5686 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebPane.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebPane.java @@ -5,6 +5,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.SiteCenter; +import com.fr.stable.resource.ResourceLoader; import javafx.application.Platform; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -74,7 +75,7 @@ public class QQLoginWebPane extends JFXPanel { try { primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.setScene(new Scene(layout)); - webView.getScene().getStylesheets().add(getClass().getResource("modal-dialog.css").toExternalForm()); + webView.getScene().getStylesheets().add(ResourceLoader.getResource("modal-dialog.css", getClass()).toExternalForm()); primaryStage.initStyle(StageStyle.UTILITY); primaryStage.setScene(new Scene(new Group(), DEFAULT_PRIMARYSTAGE_WIDTH, DEFAULT_PRIMARYSTAGE_HEIGHT)); primaryStage.setX(0); @@ -193,7 +194,7 @@ public class QQLoginWebPane extends JFXPanel { ); configDrag(dialog); // style and show the dialog. - dialog.getScene().getStylesheets().add(getClass().getResource("modal-dialog.css").toExternalForm()); + dialog.getScene().getStylesheets().add(ResourceLoader.getResource("modal-dialog.css", getClass()).toExternalForm()); dialog.setOnCloseRequest(new EventHandler() { @Override public void handle(WindowEvent event) { diff --git a/designer_base/src/com/fr/design/gui/UILookAndFeel.java b/designer_base/src/com/fr/design/gui/UILookAndFeel.java index 3bdf14d31f..e70d034699 100644 --- a/designer_base/src/com/fr/design/gui/UILookAndFeel.java +++ b/designer_base/src/com/fr/design/gui/UILookAndFeel.java @@ -3,10 +3,12 @@ package com.fr.design.gui; import com.fr.base.BaseUtils; import com.fr.design.gui.borders.*; import com.fr.design.gui.frpane.UIBasicOptionPaneUI; +import com.fr.design.gui.ibutton.UIBasicButtonUI; import com.fr.design.gui.ibutton.UIButtonBorder; import com.fr.design.gui.ibutton.UIRadioButtonMenuItemUI; import com.fr.design.gui.ibutton.UIRadioButtonUI; import com.fr.design.gui.icheckbox.UICheckBoxUI; +import com.fr.design.gui.icombobox.UIBasicComboBoxUI; import com.fr.design.gui.icontainer.UIScrollPaneBorder; import com.fr.design.gui.icontainer.UIScrollPaneUI; import com.fr.design.gui.icontainer.UITableScrollPaneBorder; @@ -16,6 +18,7 @@ import com.fr.design.gui.imenu.UIPopupMenuBorder; import com.fr.design.gui.imenu.UIPopupMenuSeparatorUI; import com.fr.design.gui.iprogressbar.UIProgressBarBorder; import com.fr.design.gui.iprogressbar.UIProgressBarUI; +import com.fr.design.gui.iscrollbar.UIBasicScrollBarUI; import com.fr.design.gui.ispinner.UISpinnerUI; import com.fr.design.gui.isplitpanedivider.UISplitPaneUI; import com.fr.design.gui.itable.UIBasicTableUI; @@ -23,10 +26,8 @@ import com.fr.design.gui.itoolbar.UIToolBarBorder; import com.fr.design.gui.itoolbar.UIToolBarSeparatorUI; import com.fr.design.gui.itooltip.UIToolTipBorder; import com.fr.design.gui.itree.UITreeUI; -import com.fr.design.gui.iscrollbar.UIBasicScrollBarUI; -import com.fr.design.gui.icombobox.UIBasicComboBoxUI; -import com.fr.design.gui.ibutton.UIBasicButtonUI; import com.fr.general.FRLogger; +import com.fr.stable.resource.ResourceLoader; import javax.swing.*; import javax.swing.border.Border; @@ -187,8 +188,8 @@ public class UILookAndFeel extends MetalLookAndFeel { if (url == null) { // Another try - url = UILookAndFeel.class.getResource( - "com/fr/design/images/lookandfeel/" + fileName); + url = ResourceLoader.getResource( + "com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class); if (url == null) { FRLogger.getLogger().error("Icon directory could not be resolved."); diff --git a/designer_base/src/com/fr/design/gui/autocomplete/TipUtil.java b/designer_base/src/com/fr/design/gui/autocomplete/TipUtil.java index bb8f32469d..2201dd174f 100644 --- a/designer_base/src/com/fr/design/gui/autocomplete/TipUtil.java +++ b/designer_base/src/com/fr/design/gui/autocomplete/TipUtil.java @@ -8,16 +8,14 @@ */ package com.fr.design.gui.autocomplete; -import java.awt.Color; -import java.awt.Font; -import java.awt.SystemColor; -import java.net.URL; -import javax.swing.BorderFactory; -import javax.swing.JEditorPane; -import javax.swing.UIManager; +import com.fr.stable.resource.ResourceLoader; + +import javax.swing.*; import javax.swing.border.Border; import javax.swing.plaf.ColorUIResource; import javax.swing.text.html.HTMLDocument; +import java.awt.*; +import java.net.URL; /** @@ -166,8 +164,8 @@ class TipUtil { Color linkFG = Util.getHyperlinkForeground(); doc.getStyleSheet().addRule( "a { color: " + Util.getHexString(linkFG) + "; }"); - - URL url = TipUtil.class.getResource("bullet_black.png"); + + URL url = ResourceLoader.getResource("bullet_black.png", TipUtil.class); if (url!=null) { doc.getStyleSheet().addRule( "ul { list-style-image: '" + url.toString() + "'; }"); 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 f56146b8b9..c386d1cab9 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 @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; +import com.fr.stable.resource.ResourceLoader; import javax.swing.*; import java.awt.*; @@ -14,9 +15,9 @@ public class ChartImagePane extends ChartSelectDemoPane { public boolean isDoubleClicked = false; public ChartImagePane(String iconPath, String tipName) {// 建立太复杂? 耗费内存.. - UILabel image = new UILabel(new ImageIcon(getClass().getResource(iconPath))); - this.setLayout(new BorderLayout()); - this.add(image, BorderLayout.CENTER); + UILabel image = new UILabel(new ImageIcon(ResourceLoader.getResource(iconPath, getClass()))); + this.setLayout(new BorderLayout()); + this.add(image, BorderLayout.CENTER); addMouseListener(this); this.setToolTipText(tipName); @@ -28,7 +29,8 @@ public class ChartImagePane extends ChartSelectDemoPane { } private void constructImagePane(String fullIconPath, String tipName, boolean isDrawRightLine){ - UILabel image = new UILabel(new ImageIcon(getClass().getResource(fullIconPath))); + + UILabel image = new UILabel(new ImageIcon(ResourceLoader.getResource(fullIconPath, getClass()))); this.setLayout(new BorderLayout()); this.add(image, BorderLayout.CENTER); addMouseListener(this);