网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

请完成下列Java程序:用一个边框布局来安排一个工具栏和一个卡片布局。工具栏可浮动,包括两个按钮,一个向前一个向后控制卡片的显示;卡片布局包括3张卡片,分别标识为card1、card2、card3。

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

源程序代码文件清单如下:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.border.LineBorder;

public class ex20_2

{

private static CardLayout cl=new CardLayout();

private static JPanel cp=new JPanel();

public static void main(String args[])

{

JFrame. jf=new JFrame();

jf.setTitle("ex20_2");

Container c=jf.getContentPane();

JToolBar jtb=new JToolBar();

JButton btnNext=new JButton(new Imagelcon("next.gif"));

JButton btnPre=new JButton(new ImageIcon("back.gif"));

jtb.add(btnPre);

jtb.add(btnNext);

cp.setLayout(c1);

Dimension dim=new Dimension(150,80);

cp.setPreferredSize(dim);

cp.setBorder(new LineBorder(Color.BLACK));

cp.add(new JLabel("card1",JLabel.CENTER),"card1");

cp.add(new JLabel("card2",JLabel.CENTER),"card2");

cp.add(new JLabel("card3",JLabel.CENTER),"card3");

c.add(jtb,BorderLayout.NORTH);

c.add(cp,BorderLayout.CENTER);

ActionListener al=new ActionResponse();

______;

______;

if.addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent we)

{

System.exit(0);

}

});

jf.pack();

jf.setVisible(true);

}

static class ActionResponse implements ActionListener

{

public void actionPerformed(ActionEvent ae)

{

if(ae.getActionCommand().equals("next"))

c1.next(cp);

else

c1.previous(cp);

}

}

}


参考答案

更多 “ 请完成下列Java程序:用一个边框布局来安排一个工具栏和一个卡片布局。工具栏可浮动,包括两个按钮,一个向前一个向后控制卡片的显示;卡片布局包括3张卡片,分别标识为card1、card2、card3。注意;请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。源程序代码文件清单如下:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.LineBorder;public class ex20_2{private static CardLayout cl=new CardLayout();private static JPanel cp=new JPanel();public static void main(String args[]){JFrame. jf=new JFrame();jf.setTitle("ex20_2");Container c=jf.getContentPane();JToolBar jtb=new JToolBar();JButton btnNext=new JButton(new Imagelcon("next.gif"));JButton btnPre=new JButton(new ImageIcon("back.gif"));jtb.add(btnPre);jtb.add(btnNext);cp.setLayout(c1);Dimension dim=new Dimension(150,80);cp.setPreferredSize(dim);cp.setBorder(new LineBorder(Color.BLACK));cp.add(new JLabel("card1",JLabel.CENTER),"card1");cp.add(new JLabel("card2",JLabel.CENTER),"card2");cp.add(new JLabel("card3",JLabel.CENTER),"card3");c.add(jtb,BorderLayout.NORTH);c.add(cp,BorderLayout.CENTER);ActionListener al=new ActionResponse();______;______;if.addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent we){System.exit(0);}});jf.pack();jf.setVisible(true);}static class ActionResponse implements ActionListener{public void actionPerformed(ActionEvent ae){if(ae.getActionCommand().equals("next"))c1.next(cp);elsec1.previous(cp);}}} ” 相关考题
考题 在表格中添任意斜线,可用()绘制。A、“表格和边框”工具栏中的“绘制表格”按钮B、“格式工具栏”中的“直线”按钮C、“绘图工具栏”中的“直线”按钮D、“表格和边框”工具栏中的“直接”按钮

考题 “打开”和“保存”按钮是在哪一个工具栏上()。A.“CAD标准”工具栏B.“标准”工具栏C.“布局”工具栏D.“UCS”工具栏

考题 利用“绘图”工具栏,请在幻灯片中画一个矩形,将其边框用虚线显示。

考题 在Excel使用“常用”工具栏中的“()”按钮,可创建一个图表。 A、地图B、图表向导C、绘图D、Web工具栏

考题 在VB集成环境中要结束一个正在运行的工程,可单击工具栏上的一个按钮,这个按钮是( )

考题 请完成下列Java程序:用一个边框布局来安排一个工具栏和一个卡片布局。工具栏可浮动,包括2个按钮,一个向前一个向后控制卡片的显示;卡片布局包括3张卡片,分别标识为card1,card2,card3。注意;请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运行结果如下:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border. LineBorder;public class ex24_2{private static CardLayout cl=new CardLayout();private static JPanel cp=new JPanel();public static void main(String[] args){JFrame. if=new JFrame();jf.setTitle("ex24_2");Container c=jf.getContentPane();JToolBar jtb=new JToolBar();JButton btnNext=new JButton(new ImageIcon("next.gif"));JButton btnPre=new JButton(new ImageIcon("back.gif"));jtb.add(btnPre);jtb.add(btnNext);cp.setLayout(cl);Dimension dim=new Dimension(150,80);cp.setPreferredSize(dim);cp.setBorder(new LineBorder(Color. BLACK));cp.add(new JLabel("cardl",JLabel.CENTER),"card1");cp.add(new JLabel("card2",JLabel.CENTER),"card2");cp.add(new JLabel("card3",JLabel.CENTER),"card3");c.add(jtb,BorderLayout.NORTH);c.add(cp,BorderLayout.CENTER);ActionListener al=new ActionResponse();____________________________________;____________________________________;jf.addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent we){System.exit(0);}});jf.pack();jf.setVisible(true);}static class ActionResponse implements ActionListener{public void actionPerformed(ActionEvent ae){if(ae.getActionCommand().equals("next"))cl.next(cp);elsecl.previous(cp);}}}

考题 ( 11 )在 VB 集成环境中要结束一个正在运行的工程 , 可单击工具栏上的一个按钮,这个按钮是

考题 “打开”和“保存”按钮是在哪一个工具栏上?A.“CAD”标准工具栏B.“标准”工具栏C.“布局”工具栏D.“UCS”工具栏

考题 “打开”和“保存”按钮是在哪个工具栏上的?A.“CAD”标准工具栏B."布局"工具栏C."标准"工具栏D."UCS"工具栏