第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

搖擺窗口間歇性空白

搖擺窗口間歇性空白

縹緲止盈 2021-10-13 15:53:18
Swing GUI 間歇性空白,這里是一張圖片,顯示我循環(huán)執(zhí)行代碼以顯示 GUI 5 次,最后一次是空白的我正在使用 InvokeLater 執(zhí)行 GUI,我試過沒有它,結(jié)果還是一樣。這是足夠的代碼來啟動和運行 GUI    public class Main_UI extends JFrame {    public Main_UI() {        JPanel gui = new JPanel(new BorderLayout());        setUndecorated(true);        setLocationRelativeTo(null);        setVisible(true);        setSize(329, 256);        setResizable(false);        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);        ThemeUtils.setTopBar(gui, this);    }}這是代碼 ThemeUtils.setTopBar    public static void setTopBar(JPanel jPanel, JFrame frame) {    JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));    JButton exitButton = new JButton("X");    JButton minimizeButton = new JButton("-");    topPanel.add(minimizeButton);    topPanel.add(exitButton);    jPanel.add(BorderLayout.NORTH, topPanel);    new DragFeatures(topPanel, frame).setupDragFeatures();}最后是DragFeatures課程代碼public class DragFeatures {    private Point compCoords;    private JPanel panel;    private JFrame frame;    public DragFeatures(JPanel panel, JFrame frame) {        this.panel = panel;        this.frame = frame;    }    public void setupDragFeatures() {        compCoords = null;        panel.addMouseListener(new MouseAdapter() {            public void mouseReleased(MouseEvent e) {                compCoords = null;            }            public void mousePressed(MouseEvent e) {                compCoords = e.getPoint();            }        });        panel.addMouseMotionListener(new MouseMotionListener() {            public void mouseMoved(MouseEvent e) {            }            public void mouseDragged(MouseEvent e) {                Point currCoords = e.getLocationOnScreen();                frame.setLocation(currCoords.x - compCoords.x, currCoords.y - compCoords.y);            }        });    }}這應(yīng)該足以重現(xiàn)錯誤。
查看完整描述

2 回答

?
白衣染霜花

TA貢獻1796條經(jīng)驗 獲得超10個贊

好吧,看起來沒有人想回答這個問題,所以我會繼續(xù)讓你們知道是什么解決了這個問題。我setVisible在添加所有視圖的最后打電話,感謝@Madprogrammer


查看完整回答
反對 回復(fù) 2021-10-13
  • 2 回答
  • 0 關(guān)注
  • 191 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號