请完成下列Java程序:使用JTabbedPane在窗口顶部建立一个图形标签,包含有两个标签窗格,一个使用简单标签(Labe1)显示欢迎信息,一个使用按钮和图标。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运经结果如下:import javax.swing.*;import java.awt.*;import java.awt.event.*;public class ex8_2 extends JPane1 {public ex8_2() {JTabbedPane jtp=new JTabbedPane(SwingConstants.BOTTOM);Icon icon=new ImageIcon("icon.gif");JButton btn=new JButton(icon);JLabel l=new JLabel("Welcome to the NCR Examination!");______________;______________;setLayout(new BorderLayout());add(jtp,"Center");}public static void main(String args[]){ex8_2 obi8_2=new ex8_2();String str= obj8_2.getClass().toString();if(str.indexOf("class") != -1)str = str.substring(6);JFrame. frm = new JFrame(str);frm.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent we) {System.exit(O);}});frm.getContentPane () .add(obj8_2);frm.setSize(300, 200);frm.setVisible(true);}}

请完成下列Java程序:使用JTabbedPane在窗口顶部建立一个图形标签,包含有两个标签窗格,一个使用简单标签(Labe1)显示欢迎信息,一个使用按钮和图标。

注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。

程序运经结果如下:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class ex8_2 extends JPane1 {

public ex8_2() {

JTabbedPane jtp=new JTabbedPane(SwingConstants.BOTTOM);

Icon icon=new ImageIcon("icon.gif");

JButton btn=new JButton(icon);

JLabel l=new JLabel("Welcome to the NCR Examination!");

______________;

______________;

setLayout(new BorderLayout());

add(jtp,"Center");

}

public static void main(String args[]){

ex8_2 obi8_2=new ex8_2();

String str= obj8_2.getClass().toString();

if(str.indexOf("class") != -1)

str = str.substring(6);

JFrame. frm = new JFrame(str);

frm.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent we) {

System.exit(O);

}

});

frm.getContentPane () .add(obj8_2);

frm.setSize(300, 200);

frm.setVisible(true);

}

}


相关考题:

请完成下列Java程序。程序的功能是利用迭代法求一个数的平方根(求平方根的迭代公式为:Xn+1=1/2(Xn+a/Xn)).注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。public class PingFangGen{public static void main(String args[]){System. out. println(Math, sqrt(2.0));}static double sqrt(______){double x=1.0do{_______}while( Math. abs(x*x-a)/a>le-6)return x;}}

下列程序打包到example包,main方法调用线程类输出0~9这10个数,请填写横线处的内容。注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。______interface MyInterface{public abstract void print(int n);}class Mythread extends Thread ______ MyInterface{public void run(){for(int i = 0; i < 10; i++)this.print(i);}public void print(int n){System.out.print(n +" ");}}public class Example1_6{public static void main(String argv[]){Mythread th = new Mythread();______}}

请完成下列Java程序:建立一个String类型的数组,实现该数组的自然排序,并输出结果。该数组采用直接初始化,大小不限。(提示;使用Collations接口。)注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运行结果如下:fangliuouyangsunwllzhangimport java.util.*;public class ex5_2{public static void main(String[]args) {Vector vName=new Vector();String[]strName={"zhang","sun","wu","liu","fang","ouyang"};for(int i=0;i<strName.length;i++){________;________;}for(int j=0;j<vName.size();i++){System.out.println(vName.get(j));}}}

请完成下列Java程序。程序的执行结果是生成一个具有一个按钮的窗体,并且按钮的标签是“欢迎参加全国计算机等级考试—Java部分!”字样。注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。import java.awt.*;import java.awt.event.*;public class TestActionEvent{public static void main(String args[]){Frame. f=new Frame("Test");Button b=new Button("欢迎参加Java考试!");TestListener testmonitor=new TestListener();Monitor bh=new Monitor();b.addActionListener(bh);f.addwindowListener(testmonitor);f.add(b);f.setSize(150,100);f.setVisible(true);}}class Monitor ___________ ActionListener{public void actionPerformed(ActionEvent e){System.out.println("a button has been pressed");}}class TestListener__________WindowAdapter{public void windowClosing(WindowEvent e){System.exit(1);}}

下面的程序的功能是简单的进行键盘输入测试,请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。____________________public class TestKeyBoardInPut{public static void main(String[] args){String yourname=JOptionPane. ____________________ ("What is your name?");System.out.println("Hello"+yourname);____________________.exit(0);}}

请完成下列Java程序。实例listener是监听器,frm是事件源,fr上发生的事件委托tat进行处理。程序的执行结果是显示一个蓝色的窗口,单击关闭按钮,可关闭窗口。注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。源程序文件代码清单如下:import java.awt.*;import java.awt.event.*;public class BlueWindow{public static void main(String args[]){Frame. frm=new Frame. ("欢迎参加Java考试!");TheAdapterTest listener=new TheAdapterTest();frm. ______;frm.setSize(200,200);frm.setBackground(Color.blue);frm. ______;}}class TheAdapterTest extends WindowAdapter{public void windowClosing(WindowEvent e){System.exit(1);}}

请完成下列Java程序。程序的输出结果:a=6,b=5。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运行结果如下:public class ex38_2{public static void main(String args[]){int a=5,b=6;a=_________;b=a-b;a=_________;System.out.println("a="+a+"\tb="+b);}}

Java中的____类使用来创建标签的,即它的一个实例就是一个标签。

设计一个简单留言程序,当输入留言信息并单击“提交”按钮时,在提交按钮下方的label标签处,显示留言人昵称、留言内容和提交时间。