首页 > 自考
题目内容 (请给出正确答案)
[单选题]

一般的绘图程序要定义一个JPanel子类。在JPanel子类中还要重定义一个方法,在这个方法中调用绘图方法,绘制各种图形。要重定义的方法是()。

A.paint()

B.paintComponent()

C.repaint()

D.update()

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“一般的绘图程序要定义一个JPanel子类。在JPanel子类…”相关的问题
第1题
要创建用户自定义工具栏应当先创建一个()A.表单B.菜单C.子类D.程序

要创建用户自定义工具栏应当先创建一个()

A.表单 B.菜单

C.子类 D.程序

点击查看答案
第2题
编程创建一个Person类,该类属性包括姓名、性别、年龄三个属性。该类包括一般方法public String getInfo()把Person对象的所有信息组成一个字符串,及初始化所有成员变量的构造方法。 定义一个学生类Student,它继承Person类。该类需要满足以下要求: 1、 Student类有以下几个变量。(1)继承自父类的变量(2)子类新增的变量:学号,哲学课成绩,英语课成绩,计算机
点击查看答案
第3题
下面类中,有两个下拉列表,一个可以选择月份,一个可以选择2000—2009年之间的年份。 import jav
ax.swing.*; public class Expiration extends JFrame. { JComboBox monthBox = new JComboBox(); JComboBox yearBox = new JComboBox(); public Expiration () { super("Expiration Date"); setSize (240,90); setDefaultCloseOperation(JFrame.EXIT ON CLOSE); JPanel pane = new JPanel(); JLabel exp = new JLabel ("Expiration Date:"); for (int i = 0;i < 13;i++) { monthBox.addItem (" "+i); } for (int i = 2000;i<2010;i++) { yearBox.addItem(" "+i); } pane.add (exp); pane.add (monthBox) 【 】; setContentPane(pane); } public static void main(String[] arguments) { Expiration expiration= new Expiration(); expiration.show(); } } 请在画线处填入正确的语句使得程序完整。

点击查看答案
第4题
下面的应用程序中有一个组,组内有4个单选按钮,请在画线处填入正确的语句使程序能正确运行。
import javax.swing.*; public class OneTeam extends JFrame. { JRadioButton[] teams = new JRadioButton[3]; public OneTeam() { super("One Team"); setSize (140,160); setDefaultCloseOperation(JFrame.EXIT ON CLOSE JPanel pane = new JPanel(); teams[0] = new JRadioButton("red choose"); teams[l] = new JRadioButton("blue choose"); teams[2] = new JRadioButton("green choose"); 【 】; for (int i = 0;i < teams.length;i++) { group.add(teams[i]); pane.add(teams[i]); } setContentPane(pane); } public static void main(String arguments[] { OneTeam t= new OneTeam(); ot.show(); }

点击查看答案
第5题
下面ButtonFrame类创建了一个容器,包含有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); 【 】; } public static void main(String args[]) { ButtonFrame. bf= new ButtonFrame(); bf.show(); } } 请在程序代码中的画线处添上正确的语句,使程序完整。

点击查看答案
第6题
编写时具有Applet与Application特征的程序。具体方法是:作为Application要定义 main()方法,并且把

编写时具有Applet与Application特征的程序。具体方法是:作为Application要定义 main()方法,并且把main()方法所在的类定义为一个public类。为使该程序成为一个Applet,main()方法所在的这个类必须继承Applet类或【 】类。

点击查看答案
第7题
编写同时具有Applet与Application特征的程序,具体的方法是:作为Application要定义main()方法,并

编写同时具有Applet与Application特征的程序,具体的方法是:作为Application要定义main()方法,并且把main()方法所在的类定义为一个【 】类,为使该程序成为一个Applet,main()方法所在的这个类必须继承Applet类或JApplet类。

点击查看答案
第8题
类具有继承的特性。如果已经定义了一个名为运动器械的父类,下面各组列出的名称适合定义成它的子类的是()。

A自行车,摩托车,红旗轿车

B篮球,足球,排球

C教练,球员,足球

D足球课,排球课,篮球课

点击查看答案
第9题
bar为一JScrollBar组件,阅读下面程序段,请在程序中的画线处填入正确的语句使程序能够正确运行。
... public WellAdjusted() { super("Well Adjusted"); setSize(350,100); bar.addAdjustmentListener(this); value.setHorizontalAlignment(SwingConstants.CENTER); value.setEditable(false); JPanel pane = new JPane(); pane.setLayout(new BorderLayout()); pane.add(value,"Center"): pane.add(bar,"South"); setContentPane(pane); } public void adjustmentValueChanged(AdjustmentEvent evt) { 【 】 if(source ==bar) { int newValue bar.getValue(); value.setText(""+newValue); } repaint(); }

点击查看答案
第10题
bar为一JSerollBar组件,阅读下面程序段,请在程序中的画线处填入正确的语句使程序能够正确运行。
… public WellAdjusted() { super("Well Adjusted"); setSize(350,100); bar.addAdjustmentListener(this); value.setHorizontalAlignment(SwingConstants.CENTER); value.setEditable(false); JPanel pane=new JPane(); pane.setLayout(new BorderLayout()); pane.add(value,"Center"): pane.add(bar,"South"); setContentPane(pane); } public void adjustmentValueChanged(AdjustmentEvent evt) { 【 】 if(source==bar) { int newValue bar.getValue(); value.setText(""+newValue); } repaint(); } …

点击查看答案
第11题
下面ChangeTitle()中对b1和b2按钮构造监听器,实现当单击b1按钮时标题变为students,当单击b2按钮

下面ChangeTitle()中对b1和b2按钮构造监听器,实现当单击b1按钮时标题变为students,当单击b2按钮时标题变为Teachers。请将程序补充完整。 public ChangeTitle() { super("Title Bar"); b1.addAetionListener(this); 【 】 Jpanel pane = new Jpanel(); Pane.add(b1); Pane.add(b2); SetContentPane(pane); public void actionPerformed(ActionEvent evt) { Object sourve = evt.getSource(); if (sourve ==b1) setTitle("Students"); else if (source == b2) setTitle("Teachers"); repaint(); }

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改