Choices:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*<applet code="ChoiceDemo" width=300 height=300></applet>*/
public class ChoiceDemo extends Applet implements ItemListener
{
Label l1;
public void init()
{
Choice c1=new Choice();
c1.addItem("Red");
c1.addItem("Green");
c1.addItem("Blue");
c1.addItem("Yellow");
c1.addItem("Orange");
c1.addItem("Gray");
c1.addItem("Pink");
c1.addItemListener(this);
add(c1);
}
public void itemStateChanged(ItemEvent ie)
{
Choice c=(Choice)ie.getItemSelectable();
String s=c.getSelectedItem();
if(s.equals("Red"))
setBackground(Color.red);
else if(s.equals("Green"))
setBackground(Color.green);
else if(s.equals("Blue"))
setBackground(Color.blue);
else if(s.equals("Yellow"))
setBackground(Color.yellow);
else if(s.equals("Orange"))
setBackground(Color.orange);
else if(s.equals("Gray"))
setBackground(Color.gray);
else if(s.equals("Pink"))
setBackground(Color.pink);
}
}
16. How do you set security in applets? using setSecurityManager() method 17. What is a layout manager and what are different types of layout managers available in java AWT? A layout manager is an object that is used to organize components in a container. The different layouts are available are FlowLayout, BorderLayout, CardLayout, GridLayout and GridBagLayout 18. What is JDBC? JDBC is a set of Java API for executing SQL statements. This API consists of a set of classes and interfaces to enable programs to write pure Java Database applications. 19. What are drivers available? a) JDBC-ODBC Bridge driver b) Native API Partly-Java driver c) JDBC-Net Pure Java driver d) Native-Protocol Pure Java driver 20. What is stored procedure? Stored procedure is a group of SQL statements that forms a logical unit and performs a particular task. Stored Procedures are used to encapsulate a set of operations or queries to execute on database. Stored procedures can be compiled and...
Comments
Post a Comment