forked from fanruan/design
kuangshuai
3 years ago
7 changed files with 143 additions and 19 deletions
@ -0,0 +1,52 @@
|
||||
package com.fr.design.mainframe.guide.ui; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingConstants; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Dimension; |
||||
import java.awt.GridBagConstraints; |
||||
import java.awt.GridBagLayout; |
||||
|
||||
public class GuideLoadingGlassPane extends JPanel { |
||||
private static final String loadingImagePath = "/com/fr/design/mainframe/guide/loading.gif"; |
||||
private static GuideLoadingGlassPane loadingPane; |
||||
|
||||
public static GuideLoadingGlassPane getInstance() { |
||||
if (loadingPane == null) { |
||||
loadingPane = new GuideLoadingGlassPane(); |
||||
} |
||||
return loadingPane; |
||||
} |
||||
|
||||
public GuideLoadingGlassPane() { |
||||
this.setLayout(new GridBagLayout()); |
||||
this.setOpaque(false); |
||||
initComponent(); |
||||
} |
||||
|
||||
public void initComponent() { |
||||
JPanel loadingView = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
loadingView.setOpaque(false); |
||||
loadingView.setPreferredSize(new Dimension(130, 120)); |
||||
|
||||
JPanel imageContainer = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); |
||||
imageContainer.setOpaque(false); |
||||
ImagePanel imagePanel = new ImagePanel(loadingImagePath); |
||||
imagePanel.setOpaque(false); |
||||
imagePanel.setPreferredSize(new Dimension(84, 84)); |
||||
imageContainer.add(imagePanel); |
||||
|
||||
UILabel hintLabel = new UILabel("任务加载中,请稍后..."); |
||||
hintLabel.setHorizontalAlignment(SwingConstants.CENTER); |
||||
hintLabel.setForeground(Color.WHITE); |
||||
|
||||
loadingView.add(imageContainer, BorderLayout.NORTH); |
||||
loadingView.add(hintLabel, BorderLayout.SOUTH); |
||||
|
||||
this.add(loadingView, new GridBagConstraints()); |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.design.mainframe.guide.ui; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.Graphics; |
||||
import java.awt.Image; |
||||
import java.awt.Toolkit; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-10-23 |
||||
*/ |
||||
public class ImagePanel extends JPanel { |
||||
|
||||
|
||||
private Image image; |
||||
|
||||
public ImagePanel(String imagePath) { |
||||
image = Toolkit.getDefaultToolkit().createImage(ImagePanel.class |
||||
.getResource(imagePath)); |
||||
} |
||||
|
||||
@Override |
||||
public void paintComponent(Graphics g) { |
||||
super.paintComponent(g); |
||||
if (image != null) { |
||||
g.drawImage(image, 0, 0, getWidth(), getHeight(), this); |
||||
} |
||||
} |
||||
} |
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in new issue