You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.9 KiB
61 lines
1.9 KiB
package com.fr.design.mainframe; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
import java.awt.Color; |
|
import java.awt.Component; |
|
import java.awt.Container; |
|
import java.awt.Dimension; |
|
import java.awt.LayoutManager; |
|
import javax.swing.ImageIcon; |
|
import javax.swing.JPanel; |
|
|
|
/** |
|
* @author hades |
|
* @version 10.0 |
|
* Created by hades on 2021/4/9 |
|
*/ |
|
public class OpenLoadingPane extends JPanel { |
|
|
|
private static final ImageIcon LOADING_ICON = new ImageIcon(OpenLoadingPane.class.getResource("/com/fr/design/images/mainframe/loading.gif")); |
|
|
|
private UILabel loadingLabel; |
|
|
|
public OpenLoadingPane() { |
|
|
|
setLayout(new LayoutManager() { |
|
|
|
@Override |
|
public void removeLayoutComponent(Component comp) { |
|
} |
|
|
|
@Override |
|
public Dimension preferredLayoutSize(Container parent) { |
|
return parent.getPreferredSize(); |
|
} |
|
|
|
@Override |
|
public Dimension minimumLayoutSize(Container parent) { |
|
return null; |
|
} |
|
|
|
@Override |
|
public void layoutContainer(Container parent) { |
|
int width = parent.getParent().getWidth(); |
|
int height = parent.getParent().getHeight(); |
|
int loadingLabelWidth = loadingLabel.getPreferredSize().width; |
|
int loadingLabelHeight = loadingLabel.getPreferredSize().height; |
|
int loadingLabelX = (width - loadingLabelWidth) / 2; |
|
int loadingLabelY = (height - loadingLabelHeight) / 2; |
|
loadingLabel.setBounds(loadingLabelX, loadingLabelY, loadingLabelWidth, loadingLabelHeight); |
|
} |
|
|
|
@Override |
|
public void addLayoutComponent(String name, Component comp) { |
|
} |
|
}); |
|
setBackground(Color.WHITE); |
|
loadingLabel = new UILabel(LOADING_ICON); |
|
add(loadingLabel); |
|
|
|
} |
|
}
|
|
|