Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts
Applet:How to use button Action with TextField
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code="ButtonAT" height=250 width=250>
</applet>
*/
public class ButtonAT extends Applet implements ActionListener
{
Button b1,b2,b3;
TextField t1,t2,t3;
String msg="";
public void init()
{
setLayout(null);
b1=new Button ("b1");
b2=new Button ("b2");
b3=new Button ("b3");
t1=new TextField(" ");
t2=new TextField(" ");
t3=new TextField(" ");
b1.setBounds(10,20,50,20);
add(b1);
b2.setBounds(10,45,50,20);
add(b2);
b3.setBounds(10,70,50,20);
add(b3);
t1.setBounds(70,20,90,20);
add(t1);
t2.setBounds(70,45,90,20);
add(t2);
t3.setBounds(70,70,90,20);
add(t3);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String s=(String)ae.getActionCommand();
if (s.equals("b1") )
{
t1.setText("This is b1");
}
if (s.equals("b2") )
{
t2.setText("This is b2");
}
if (s.equals("b3") )
{
t3.setText("This is b3");
}
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg,60,105);
}
}
Applet:Arc
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/* <applet code="ArcE" width="160" height="250" > </applet> */
public class ArcE extends Applet
{
public void paint(Graphics g)
{
g.drawOval(20,20,120,60);
Color c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,20,120,60,0,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,20,120,60,60,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,20,120,60,120,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,20,120,60,180,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,20,120,60,240,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,20,120,60,300,60);
c=new Color(250,0,0);
g.setColor(c);
g.drawLine(0,90,250,90);
c=new Color(0,0,0);
g.setColor(c);
g.drawOval(20,100,120,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,100,120,60,0,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,100,120,60,60,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,100,120,60,120,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,100,120,60,180,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,100,120,60,240,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,100,120,60,300,60);
c=new Color(250,0,0);
g.setColor(c);
g.drawLine(0,170,250,170);
g.drawOval(20,180,120,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,180,120,60,0,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,180,120,60,60,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,180,120,60,120,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,180,120,60,180,60);
c=new Color(0,0,250);
g.setColor(c);
g.fillArc(20,180,120,60,240,60);
c=new Color(0,250,0);
g.setColor(c);
g.fillArc(20,180,120,60,300,60);
c=new Color(250,0,0);
g.setColor(c);
g.drawLine(0,245,250,245);
}
}
Java J2ME The Complete Reference
Download Book
J 2 M E : T h e C o m p l e t e R e f e r e n c e
Java 2 Platform Enterprise Edition, commonly referred to as Java 2 Enterprise Edition (J2EE), and the Java 2 Micro Edition (J2ME). Enterprise systems traditionally are designed using the client/server model, where client-side systems request processing from service-side systems. However, enterprise systems were undergoing their own evolution. Anew model calledWeb services gradually replaced the client/server model in corporations. Application programmers assembled applications from an assortment of processing components called Web services. Each Web service was independent from other Web services and independent from applications. A client-side application communicates with a middle-tier, server-side application, which in turns interacts with the necessary Web services that are also located on the server side.With the adoption of the Web services model in corporations, the JCP realized that J2ME must also go through another evolutionary cycle. With the introduction of new specifications, the Java community has merged J2ME technology with Web services technology. In addition to the acceptance ofWeb services, corporations are also seeking to merge mobile technology such as Personal Digital Assistants and cellular phones with corporate mainstream applications. J2ME, with the new PIM API, enables developers to create sophisticated, wireless applications that have direct access to native PDAdatabases. This enables corporate executives to use corporation’s
| Name | Java J2ME The Complete Reference |
| Publication | McGrawHill Osborne |
| Auther | Jame Keogh |
| File | |
| Size | 10,339 KB |
| Download | Java J2ME The Complete Reference.pdf |
Subscribe to:
Posts (Atom)