一、填空题
1.定义Bean的类称为JavaBean组件或Bean组件,简称为组件。
2.JavaBean必须实现接口java.io.Serializable或java.io.Externalizable。
3.类Component是所有UI组件和容器的根类。
4.方法repaint定义在类Component中,调用repaint方法会引起paintComponent方法
的调用。
5.对字符串进行操作时经常使用trim方法,该方法的作用是删除字符串两端的空格。
6.Java提供了五个实现菜单的类:JMenuBar、JMenu、JMenuItem、JCheckBoxMenuItem
和JRadioButtonMenuItem。
7.使用方法addSeparator()可以在菜单中添加一条分割线。
8.JCheckBoxMenuItm是JMenuItem的子类,它在JMenuItem上添加一个布尔状态,
该状态为真时,该项前显示对号。
9.设置按钮上文本的方法名是____setText_________,获取按钮上文本的方法名是_getText_。
9.设置文本域上文本的方法名是setText__,获取文本域上文本的方法名是
_getText___,设置文本域可编辑属性的方法名是__setEditable____。
二、单项选择题
1.JLabel继承了Jcomponent的所有属性,并具有Jbutton类的许多属性,下列不属于
JLabel的属性的是(A)。
A rows
B text
C icon
D horizontalAlign
2.javax.swing.ImageIcon是javax.swing.Icon的(B)。
A抽象类 B 子类 C 父类 D 基类
三、判断题
1.TextField和TextArea是用来接受用户输入的组件,但是也可以由程序控制使用户不能在
其中输入信息。
2.用hide()或setV isible(false)方法可以使组件隐藏不可见,但是一旦隐藏便不能恢复显示。
3.一个Button对象,可以调用方法getLabel()获取其上的标签,从而判断是哪个按钮;Label
也使用相同的方法。
4.使用BorderLayout的容器最多只能放置5个组件,如果要放置更多的组件,则需要使用
多层容器。
5.使用GridLayout布局策略的容器中,所有的组件都有相同大小。
答案:
1.对
2.错,可以恢复
3.后半句错
4.对
5..对
四、编程题
1. 请编写一个Application,其功能为:在窗口上摆放两个标签。构造第一个标签时,令其上面的文本信息为“我将参加Java程序设计考试。”,将第二个标签构造为空标签。程序将第一个标签的信息复制到第二个标签上,并增加信息“希望自己考取好成绩。”。要求第一个标签以红色为背景,绿色为前景;第二个标签以绿色为背景,蓝色为前景。
(知识点考察:定义标签,设置标签文本值和背景颜色)
@程序
import java.awt.*;
import javax.swing.*;
class MyFrame extends JFrame
{
JLabel p1=new JLabel("我将参加Java程序设计考试。");
JLabel p2=new JLabel(" ");
public MyFrame()
{
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(p1);
this.getContentPane().add(p2);
p2.setText(p1.getText( )+ "希望自己考取好成绩。");
p1.setBackground(Color. red);
p1.setForeground(Color.green);
p2.setBackground(Color. green);
p2.setForeground(Color.blue);
}
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
myFrame.setTitle("Show");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setSize(250,250);
myFrame.setV isible(true);
}
}
2. 请编写一个Application实现如下功能:定义一个用于给出提示信息的标签和两个文本框,其中,一个文本框用于获取用户给出的一个整数,求该数的平方后将计算结果置在另一个文本框中输出。
(知识点考察:定义标签和文本框,数值型数据与字符串西相互转换)
@程序
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class MyFrame extends JFrame implements ActionListener
{
JLabel p;
JTextField in,out;
int x;
String str=" ";
public MyFrame()
{
p=new JLabel("请输入一个整数: ");
in=new JTextField(18);
out=new JTextField(18);
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(p);
this.getContentPane().add(in);
this.getContentPane().add(out);
in.addActionListener(this);
}
public void actionPerformed(ActionEvent evt)
{
x=Integer.parseInt(in.getText());
str=x+" 的平方为: "+(long)(x*x);
out.setText(str);
}
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
myFrame.setTitle("Show");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setSize(250,250);
myFrame.setV isible(true);
}
}
3. 请编写一个Application实现如下功能:定义三个文本框。其中,第一个文本框上面的文本信息为“请输入口令:”;第二个文本框为口令输入域;第三个文本框上的信息由程序设置:若口令(假设口令为字符串”MyKey”)正确,则设置为“通过!”,否则设置为“口令错!”;。(知识点考察:定义文本框,设置和获取文本框的文本值)
@程序
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class MyFrame extends JFrame implements ActionListener
{
JTextField p;
JTextField in;
JTextField out;
String s="";
public MyFrame()
{
p=new JTextField ("请输入口令: ");
in=new JTextField(18);
out=new JTextField(18);
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(p);
this.getContentPane().add(in);
this.getContentPane().add(out);
in.addActionListener(this);
}
public void actionPerformed(ActionEvent evt)
{
s=in.getText();
if(s.equals("MyKey"))
out.setText("通过!");
else
out.setText("口令错!");
}
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
myFrame.setTitle("Show");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setSize(250,250);
myFrame.setV isible(true);
}
}
4. 编写Application, 其中包含两个按钮b1、b2,初始时b1的前景为兰色,b2的前景为红色,它们的标签分别为”兰按钮”、”红按钮”。无论哪个按钮被点击,都将该按钮上的标记改为“已按过”,并使该按钮变灰。
(知识点考察:定义并设置按钮的前景色和背景色,点击按钮触发事件处理过程)
@程序
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class MyFrame extends JFrame implements ActionListener
{
int i;
JButton b1,b2;
public MyFrame()
{
b1=new JButton("兰按钮");
b2=new JButton("红按钮");
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(b1);
b1.setForeground(Color.blue);
this.getContentPane().add(b2);
b2.setForeground(Color.red);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==b1)
{
b1.setText("已按过");
b1.setForeground(Color.gray);
}
if(e.getSource()==b2)
{
b2.setText("已按过");
b2.setForeground(Color.gray);
}
}
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
myFrame.setTitle("Show");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setSize(250,250);
myFrame.setV isible(true);
}
}
5. 请编写一个Applicaion,其功能为:在其窗口中摆放三个单选按钮,令它们的标签分别为“选项1”、“选项2”、“选项3”,初始时,所有按钮均可见;以后,如果某个单选按钮被选中了,就通过消息对话框显示它被选中的信息(如,若点击了第二个单选按钮,则显示“你选择了”选项2””),并使该单选按钮自身不可见,而使其它单选按钮变为可见的。
(知识点考察:定义单选按钮和消息提示框,点击按钮触发事件处理过程,修改提示框的visible属性)
@程序
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class MyFrame extends JFrame implements ActionListener
{
ButtonGroup optGroup;
JRadioButton opt1,opt2,opt3;
String s="";
boolean b=false;
public MyFrame()
{
optGroup=new ButtonGroup( );
opt1=new JRadioButton("选项1");
opt2=new JRadioButton("选项2");
opt3=new JRadioButton("选项3");
optGroup.add(opt1);
optGroup.add(opt2);
optGroup.add(opt3);
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(opt1);
this.getContentPane().add(opt2);
this.getContentPane().add(opt3);
opt1.addActionListener(this);
opt2.addActionListener(this);
opt3.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==opt1)
{
JOptionPane.showMessageDialog(this,"你选择了选项1");
opt1.setV isible(false);
opt2.setV isible(true);
opt3.setV isible(true);
}
if(e.getSource()==opt2)
{
JOptionPane.showMessageDialog(this,"你选择了选项2");
opt1.setV isible(true);
opt2.setV isible(false);
opt3.setV isible(true);
}
if(e.getSource()==opt3)
{
JOptionPane.showMessageDialog(this,"你选择了选项3");
opt1.setV isible(true);
opt2.setV isible(true);
opt3.setV isible(false);
}
}
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
myFrame.setTitle("Show");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setSize(250,250);
myFrame.setV isible(true);
}
}
7. 请编写一个Applet,在其窗口中摆放两复选按钮框,通过一个文本域显示它们被选中(那个被选中、或两个均被选中、或两个均未选中)的信息。
(知识点考察:定义复选按钮,点击按钮触发事件处理过程)
@程序
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class MyFrame extends JFrame implements ItemListener
{
private JTextField t;
private JCheckBox opt1,opt2;
public MyFrame()
{
t=new JTextField(20);
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(t);
opt1=new JCheckBox("选项1");
this.getContentPane().add(opt1);
opt1.addItemListener(this);
opt2=new JCheckBox("选项2");
this.getContentPane().add(opt2);
opt2.addItemListener(this);
}
public void itemStateChanged(ItemEvent e)
{
String s="";
if(opt1.isSelected())
s="选择了选项1";
if(opt2.isSelected())
s=s+"选择了选项2";
t.setText(s);
}
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
myFrame.setTitle("Show");
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setSize(250,250);
myFrame.setV isible(true);
}
}
8. 程序在画板中显示一条信息,并利用两个按钮up和down上下移动该信息。程序输出结果如下图所示。
(知识点考察:点击按钮触发事件处理过程,注册监听器)
答案:
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.*;
public class ButtonDemo extends JFrame
implements ActionListener
{
// Declare a panel for displaying message
private MessagePanel messagePanel;
// Declare two buttons to move the message left and right
private JButton jbtUp, jbtDown;
// Main method
public static void main(String[] args)
{
ButtonDemo frame = new ButtonDemo();
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setV isible(true);
}
public ButtonDemo()
{
setTitle("Button Demo");
// Create a MessagePanel instance and set colors
messagePanel = new MessagePanel("Welcome to Java");
messagePanel.setBackground(Color.yellow);
// Create Panel jpButtons to hold two Buttons "<=" and "right =>" JPanel jpButtons = new JPanel();
jpButtons.setLayout(new FlowLayout());
jpButtons.add(jbtUp = new JButton());
jpButtons.add(jbtDown = new JButton());
// Set button text
jbtUp.setText("Up");
jbtDown.setText("Down");
// Set keyboard mnemonics
jbtUp.setMnemonic('U');
jbtDown.setMnemonic('D');
// Set icons
//jbtUp.setIcon(new ImageIcon("images/left.gif"));
//jbtDown.setIcon(new ImageIcon("images/right.gif"));
// Set toolTipText on the "Up" and "Down" buttons
jbtUp.setToolTipText("Move message to Up");
jbtDown.setToolTipText("Move message to Down");
// Place panels in the frame
getContentPane().setLayout(new BorderLayout()); getContentPane().add(messagePanel, BorderLayout.CENTER); getContentPane().add(jpButtons, BorderLayout.SOUTH);
// Register listeners with the buttons
jbtUp.addActionListener(this);
jbtDown.addActionListener(this);
}
// Handle button events
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == jbtUp)
{
up();
}
else if (e.getSource() == jbtDown)
{
down();
}
// Move the message in the panel left
private void up()
{
int y = messagePanel.getYCoordinate();
if (y > 10)
{
// Shift the message to the left
messagePanel.setYCoordinate(y-10);
messagePanel.repaint();
}
}
// Move the message in the panel right
private void down()
{
int y = messagePanel.getYCoordinate();
if (y < getSize().width - 120)
{
// Shift the message to the right
messagePanel.setYCoordinate(y+10);
messagePanel.repaint();
}
}
}
9 .使用文本区和滚动条技术相结合显示一段字符串,程序输出结果如下图所示。
(知识点考察:定义文本区,设置滚动条)
答案:import java.awt.*;
import javax.swing.*;
public class TextAreaDemo extends JFrame
private DescriptionPanel descriptionPanel = new DescriptionPanel();
public static void main(String[] args)
{
TextAreaDemo frame = new TextAreaDemo();
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Text Area Demo");
frame.setV isible(true);
}
public TextAreaDemo()
{
String description = "Task scheduling is of great significance to "+
"shorten performing time and minimize the cost for computational" +
"Grid. A grid task schedule algorithm is presented in this paper, "+
"which is based on a constraint satisfaction neural network. The "+
"constraint satisfaction means to remove the violations for sequence"+
" and resource constraints during scheduling subtasks for grid "+
"environment. The data-transferring costs among subtasks are also"+
" considered in our task scheduling. The simulation in this paper"+
" has shown that the task schedule algorithm is efficient with respect"+ " to the quality of solutions and the solving speed." ;
descriptionPanel.setTextDescription(description);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(descriptionPanel, BorderLayout.CENTER);
}
}
class DescriptionPanel extends JPanel
{
private JTextArea jtaTextDescription;
public DescriptionPanel()
{
JScrollPane scrollPane = new JScrollPane
(jtaTextDescription = new JTextArea());
jtaTextDescription.setFont(new Font("Serif", Font.PLAIN, 14));
jtaTextDescription.setLineWrap(true);
jtaTextDescription.setWrapStyleWord(true);
scrollPane.setPreferredSize(new Dimension(200, 100));
setLayout(new BorderLayout());
add(scrollPane, BorderLayout.CENTER);
}
public void setTextDescription(String text)
{
jtaTextDescription.setText(text);
}
}
10. 编写一个程序,包含4个button,各代表正方形,矩形,圆和椭圆,如下图所示。
(知识点考察:按钮触发事件过程,绘制正方形、矩形、圆和椭圆)
答案:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TextFieldDemo extends JFrame implements ActionListener
{
private JButton jbtSquare,jbtRectangle,jbtCircle,jbtOvel; // Declare "Add" button
FigurePanel p1 = new FigurePanel(1);
public static void main(String[] args)
{
TextFieldDemo frame = new TextFieldDemo();
frame.setSize(400,300);
frame.setV isible(true);
}
public TextFieldDemo()
{
setTitle("TextFieldDemo");
setBackground(Color.yellow);
setForeground(Color.black);
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout());
p2.add(jbtSquare = new JButton("Square"));
p2.add(jbtRectangle = new JButton("Rectangle")); p2.add(jbtCircle = new JButton("Circle"));
p2.add(jbtOvel = new JButton("Ovel"));
getContentPane().setLayout(new BorderLayout()); getContentPane().add(p1, BorderLayout.CENTER); getContentPane().add(p2, BorderLayout.SOUTH);
jbtSquare.addActionListener(this); jbtRectangle.addActionListener(this);
jbtCircle.addActionListener(this);
jbtOvel.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == jbtSquare)
{
p1.setFigure(1);
p1.repaint();
}
if (e.getSource() == jbtRectangle)
{
p1.setFigure(2);
p1.repaint();
}
if (e.getSource() == jbtCircle)
{
p1.setFigure(3);
p1.repaint();
}
if (e.getSource() == jbtOvel)
{
p1.setFigure(4);
p1.repaint();
}
}
}
class FigurePanel extends JPanel
{
final static int SQUARE = 1;
final static int RECTANGLE = 2;
final static int CIRCLE = 3;
final static int OV AL = 4;
private int figureType = 1;
// Constructing a figure panel
public FigurePanel(int figureType)
{
this.figureType = figureType;
}
public void setFigure(int figureType)
{
this.figureType = figureType;
}
// Drawing a figure on the panel
public void paintComponent(Graphics g)
{
super.paintComponent(g);
// Get the appropriate size for the figure
int width = getSize().width;
int height = getSize().height;
int side = (int)(0.80*Math.min(width, height));
switch (figureType)
{
case 1:
g.drawRect((width-side)/2, (height-side)/2, side, side);
break;
case 2:
g.drawRect((int)(0.1*width), (int)(0.1*height),
(int)(0.8*width), (int)(0.8*height));
break;
case 3:
g.drawOval((width-side)/2, (height-side)/2, side, side);
break;
case 4:
g.drawOval((int)(0.1*width), (int)(0.1*height),
(int)(0.8*width), (int)(0.8*height));
break;
}
}
}
11.请编程实现本界面:
同时,利用事件处理机制实现功能:当点击图中的下拉列表框时,将会在下面的文本框中显示当前选项。
(知识点考察:定制下拉列表框,点击下拉列表触发事件发生)
答案:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class ShowChoose extends JFrame implements ItemListener
{
JComboBox jcb;
JTextField jtf;
JLabel l1,l2;
ShowChoose()
{
l1=new JLabel("请选择您的学校:");
l2=new JLabel("您的选择是:");
jtf=new JTextField(10);
String[] school={"清华大学","北京大学","大连理工","东软信息学院"};
jcb=new JComboBox(school);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(l1);
getContentPane().add(jcb);
getContentPane().add(l2);
getContentPane().add(jtf);
jcb.addItemListener(this);
setSize(300,200);
setVisible(true);
}
public void itemStateChanged(ItemEvent e)
{
jtf.setText((String)(jcb.getSelectedItem()));
}
public static void main(String[] args)
{
ShowChoose sc=new ShowChoose();
}
}
12.下图中的框架采用BorderLayout布局,中间放置一个面板,南面放置一个按钮,当点击按钮时,面板的背景色随机变换,请编程实现该程序。
(知识点考察:BorderLayout布局管理器,按钮触发事件处理器,面板背景色的设置)
答案:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class ChangeColor extends JFrame implements ActionListener
{
JButton jbtChange;
JPanel p;
ChangeColor()
{
jbtChange=new JButton("改变颜色");
p=new JPanel();
getContentPane().add(p);
getContentPane().add(jbtChange,BorderLayout.SOUTH);
setSize(150,200);
setVisible(true);
jbtChange.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
p.setBackground(new
Color((int)(Math.random()*256),(int)(Math.random()*256),(int)(Math.random()*256)));
}
public static void main(String[] args)
{
ChangeColor c=new ChangeColor();
}
}
13.请编程实现一个乘法器,两个操作数和计算结果用文本框表示,当用户在操作数文本框中输入整型数字后,点击“=”按钮就能够在结果文本框中看到乘法运算的结果。如下图所示:
(知识点考察:定义文本框,整型与字符串类型的相互转换,设置文本框文本值)
答案:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Mul extends JFrame implements ActionListener
{
JTextField jnum1,jnum2,jresult;
JLabel lb;
JButton jbtMul;
Mul()
{
jnum1=new JTextField(6);
jnum2=new JTextField(6);
jresult=new JTextField(6);
jresult.setEditable(false);
lb=new JLabel(" * ");
jbtMul=new JButton(" = ");
getContentPane().setLayout(new FlowLayout());
getContentPane().add(jnum1);
getContentPane().add(lb);
getContentPane().add(jnum2);
getContentPane().add(jbtMul);
getContentPane().add(jresult);
jresult.addActionListener(this);
setSize(380,150);
setVisible(true);
jbtMul.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
int i=Integer.parseInt(jnum1.getText())*Integer.parseInt(jnum2.getText());
jresult.setText(i+"");
}
public static void main(String[] args)
{
Mul m=new Mul();
}
}
14.编写一个图形界面应用程序,其中包含一个文本框JtextField。在文本框中输入内容后弹出一个JoptionPane消息对话框,对话框的显示内容为文本框中的内容。
(知识点考察:定义文本框,使用消息文本框显示信息)
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JOptionPaneExample extends JPanel{
JTextField text;
JOptionPaneExample(){
text=new JTextField(30);
text.selectAll();
text.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
text.selectAll();
JOptionPane.showMessageDialog(null,text.getText());
}
});
this.add(text);
}
public static void main(String[] args){
JFrame frame=new JFrame("JOptionPane Example");
frame.addWindowListener(new CloseWindow());
frame.getContentPane().add(new JOptionPaneExample());
frame.pack();
frame.setV isible(true);
}
}
class CloseWindow extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
15.编写一个图形界面应用程序,当用户每单击一下按钮时,一个标签对象的前景颜色随即发生一次变化。
(知识点考察:点击按钮触发事件发生,修改标签前景色)
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class SetColor extends JPanel{
JButton button;
JLabel label;
SetColor(){
label=new JLabel("Hello World!");
this.add(label);
button=new JButton("SetColor");
button.addActionListener(new ButtonAction());
this.add(button);
}
class ButtonAction implements ActionListener{
public void actionPerformed(ActionEvent evt){
Random d=new Random();
int red,green,blue;
red=Math.abs(d.nextInt())%255;
green=Math.abs(d.nextInt())%255;
blue=Math.abs(d.nextInt())%255;
Color c=new Color(red,green,blue);
label.setForeground(c);
}
}
public static void main(String[] args){
JFrame frame=new JFrame("set ForegroundColor");
frame.addWindowListener(new CloseWindow());
frame.getContentPane().add(new SetColor());
frame.setSize(40,50);
frame.pack();
frame.setV isible(true);
}
}
class CloseWindow extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
16.编写一个图形界面应用程序,其中包括3个横向的Scrollbar和1个Jlabel对象。3个滚动条分别用来调整红、绿、蓝3种颜色的比例,当用户拖动滑块调整三色比例时,相应调整JLabel的前景色。
(知识点考察:定义Scrollbar和JLabe对象,设置标签前景色)
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ScrollbarExample extends JPanel{
Scrollbar jsred;
Scrollbar jsgreen;
Scrollbar jsblue;
JLabel label;
ScrollbarExample(){
label=new JLabel("How are you?");
jsred=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,255);
jsred.setUnitIncrement(1);
jsred.setBlockIncrement(1);
jsred.addAdjustmentListener(new ScrollbarListener());
jsgreen=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,255);
jsgreen.setUnitIncrement(1);
jsgreen.setBlockIncrement(1);
jsgreen.addAdjustmentListener(new ScrollbarListener());
jsblue=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,255);
jsblue.setUnitIncrement(1);
jsblue.setBlockIncrement(1);
jsblue.addAdjustmentListener(new ScrollbarListener());
this.setLayout(new GridLayout(0,1));
this.add(jsred);
this.add(jsgreen);
this.add(jsblue);
this.add(label);
}
class ScrollbarListener implements AdjustmentListener{
public void adjustmentV alueChanged(AdjustmentEvent e){ int red=jsred.getV alue();
int green=jsgreen.getV alue();
int blue=jsblue.getV alue();
Color fg=new Color(red,green,blue);
label.setForeground(fg);
}
}
public static void main(String[] args){
JFrame frame=new JFrame("Scrollbar Example");
frame.addWindowListener(new CloseWindow());
frame.getContentPane().add(new ScrollbarExample());
frame.pack();
frame.setV isible(true);
}
}
class CloseWindow extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
《高数》试卷1(上) 一.选择题(将答案代号填入括号内,每题3分,共30分). 1.下列各组函数中,是相同的函数的是( ). (A )()()2ln 2ln f x x g x x == 和 (B )()||f x x = 和 ()2g x x = (C )()f x x = 和 ()() 2 g x x = (D )()|| x f x x = 和 ()g x =1 2.函数()()sin 42 0ln 10x x f x x a x ?+-≠? =+?? =? 在0x =处连续,则a =( ). (A )0 (B )1 4 (C )1 (D )2 3.曲线ln y x x =的平行于直线10x y -+=的切线方程为( ). (A )1y x =- (B )(1)y x =-+ (C )()()ln 11y x x =-- (D )y x = 4.设函数()||f x x =,则函数在点0x =处( ). (A )连续且可导 (B )连续且可微 (C )连续不可导 (D )不连续不可微 5.点0x =是函数4 y x =的( ). (A )驻点但非极值点 (B )拐点 (C )驻点且是拐点 (D )驻点且是极值点 6.曲线1 || y x = 的渐近线情况是( ). (A )只有水平渐近线 (B )只有垂直渐近线 (C )既有水平渐近线又有垂直渐近线 (D )既无水平渐近线又无垂直渐近线 7. 211 f dx x x ??' ???? 的结果是( ). (A )1f C x ?? -+ ??? (B )1f C x ?? --+ ??? (C )1f C x ?? + ??? (D )1f C x ?? -+ ??? 8. x x dx e e -+?的结果是( ). (A )arctan x e C + (B )arctan x e C -+ (C )x x e e C --+ ( D )ln()x x e e C -++ 9.下列定积分为零的是( ).
I A T F内审员试题及答案 This manuscript was revised on November 28, 2020
部门: ____姓名: 得分:___________ 一.单选题( 103=30分) :2016适用于( E )组织的现场。 A.生产件 B.服务件 C.售后市场零件 D.配件 +b+d +b+c+d :2016允许删减( D )。 产品和服务的要求 B.产品和服务的设计和开发顾客和供方的财产 D.以上都不对 TS16949:2009认证证书的失效日期是( C ) 年10月1日年12月31日年09月14日年09月14日 4.过程方法采用( F )管理过程和整个体系。 A.持续改进循环 C.系统管理方法 D.基于风险的思维 +b+c+d +d 5.内部审核员应当了解( D )。 A.汽车行业的过程方法审核 B.适用的顾客特殊要求和IATF16949适用的要求 +b+c 6.组织应明确的社会责任有( D )。 A.反贿赂方针 B.员工行为准则 C.道德准则 +b+c 文件应保存的时间是( C )。 A.三年 B.当年加一个日历年 C.产品的有效期加一个日历年 D.按认证机构的要求 8.可疑产品包括( D ) : A.没有标识的产品; B. 标识不明的产品; C. 用偏离校准状态的仪器检验的产品; +b+c 9.公司生产的不合格品的处理方式有( D ) : A.返工/返修; B. 拒收和报废; C.让步和降级改作它用; +b+c 10.产品的控制计划的类型包括( E ): A.样件 B.返工 C.量产 D.试产 +c+d 二.判断题. (对. 错. 10 x 3=30分) 1. ( ) 组织应确定需要应对的风险和机遇,以确保质量管理体系满足预期结果。 2. ( ) 内部审核须依据年度审核计划安排,对于有早晚班的公司审核可以只审核一个班次来代替。 3.( ) 公司定期的设备保养计划就是设备预见性的维护计划。 4.()关键设备就是指公司的贵重设备,并要进行现场标识与识别其易损配件进行管制。 5.()对公司没有设计责任的产品,可不进行可行性评审。 6.()为解决质量问题,质量人员都有权停止生产。 7.()IATF16949中的“应”表示要求,而“宜”表示建议。 8.()组织没有产品设计责任时,删减条款是可以的。 9.()当过程能力不足且不稳定时实施持续改进。 10.()从顾客指定的供货来源采购产品,其质量责任在于顾客。 三简答题:( 35=15分) 1.请说明哪几个方面需要实施“多方论证” 答:项目管理、供方选择、开发和确定特殊特性、工厂设施和设备的策划、制造可行性。
第九章 习题与参考答案 9-1 建筑物的外抢以10cm 厚的普通砖和2.5㎝厚的玻璃纤维制成 (普通砖的m W /.6901=λ℃,玻璃纤维的m W /.0502=λ℃)求当温差为45℃时的传热通量。 答:69.77W/㎡ 9-2 铜板厚4㎝,其一面的温度为175℃,另一面以1.5㎝厚的玻 璃纤维覆盖,且温度为80℃,假设经由此组合流出的热量为 300W ,求截面积的大小。 m W /375=铜λ℃,m W /.0480=纤维λ℃。 答:0.9872㎡ 9-3 墙以 2.0㎝厚的铜(m W /3781=λ℃)、3.0㎜厚的石棉 (m W /.6602=λ℃)和6.0㎝厚玻璃纤维(m W /.04803=λ℃)组合而成,若两面的温差为500℃,求单位面积的导热量。 答:394.32W/㎡ 9-4 墙由不锈钢(m W /16=λ℃)4.0㎜厚,两边包着塑料层所组 成,总导热系数120W/㎡℃,假如墙的外界总温差60℃,计算不锈钢两边的温差。 答: 1816 0040120160=ΔΔ=T T 得:.℃ 9-5 一热蒸汽管, 内表面温度300℃,内直径8㎝,管厚5.5mm ,包覆9㎝的绝缘层(m W /501=λ℃) ,再覆盖4cm 厚的绝缘层(m W /.3502=λ℃),最外层绝缘温度30℃,假设管子的m W /473=λ℃,计算每米长的热损失。 答:448.81W/m
9-6 一屋子的墙壁用2层1.2㎝的的纤维热板(m W /.04801=λ℃)1层8.0㎝的石棉(m W /.15602=λ℃)及1层10cm 普通砖(m W /.6903=λ℃)制作,假设两侧的α均为15W/㎡℃,试计算总传热系数。 答:0.774W/㎡℃ 9-7 墙由1㎜厚的钢(m W /3841=λ℃) ,4㎜厚的1%含C 量的钢(m W /432=λ℃),1㎝厚的石棉帛(m W /.16603=λ℃)和10㎝厚的玻璃纤维板(m W /.04804=λ℃)组成, 试求其热阻?若两面温度分别为10℃和150℃, 求其各材料之间的温度? 答: 0832.=∑R ℃㎡/W ,99981491.=T ℃,99361492.=T ℃,93331493.=T ℃ 9-8半无限大水泥地坪,初试温度为50℃,导温系数为8.33× 10-7㎡/s ,若表面温度突然降到0℃,试求距表面20㎜深处温度下降到25℃所需时间。 答:521s 9-9 一块厚20mm 的钢板(m W /45=λ℃, )加热到500℃后置于空气中冷却,设冷却过程中钢板两侧面的平均换热系数℃,试确定使钢板冷却到与空气相差10℃时所需的时间。 s m a /.2510371?×=235m W /=α 答:3633s 9-10 一块厚300mm 的板状钢坯(含C=0.5%) ,初温为20℃,送入温度为1200℃的炉子里单侧加热,不受热侧可近似
习题 1. 在HTML中,