影音先锋AⅤ天堂资源站,13小箩利洗澡无码视频APP,午夜理论片日本中文在线,最近新免费韩国日本电影

萬能百科  > 計(jì)算機(jī)?  > 

[填空題] 下面ButtonFrame類創(chuàng)建了一個容器,包含有3個按鍵。 import javax.swing.*; public class Button

2021-07-20   

[填空題] 下面ButtonFrame類創(chuàng)建了一個容器,包含有3個按鍵。

import javax.swing.*;

public class ButtonFrame extends JFrame

JButton Button1= new JButton("Button1");

JButton Button2= new JButton("Button2");

JButton Button3= new JButton("Button3");

public ButtonFrame()

super("ButtonFrame");

setSize(100,150);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JPane1 pane = new JPanel();

pane.add(Buttonl);

pane.add(Button2);

pane.add(Button3);

【12】 ;

public static void main(String args[])

ButtonFrame bf= new ButtonFrame();

bf.show();

請?jiān)诔绦虼a中的畫線處添上正確的語句,使程序完整。

正確答案:

setContentPane(pane)

參考解析:

本題考查向swing容器添加組件的基本知識。往容器添加組件,可將容器分解為窗格,這是容器內(nèi)的容器,再將組件添加到容器的內(nèi)容窗格中??梢允褂孟铝胁襟E在容器的內(nèi)容窗格中添加組件。 ① 創(chuàng)建一個窗格。 ② 使用它的add(Component)方法在窗格中添加組件。 ③ 以窗格為參數(shù)調(diào)用setContentpane(Container)。

詞條內(nèi)容僅供參考,如果您需要解決具體問題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。

標(biāo)簽

<蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <蜘蛛词>| <文本链> <文本链> <文本链> <文本链> <文本链> <文本链>