Worksheetsjava AWT
Total questions: 12
Worksheet time: 6mins
The following example shows the creation of a
import java.applet.*;
import java.awt.*;
public class Main extends Applet{
public void paint(Graphics g){
g.drawString("Welcome in Java Applet.",40,20);
}
}
a. Banner using Applet
b. Basic Applet
c. Display clock
d. None of the above
The APPLET tag is used to start an applet from both an HTML document and from an applet viewer.
a. True
b. False
What invokes immediately after the start() method and also any time the applet needs to repaint itself in the browser?
a. stop()
b. init()
c. paint()
d. destroy()
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet {
public void paint(Graphics g) {
g.drawString("A Simple Applet", 20, 20);
}
}
a) A Simple Applet
b) A Simple Applet 20 20
c) Compilation Error
d) Runtime Error
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet {
Graphic g;
g.drawString("A Simple Applet", 20, 20);
}
a) 20
b) Default value
c) Compilation Error
d) Runtime Error
How would you change the text of a label to the text contained by an integer named num;
label.setText(num);
label.updateText(num);
label.setTest("num");
label.setText(num+ "");
What object type handles Java's layouts?
Layout Manager
Layout Scheduler
Layout Operator
Layout Director
Which of the following layouts would be good to use for manually placing objects on a GUI?
Flow Layout
Border Layout
Grid Layout
Null Layout
What method(s) must we include in order to implement ActionListener?
paintComponent
actionEvent
actionPerformed
keyPressed
Execution of a java thread begins on which method call?
Run ()
Start ()
Execute ()
Launch ()
How many ways a thread can be created in Java multithreading?
1
2
5
10
Which method is used to make main thread to wait for all child threads
Join ()
Sleep ()
Wait ()
Stop ()
