Skip to content

Commit

Permalink
修复辣鸡显卡才容易出现的BUG,不确定是否真的彻底修复,document.insertString方法在面板没渲染完成时执行,会把面板…
Browse files Browse the repository at this point in the history
…卡死,且无法关闭
  • Loading branch information
4379711 committed Apr 25, 2024
1 parent 4e1ea35 commit aa7a7d1
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main/java/yalong/site/frame/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

/**
* 主窗体
Expand All @@ -16,6 +18,8 @@
public class MainFrame extends JFrame {
private static MainFrame frame;

private static volatile boolean hasPainted = false;

public MainFrame() throws HeadlessException {
super();
this.setTitle("lol-helper");
Expand All @@ -37,7 +41,21 @@ public static void start() {
TabPane tabPane = TabPane.builder();
frame.add(tabPane);
frame.setVisible(true);
helpMsg();
frame.addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent e) {
hasPainted = true;
}
});

//等组件渲染 再显示帮助信息
while (!hasPainted) {
try {
Thread.sleep(10);
} catch (InterruptedException ignored) {
}
}
helpMsg();
}

private static void helpMsg(){
Expand Down

0 comments on commit aa7a7d1

Please sign in to comment.