Browse Source
Merge in DESIGN/design from ~TOMMY/design:release/11.0 to release/11.0 * commit 'c111cea5900927c01a526df4d5658ed6c603684d': REPORT-61177 解决引导页弹窗展示变成半透明的问题 REPORT-61207 行间距减小,放在window上文字截断 REPORT-60942 加载图视觉更新 REPORT-61125 交互优化更新 REPORT-60942 引导页视觉更新bugfix/11.0
Tommy
3 years ago
18 changed files with 264 additions and 110 deletions
@ -0,0 +1,98 @@
|
||||
package com.fr.design.mainframe.guide.ui; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.Timer; |
||||
import java.awt.AlphaComposite; |
||||
import java.awt.BasicStroke; |
||||
import java.awt.Color; |
||||
import java.awt.Composite; |
||||
import java.awt.Dimension; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
import java.awt.Image; |
||||
import java.awt.Point; |
||||
import java.awt.RenderingHints; |
||||
import java.awt.Stroke; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-10-23 |
||||
*/ |
||||
public class GuideLoadingPane extends JPanel { |
||||
private static final BasicStroke STROKE = new BasicStroke(4); |
||||
private static final int FPS = 30; |
||||
private static final int START_ANGLE = 90; |
||||
private static GuideLoadingPane imagePanel; |
||||
private Image image; |
||||
private int angle; |
||||
private Timer timer; |
||||
|
||||
public static GuideLoadingPane getInstance() { |
||||
if (imagePanel == null) { |
||||
imagePanel = new GuideLoadingPane(); |
||||
} |
||||
return imagePanel; |
||||
} |
||||
|
||||
public GuideLoadingPane() { |
||||
this.setOpaque(false); |
||||
this.setPreferredSize(new Dimension(50, 50)); |
||||
timer = new Timer(1000 / FPS, new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
repaint(); |
||||
angle -= 180 / FPS; // 5 degrees per 100 ms = 50 degrees/second
|
||||
if (angle > -270) { |
||||
angle += 2 * 360; |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void start() { |
||||
angle = START_ANGLE; |
||||
timer.start(); |
||||
} |
||||
|
||||
public void stop() { |
||||
timer.stop(); |
||||
} |
||||
|
||||
@Override |
||||
public void paintComponent(Graphics g) { |
||||
super.paintComponent(g); |
||||
Graphics2D g2 = (Graphics2D) g; |
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
||||
|
||||
Composite oldComposite = g2.getComposite(); |
||||
Stroke oldStroke = g2.getStroke(); |
||||
|
||||
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); |
||||
|
||||
int d = Math.min(getWidth(), getHeight()); |
||||
int r = d / 2; |
||||
Point circlePoint = new Point(getWidth() / 2, getHeight() / 2); |
||||
|
||||
g2.setColor(Color.WHITE); |
||||
g2.fillOval(circlePoint.x - r, circlePoint.y - r, d, d); |
||||
|
||||
g2.setColor(Color.BLACK); |
||||
int waitCircleD = d / 10; |
||||
int waitCircleR = waitCircleD / 2; |
||||
|
||||
g2.fillOval(circlePoint.x - r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD); |
||||
g2.fillOval(circlePoint.x - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD); |
||||
g2.fillOval(circlePoint.x + r / 3 - waitCircleR, circlePoint.y - waitCircleR, waitCircleD, waitCircleD); |
||||
|
||||
|
||||
g2.setStroke(STROKE); |
||||
g2.setColor(Color.decode("#419BF9")); |
||||
|
||||
int lineWidth = (int) STROKE.getLineWidth(); |
||||
g2.drawArc(circlePoint.x - r + lineWidth / 2 , circlePoint.y - r + lineWidth / 2, d - lineWidth, d - lineWidth, angle, -90); |
||||
|
||||
g2.setStroke(oldStroke); |
||||
g2.setComposite(oldComposite); |
||||
} |
||||
} |
@ -1,28 +0,0 @@
|
||||
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); |
||||
} |
||||
} |
||||
} |
Before Width: | Height: | Size: 485 B |
After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 401 B |
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 567 B |
After Width: | Height: | Size: 2.9 KiB |
Loading…
Reference in new issue