单选题Given an ActionEvent, which method allows you to identify the affected Component?()A Public class getClass()B Public Object getSource()C Public Component getSource()D Public Component getTarget()E Public Component getComponent()F Public Component getTargetComponent()

单选题
Given an ActionEvent, which method allows you to identify the affected Component?()
A

 Public class getClass()

B

 Public Object getSource()

C

 Public Component getSource()

D

 Public Component getTarget()

E

 Public Component getComponent()

F

 Public Component getTargetComponent()


参考解析

解析: 暂无解析

相关考题:

Given:Which two, inserted at line 11, will allow the code to compile?() A.public class MinMax? {B.public class MinMax? extends Number {C.public class MinMaxN extends Object {D.public class MinMaxN extends Number {E.public class MinMax? extends Object {F.public class MinMaxN extends Integer {

Given:Which method will complete this class?() A.public int compareTo(Object o){/*more code here*/}B.public int compareTo(Score other){/*more code here*/}C.public int compare(Score s1,Score s2){/*more code here*/}D.public int compare(Object o1,Object o2){/*more code here*/}

Given:Which code, inserted at line 15, allows the class Sprite to compile?() A.Foo { public int bar() { return 1; }B.new Foo { public int bar() { return 1; }C.new Foo() { public int bar() { return 1; }D.new class Foo { public int bar() { return 1; }

阅读以下说明和Jrdva代码,将应填入(n)处的字句写在对应栏内。[说明]在销售系统中常常需要打印销售票据,有时需要在一般的票据基础上打印脚注。这样就需要动态地添加一些额外的职责。如下展示了Decorator(修饰)模式。SalesOrder对象使用一个SalesTicket对象打印销售票据。图6-1显示了各个类间的关系。以下是Java语言实现,能够正确编译通过。[图6-1][Java代码]//Component.java文件public (1) class Component {abstract publ ic void prtTicket();}//salesTicket.java文件public class SalesTicket extends Component{public void prtTicket(){//Sales ticket printing code hereSystem.out.printin("SalesTicket");}}//Decorator.java文件publ ic abstract class Decorator extends Component{public void prtTicket(){if(myComp!=null)myComp.prtTicket();}private (2) myComp;public Decorator(Component myC){myComp=myC;}}//Footer.java文件public class Footer extends Decorator {public Footer(Component myC){(3);}public void prtTicket(){(4);prtFooter();}publ ic void prtFooter(){//place printing footer code hereSystem.out.println("Footer");}}//salesorder.java文件public class SalesOrder{void prtTicket(){Component myST;myST=new Footer( (5) );//Print Ticket with footers as neededmyST.prtTicket();}}(1)

本题的功能是在文本域面板中添加一个带有行数的面板。窗口中有一个文本域,在文本域的左侧有一个带有数字的面板,该面板上的数字指示着文本域中的行数。import javax.swing.*;import javax.swing.event.*;import java.awt.*;public class java3 extends JFrame{public static JTextPane textPane;public static JScrollPane scrollPane;JPanel panel;public java3(){super("java3()");panel=new JPanel();panel.setLayout(new BorderLayout());panel.setBorder(BorderFactory.createEmptyBor-der(20,20,20,20));textPane=new JTextPane();textPane.setFont(new Font("monospaeed",Font.PLAIN,12));scrollPane=new JScrollPane(textPane);panel.add(scrollPane);scrollPane.setPreferredsize(new Dimension(300,250));setContentPane(panel);setCloseOperation(JFrame.EXIT_ON_CLOSE);LineNumber lineNumber=new LineNumber();scrollPane.setRowHeaderView(lineNumber);}public static void main(String[]args){java3 ttp=new java3();ttp.pack();ttp.setVisible(true);}}class LineNumber extends JTextPane{private final static Color DEFAULT_BACK-GROUND=Color.gray;private final static Color DEFAULT_FORE-GROUND=Color.black;private final static Font DEFAUl。T—FONT=newFont("monospaced",Font.PLAIN,12);private final static int HEIGHT=Integer.MAX_VALUE-1000000;private final static int MARGIN=5;private FontMetrics fontMetrics;private int lineHeight;private int currentRowWidth;private JComponent component;private int componentFontHeight;private int componentFontAscent;public LineNumber(JComponent component){if(component= =null){setBackground(DEFAULT_BACKGROUND);setForegroun"DEFAULT_FOREGROUND);setFont(DEFAULT FONT);this.component=this;}else{setBaekground(DEFAULT_BACKGROUND);setForeground(component.getForeground());setFont(component.getFont());this.component=component;}componentFontHeight=component.getFontMet-rics(component.getFont()).getHeight();componentFontAscent=component.getFontMet-ries(component.getFont()).getAscent();setPreferredWidth(9999);}public void setPreferredWidth(int row){int width=fontMetrics.stringWidth(String.val-ueOf(row));if(currentRowWidth<width){currentRowWidth=width;setPreferredSize(new Dfimension(2 * MARGIN+width,HEIGHT));}}public void setFont(Font font){super.setFont(font);fontMetrics=getFontMetrics(getFont());}public int getLineHeight(){if(hneHeight= =0)return componentFontHeight;elsereturn lineHeight;}public void setLineHeight(int lineHeight){if(hneHeight>0)this.lineHeight=lineHeight;}public int getStartOffset(){return component.getlnsets().top+component-FontAscent;}public void paintComponent(Graphics g){int lineHeight=getLineHeight();int startOffset=getStartOffset();Rectangle drawHere=g.getClipBounds();g.setColor(getBackground());g.fillRect(drawHere.x,drawHere.Y,drawHere.width,drawHere.height);g.setColor(getForeground());int startLineNumber=(drawHere.y/line-Height)+1;int endLineNUmber = startLineNumber+(drawHere.height/lineHeight);int start=(drawHere.Y/hneHeight)*line-Height+startOffset;for(int i=startLineNumber;i<=endLineN-umber;i++){String lineNumber=String.valueOf(i);int width=fontMetrics.stringWidth(lineNumber);g.drawstring(lineNumber,MARGIN+current-RowWidth-width,start);start+=lineHeight:}setPreferredWidth(endLineNumber);}}

阅读下列函数说明和C++代码,将应填入(n)处的字句写在对应栏内。[说明]在销售系统中常常需要打印销售票据,有时需要在一般的票据基础上打印脚注。这样就需要动态地添加一些额外的职责。如下展示了Decorator(修饰)模式。SalesOrder对象使用一个SalesTicket对象打印销售票据,先打印销售票据内容,然后再打印脚注。图5-1显示了各个类间的关系。以下是C++语言实现,能够正确编译通过。[图5-1][C++代码]class Component{public:(1) void prtTicket()=0;};class SalesTicket:public Component{public:void prtTicket(){cout<<"Sales Ticket!"<<endl;}};class Decorator:public Component{public:virtual void prtTicket();Decorator(Component *myC);private:(2) myComp;};Decorator::Decorator(Component *myC){myComp=myC;}void Decorator::prtTicket(){myComp->prtTicket();}class Footer:public Decorator{public:Footer(Component *myC);void prtTicket();void prtFooter();};Footer::Footer(Component *myC): (3) {}void Footer::prtFooter(){cout<<"Footer"<<endl;}void Footer::prtTicket(){(4) ;prtFooter();}class SalesOrder{public:void prtTicket();};void SalesOrder::prtTicket(){Component *myST;myST=new Footer( (5) );myST->prtTicket();}(1)

class super {   public float getNum() {return 3.0f;}   }   public class Sub extends Super {   }   Which method, placed at line 6, will cause a compiler error?()A、 Public float getNum() {return 4.0f; }B、 Public void getNum (){}C、 Public void getNum (double d){}D、 Public double getNum (float d) {retrun 4.0f; }

Which three demonstrate an “is a” relationship?() A、 public class X { }  public class Y extends X { }B、 public interface Shape { }  public interface Rectangle extends Shape{ }C、 public interface Color { }  public class Shape { private Color color; }D、 public interface Species { }  public class Animal { private Species species; }E、 public class Person { } public class Employee {  public Employee(Person person) { }F、 interface Component { }  class Container implements Component { private Component[] children; }

Which two allow the class Thing to be instantiated using new Thing()?A、 public class Thing { }B、 public class Thing { public Thing() {} }C、 public class Thing { public Thing(void) {} }D、 public class Thing { public Thing(String s) {} }E、 public class Thing { public void Thing() {} public Thing(String s) {} }

A JavaBeans component has the following field:  11. private boolean enabled;  Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()A、 public void setEnabled( boolean enabled) public boolean getEnabled()B、 public void setEnabled( boolean enabled) public void isEnabled()C、 public void setEnabled( boolean enabled) public boolean isEnabled()D、 public boolean setEnabled( boolean enabled) public boolean getEnabled()

下列代码正确的是哪项?() A、 public class Session implements Runnable, Clonable{   public void run ();public Object clone () ; }B、 public class Session extends Runnable, Cloneable {  public void run() {/*dosomething*/}       public Object clone() {/*make a copy*/} }C、 public abstract class Session implements Runnable, Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}        }D、 public class Session implements Runnable, implements Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}       }

class One {   public One foo() { return this; }  }  class Two extends One {  public One foo() { return this; }  }  class Three extends Two {   // insert method here  }  Which two methods, inserted individually, correctly complete the Three class?()A、 public void foo() { }B、 public int foo() { return 3; }C、 public Two foo() { return this; }D、 public One foo() { return this; }E、 public Object foo() { return this; }

public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return ““ + wins + “,“ + losses + “”; }  // insert code here  }  Which method will complete this class?() A、 public int compareTo(Object o) {/*mode code here*/}B、 public int compareTo(Score other) {/*more code here*/}C、 public int compare(Score s1,Score s2){/*more code here*/}D、 public int compare(Object o1,Object o2){/*more code here*/}

Which the two demonstrate an “is a” relationship?()A、 public interface Person {}  Public class Employee extends Person {}B、 public interface Shape {}  public interface Rectangle extends Shape {}C、 public interface Color {}  public class Shape { private Color color; }D、 public class Species {}  public class Animal { private Species species; }E、 interface Component {} Class Container implements Component {private Component [] children;

Which two demonstrate an “is a” relationship?()   A、 public interface Person { }  public class Employee extends Person { }B、 public interface Shape { }  public class Employee extends Shape { }C、 public interface Color { }  public class Employee extends Color { }D、 public class Species { }  public class Animal (private Species species;)E、 interface Component { }  Class Container implements Component ( Private Component[ ]children;  )

1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()  A、  Public float getNum()   {return 4.0f; }B、  Public void getNum ()  { }C、  Public void getNum (double d)   { }D、  Public double getNum (float d) {retrun 4.0f; }

Given an ActionEvent, which method allows you to identify the affected Component?()  A、 Public class getClass()B、 Public Object getSource()C、 Public Component getSource()D、 Public Component getTarget()E、 Public Component getComponent()F、 Public Component getTargetComponent()

Given the ActionEvent, which method allows you to identify the affected component?()A、 GetClass.B、 GetTarget.C、 GetSource.D、 GetComponent.E、 GetTargetComponent.

多选题Which two demonstrate an “is a” relationship?()Apublic interface Person { }  public class Employee extends Person { }Bpublic interface Shape { }  public class Employee extends Shape { }Cpublic interface Color { }  public class Employee extends Color { }Dpublic class Species { }  public class Animal (private Species species;)Einterface Component { }  Class Container implements Component ( Private Component[ ]children;  )

单选题Given the ActionEvent, which method allows you to identify the affected component?()A GetClass.B GetTarget.C GetSource.D GetComponent.E GetTargetComponent.

单选题Which method must be defined by a class implementing the java.lang.Runnable interface? ()A void run()B public void run()C public void start()D void run(int priority)E public void run(int priority)F public void start(int priority)

单选题class super {   public float getNum() {return 3.0f;}   }   public class Sub extends Super {   }   Which method, placed at line 6, will cause a compiler error?()A Public float getNum() {return 4.0f; }B Public void getNum (){}C Public void getNum (double d){}D Public double getNum (float d) {retrun 4.0f; }

单选题下列代码正确的是哪项?()A public class Session implements Runnable, Clonable{   public void run ();public Object clone () ; }B public class Session extends Runnable, Cloneable {  public void run() {/*dosomething*/}       public Object clone() {/*make a copy*/} }C public abstract class Session implements Runnable, Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}        }D public class Session implements Runnable, implements Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}       }

多选题A JavaBeans component has the following field:  11. private boolean enabled;  Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()Apublic void setEnabled( boolean enabled) public boolean getEnabled()Bpublic void setEnabled( boolean enabled) public void isEnabled()Cpublic void setEnabled( boolean enabled) public boolean isEnabled()Dpublic boolean setEnabled( boolean enabled) public boolean getEnabled()

多选题Which the two demonstrate an “is a” relationship?()Apublic interface Person {}  Public class Employee extends Person {}Bpublic interface Shape {}  public interface Rectangle extends Shape {}Cpublic interface Color {}  public class Shape { private Color color; }Dpublic class Species {}  public class Animal { private Species species; }Einterface Component {} Class Container implements Component {private Component [] children;

单选题public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return “”; }  // insert code here  }  Which method will complete this class?()A public int compareTo(Object o) {/*mode code here*/}B public int compareTo(Score other) {/*more code here*/}C public int compare(Score s1,Score s2){/*more code here*/}D public int compare(Object o1,Object o2){/*more code here*/}

多选题Which three demonstrate an “is a” relationship?()Apublic class X { }  public class Y extends X { }Bpublic interface Shape { }  public interface Rectangle extends Shape{ }Cpublic interface Color { }  public class Shape { private Color color; }Dpublic interface Species { }  public class Animal { private Species species; }Epublic class Person { } public class Employee {  public Employee(Person person) { }Finterface Component { }  class Container implements Component { private Component[] children; }

单选题Given an ActionEvent, which method allows you to identify the affected Component?()A Public class getClass()B Public Object getSource()C Public Component getSource()D Public Component getTarget()E Public Component getComponent()F Public Component getTargetComponent()