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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在根容器中分層放置多個(gè)GlassPane

在根容器中分層放置多個(gè)GlassPane

哆啦的時(shí)光機(jī) 2019-11-03 08:04:33
是否有可能添加多個(gè)GlassPane處理單一JFrame,或者我必須使用不舒服LayeredPane與Opacity屬性。我已經(jīng)附上了一些代碼,該代碼顯示了我想做什么(由@camickr提供)。import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.*;import javax.swing.border.*;public class MultiplayGlassPane {    private static final long serialVersionUID = 1L;    private JFrame frame = new JFrame("frameTitle");    private JPanel fPanel = new JPanel();    private Random random = new Random();    private final static Border MESSAGE_BORDER = new EmptyBorder(10, 10, 10, 10);    private JLabel message = new JLabel();    private ArrayList<Star> stars = new ArrayList<Star>();    public MultiplayGlassPane() {        MyGlassPane glass = new MyGlassPane();        for (int i = 0; i < 35; i++) {            Star star = new Star(new Point(random.nextInt(580), random.nextInt(550)));            star.setColor(Color.orange);            star.setxIncr(-3 + random.nextInt(7));            star.setyIncr(-3 + random.nextInt(7));            glass.add(star);        }        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        frame.add(glass, BorderLayout.CENTER);        frame.setLocation(20, 20);        frame.pack();        frame.setVisible(true);        DisabledGlassPane1 glassPane = new DisabledGlassPane1();        JRootPane rootPane = SwingUtilities.getRootPane(frame);        rootPane.setGlassPane(glassPane);        glassPane.activate("");    }    private class MyGlassPane extends JLabel {        private static final long serialVersionUID = 1L;        private ArrayList<Star> stars = new ArrayList<Star>();        private javax.swing.Timer timer = new javax.swing.Timer(20, new ActionListener() {
查看完整描述

2 回答

?
守著一只汪

TA貢獻(xiàn)1872條經(jīng)驗(yàn) 獲得超4個(gè)贊

我認(rèn)為您對(duì)示例中的術(shù)語(yǔ)感到困惑?!?MyGlassPane”根本不是玻璃窗格,它只是一個(gè)JComponent。您應(yīng)該將其重命名為“ StarPanel”。它被添加到JFrame容器中。附帶說(shuō)明,使用JFrame.add()是非法的,您應(yīng)該使用frame.getContentPane()。add()將MyGlassPane添加到根容器中

查看完整回答
反對(duì) 回復(fù) 2019-11-04
  • 2 回答
  • 0 關(guān)注
  • 311 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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