本题的功能是通过按钮来选择窗口显示的风格。窗口中有三个按钮:“Metal”、“Mot

题型:填空题

问题:

本题的功能是通过按钮来选择窗口显示的风格。窗口中有三个按钮:“Metal”、“Motif和“WindoWS“,单击任何一个按钮,就能将窗口的风格改变为按钮名称所对应的风格。
import java.awt*;
import java.awt.event.*;
import javax.swing.*;
class PlafPanel extends JPanel implements Actionlis-tener
public______()
metalButton=new JButton("Metal");
motifButton=new JButton("Motif");
windowsButton=new JButton("Windows");
add(metalButton);
add(motifButton);
add(windowsButton);
metalButlon.addActionListener(this);
motifButton.addActionListener(this);
windowsButton.addActionListener(this);

public void actionPerformed(ActionEvent evt)
Object source=evt.getSource();
string plaf="";
if(source==metaIButton)
pIaF="javax.swing.plaf.metal.MetalLookAncl-Feel";
else if(source==motifButton)
plaf="com.sun.java.swing.plaf.motif.Moti-fLookAndFeel";
else if(source==windowsButton)
plaf="com.sun.java.swing.plaf.windows.windowsLookAndFeel";
try
UIManager.setLookAndFeel(______);
SwingUtilities.updateComponentTreeUI(ttlis);

catch(Exception e)

private JButton metalButton;
private JButton motifButton;
private JButton windowsButton;

class PlafFrame extends JFrame
public PlafFrame()
setTitle("simple");
setSize(300,200);
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);

);
Container contentPane=getContentPane();
contentPane.add(new PlafPanel());


public class java2
public static Void main(String[]args)
JFrame frame=new PIafFrame();
frame.show();

考点:计算机等级考试JAVA二级JAVA笔试
题型:填空题

如图所示,S为平面镜前一点光源,A为平面镜前一点,现由点光源S射出一条光线,经平面镜反射后恰经过点A,试作出其光路。

题型:填空题

根尖主要靠什么结构生长[ ]

A.根冠

B.分生区

C.伸长区

D.成熟区

题型:填空题

统计分类标准只适用于周期性普查和经常性统计调查。()

题型:填空题

对地中直流偏磁严重的区域,在变压器中性点应采用相同的()。

题型:填空题

在三段论“凡金属能导电,木块不是金属,所以有些能导电的不是木块”中,小前提是()。

更多题库