Home Answers Viewqa Applet need a login applet in java

 
 


c.p
need a login applet in java
0 Answer(s)      2 years and a month ago
Posted in : Applet

i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding

import javax.swing.*; import java.applet.*; import java.awt.*; import java.util.*; import java.text.*; import java.awt.event.*;

public class BoatRental extends Applet implements ActionListener{ TextField text,text1,text2,text3,text4,text5,text6; Label label1,label2,label3,label4,label5,label6,label7,label8; Label lab; Button b1,b2; JComboBox combo; DecimalFormat df = new DecimalFormat("RM##.##");

public void init(){ setLayout(null);

lab=new Label("WELCOME TO PIN'S BOAT RENTAL");
lab.setBounds(100,20,200,20);
add(lab);

label1 = new Label("Select Boat: ");
label1.setBounds(20,50,180,20);
add(label1);
combo=new JComboBox();
combo.addItem("--Select--");
combo.addItem("Taurus");
combo.addItem("Leo");
combo.addItem("Virgo");
combo.addItem("Libra");
combo.addItem("Scorpio");
combo.addItem("Capricorn");
combo.setBounds(200,50,120,20);
add(combo);
label2 = new Label("Enter hours of rent: ");
label2.setBounds(20,80,180,20);
add(label2);

text = new TextField(5);
text.setBounds(200,80,100,20);
add(text);

b1 = new Button("Submit");
b1.setBounds(200,140,100,20);
add(b1);
b1.addActionListener(this);

label3=new Label("Enter Customer Name: ");
label3.setBounds(20,60,180,20);
add(label3);

text1=new TextField(10);
text1.setBounds(230,60,150,20);
add(text1);

label4=new Label("Enter IC Number: ");
label4.setBounds(20,90,180,20);
add(label4);

text2=new TextField(10);
text2.setBounds(230,90,150,20);
add(text2);

label5=new Label("Enter Age: ");
label5.setBounds(20,120,180,20);
add(label5);

text3=new TextField(10);
text3.setBounds(230,120,150,20);
add(text3);

label6=new Label("Enter Contact Number: ");
label6.setBounds(20,150,180,20);
add(label6);

text4=new TextField(10);
text4.setBounds(230,150,150,20);
add(text4);

label7=new Label("Enter E-Mail Address: ");
label7.setBounds(20,180,180,20);
add(label7);

text5=new TextField(10);
text5.setBounds(230,180,150,20);
add(text5);

label8=new Label("Enter Credit Card Numbers: ");
label8.setBounds(20,210,210,20);
add(label8);

text6=new TextField(10);
text6.setBounds(230,210,150,20);
add(text6);

b2=new Button("Submit");
b2.setBounds(230,270,100,20);
add(b2);
label3.setVisible(false);
label4.setVisible(false);
label5.setVisible(false);
label6.setVisible(false);
label7.setVisible(false);
label8.setVisible(false);
text1.setVisible(false);
text2.setVisible(false);
text3.setVisible(false);
text4.setVisible(false);
text5.setVisible(false);
text6.setVisible(false);
b2.setVisible(false);

}

public void actionPerformed(ActionEvent ae){ String value=combo.getSelectedItem().toString(); int hour=Integer.parseInt(text.getText()); if(value.equals("Taurus")){ if(hour>0){ final double amount=(hour-0)*50.00 + 100.00; JOptionPane.showMessageDialog(null," Boat Name = Taurus \n" + " Deposit = RM100 \n " + "Hours Rate = RM50 \n" + " Rent Hours = " + hour+ "\n"+" Total Charges = "+df.format(amount)); String st=JOptionPane.showInputDialog(null,"Do you want to proceed to next step?( y/n ): "); if(st.equals("y")){ label1.setVisible(false); label2.setVisible(false); text.setVisible(false); combo.setVisible(false); b1.setVisible(false); b2.setVisible(true); label3.setVisible(true); label4.setVisible(true); label5.setVisible(true); label6.setVisible(true); label7.setVisible(true); label8.setVisible(true); text1.setVisible(true); text2.setVisible(true); text3.setVisible(true); text4.setVisible(true); text5.setVisible(true); text6.setVisible(true);

b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Contact Number: " +text4.getText()+ "\n E-mail Address: " +text5.getText()+ "\n Credit Card Numbers: " +text6.getText()+ "\n Total Charges:  "+ df.format(amount) );
    }
});
}

else{
    JOptionPane.showMessageDialog(null,"Thank You and See you Again!!!");
}
}
}
else if(value.equals("Leo")){
        if(hour>0){
final double amount=(hour-0)*55.00 + 100.00;
JOptionPane.showMessageDialog(null," Boat Name = Leo \n" + " Deposit = RM100 \n " + "Hours Rate= RM55 \n" + " Rent Hours = " + hour+"\n"+" Total Charges = "+df.format(amount));
String st=JOptionPane.showInputDialog(null,"Do you want to proceed to next step?( y/n ): ");
if(st.equals("y")){
label1.setVisible(false);
label2.setVisible(false);
text.setVisible(false);
combo.setVisible(false);
b1.setVisible(false);
b2.setVisible(true);
label3.setVisible(true);
label4.setVisible(true);
label5.setVisible(true);
label6.setVisible(true);
label7.setVisible(true);
label8.setVisible(true);
text1.setVisible(true);
text2.setVisible(true);
text3.setVisible(true);
text4.setVisible(true);
text5.setVisible(true);
text6.setVisible(true);

b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Contact Number: " +text4.getText()+ "\n E-mail Address: " +text5.getText()+ "\n Credit Card Numbers: " +text6.getText()+ "\n Total Charges:  "+ df.format(amount) );
    }
}); }
else{
    JOptionPane.showMessageDialog(null,"Thank You and See you Again!!!");
}
}
}

else if(value.equals("Virgo")){ if(hour>0){ final double amount=(hour-0)*60.00 + 100.00; JOptionPane.showMessageDialog(null," Boat Name = Virgo \n" + " Deposit = RM100 \n " + "Hours Rate = RM60 \n" + " Rent Hours = " + hour+"\n"+" Total Charges = "+df.format(amount)); String st=JOptionPane.showInputDialog(null,"Do you want to proceed to next step?( y/n ): "); if(st.equals("y")){ label1.setVisible(false); label2.setVisible(false); text.setVisible(false); combo.setVisible(false); b1.setVisible(false); b2.setVisible(true); label3.setVisible(true); label4.setVisible(true); label5.setVisible(true); label6.setVisible(true); label7.setVisible(true); label8.setVisible(true); text1.setVisible(true); text2.setVisible(true); text3.setVisible(true); text4.setVisible(true); text5.setVisible(true); text6.setVisible(true);

b2.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Contact Number: " +text4.getText()+ "\n E-mail Address: " +text5.getText()+ "\n Credit Card Numbers: " +text6.getText()+ "\n Total Charges: "+ df.format(amount) ); } }); } else{ JOptionPane.showMessageDialog(null,"Thank You and See you Again!!!"); } } } else if(value.equals("Libra")){ if(hour>0){ final double amount=(hour-0)*65.00 + 100.00; JOptionPane.showMessageDialog(null," Boat Name = Libra \n" + " Deposit = RM100 \n " + "Hours Rate= RM65 \n" + " Rent Hours = " + hour+"\n"+" Total Charges = "+df.format(amount)); String st=JOptionPane.showInputDialog(null,"Do you want to proceed to next step?( y/n ): "); if(st.equals("y")){ label1.setVisible(false); label2.setVisible(false); text.setVisible(false); combo.setVisible(false); b1.setVisible(false); b2.setVisible(true); label3.setVisible(true); label4.setVisible(true); label5.setVisible(true); label6.setVisible(true); label7.setVisible(true); label8.setVisible(true); text1.setVisible(true); text2.setVisible(true); text3.setVisible(true); text4.setVisible(true); text5.setVisible(true); text6.setVisible(true);

b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Contact Number: " +text4.getText()+ "\n E-mail Address: " +text5.getText()+ "\n Credit Card Numbers: " +text6.getText()+ "\n Total Charges:  "+ df.format(amount) );
    }
}); }
else{
    JOptionPane.showMessageDialog(null,"Thank You and See you Again!!!");
}
}
}
else if(value.equals("Scorpio")){
        if(hour>0){
final double amount=(hour-0)*70.00 + 100.00;
JOptionPane.showMessageDialog(null," Boat Name = Scorpio \n" + " Deposit = RM100 \n " + "Hours Rate= RM70 \n" + " Rent Hours = " + hour+"\n"+" Total Charges = "+df.format(amount));
String st=JOptionPane.showInputDialog(null,"Do you want to proceed to next step?( y/n ): ");
if(st.equals("y")){
label1.setVisible(false);
label2.setVisible(false);
text.setVisible(false);
combo.setVisible(false);
b1.setVisible(false);
b2.setVisible(true);
label3.setVisible(true);
label4.setVisible(true);
label5.setVisible(true);
label6.setVisible(true);
label7.setVisible(true);
label8.setVisible(true);
text1.setVisible(true);
text2.setVisible(true);
text3.setVisible(true);
text4.setVisible(true);
text5.setVisible(true);
text6.setVisible(true);

b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Contact Number: " +text4.getText()+ "\n E-mail Address: " +text5.getText()+ "\n Credit Card Numbers: " +text6.getText()+ "\n Total Charges:  "+ df.format(amount) );
    }
}); }
else{
    JOptionPane.showMessageDialog(null,"Thank You and See you Again!!!");
}
}
}
else if(value.equals("Capricorn")){
        if(hour>0){
final double amount=(hour-0)*75.00 + 100.00;
JOptionPane.showMessageDialog(null," Boat Name = Capricorn \n" + " Deposit = RM100 \n " + "Hours Rate= RM75 \n" + " Rent Hours = " + hour+"\n"+" Total Charges = "+df.format(amount));
String st=JOptionPane.showInputDialog(null,"Do you want to proceed to next step?( y/n ): ");
if(st.equals("y")){
label1.setVisible(false);
label2.setVisible(false);
text.setVisible(false);
combo.setVisible(false);
b1.setVisible(false);
b2.setVisible(true);
label3.setVisible(true);
label4.setVisible(true);
label5.setVisible(true);
label6.setVisible(true);
label7.setVisible(true);
label8.setVisible(true);
text1.setVisible(true);
text2.setVisible(true);
text3.setVisible(true);
text4.setVisible(true);
text5.setVisible(true);
text6.setVisible(true);

b2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JOptionPane.showMessageDialog(null," Customer Name: " +text1.getText()+ "\n IC Number: " +text2.getText()+ "\n Age: " +text3.getText()+ "\n Contact Number: " +text4.getText()+ "\n E-mail Address: " +text5.getText()+ "\n Credit Card Numbers: " +text6.getText()+ "\n Total Charges:  "+ df.format(amount) );
    }
}); }
else{
    JOptionPane.showMessageDialog(null,"Thank You and See you Again!!!");
}
}
}
}

}

View Answers









Related Pages:
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import... java.text.*; import java.awt.event.*; public class BoatRental extends Applet implements
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import... java.text.*; import java.awt.event.*; public class BoatRental extends Applet implements
loading Java Applet - Applet
loading Java Applet  Hi, I use the archive tag to download my applet...? In the first step i only need code for the log in, after login the rest. Can I control the loading within the applet? thanks
Simple Java applet that need usernam, password and textfield.
Simple Java applet that need usernam, password and textfield.  Hi. Anyone can help me on this matter: I need to create a small application that require user to login by username and password. After login, they should meet
Need to create a java applet
Need to create a java applet   Hi people i need to create a java applet for which there will be 2 buttons to indicate small and big. I need to make a circle. When i click small the circle should be small and when i click big
applet problem - Applet
applet problem  How can I create a file in client side by a java applet . Surely it will need a signed applet .But how can a signed applet create a file in the client side
Applet query - Applet
link: http://www.roseindia.net/java/example/java/applet/ Thanks...Applet query  i want to knw d complete detail of why does applet... process. Instead it runs inside a container. Therefore, they do no need a static
drawing shapes in applet - Applet
drawing shapes in applet  hi, i need a single applet prgm which... java.applet.Applet; public class CubeExample extends Applet { Stroke... Applet { public void paint (Graphics g){ Graphics2D ga = (Graphics2D)g
java - Applet
java  Hi, I need very urgent code............ please help me......... How to convert text to wave conversion? I need java code............ Regards, Valarmathi
Applet
; Introduction Applet is java program that can be embedded into HTML pages. Java applets... Disadvantages of Java Applet: Java plug-in is required to run applet Java...: First of all we will know about the applet. An applet is a program written in java
Applet
Applet  Draw the class hierarchy of an Applet class. Also explain how to set background and forground colors in java
applet
applet  what is applet in java   An applet is a small program that can be sent along with a Web page to a user. Java applets can perform... the following link: Applet Tutorials
Applet
Applet  Write a Java applet that drwas a line between 2 points. The co-ordinates of 2 points should be passed as parametrs from html file. The color of the line should be red
login
login  sample java awt/swing code to make loginpage invisible after... java.awt.event.*; class Login { JButton SUBMIT; JLabel label1,label2; final JTextField text1,text2; Login() { final JFrame f=new JFrame("Login Form
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
login
login  i am doing the project by using netbeens.. it is easy to use the java swing for design i can drag and drop the buttons and labels etc.. now i want the code for login.. i created design it contains the field of user name
java applet notpad
java applet notpad  i need Codes Or programe in java applet ; i want add this programe to my site html > please help me our   Learn Java...: Java Applet Tutorials
The Java Applet Viewer
; the browser should be Java enabled.To create an applet, we need to define... The Java Applet Viewer       Applet viewer is a command line program to run Java applets
login authentication - Java Beginners
login authentication  i 've designed the jsp page for login. now i need to connect it with the bean and do authentication for the login for the "register" table in mysql. can anybody help me with the code immediately
Applet - Passing Parameter in Java Applet
Applet - Passing Parameter in Java Applet       Introduction Java applet has the feature... page. Applet will display "Hello! Java Applet"  if no parameter
login
login  hello i need some help please help how can identify admin from user when logging in? please make some answer and some explanation...   Please visit the following link; http://www.roseindia.net/jsp
java applets - Applet
java applets  hiiiii... i need ur help in usage of java code for navigation of one applet window to other...?? can you plz respond to me
need help to create applet
need help to create applet  Can u help me..?? I get a task ...and i dont know how to make it... So I hope that u can help me... Here is the task... ~Create an Applet using all Layout Manager(use whatever component in each layout
applet - Applet
in Java Applet.",40,20); } } 2) Call this applet with html code...: http://www.roseindia.net/java/example/java/applet/ Thanks....  Hi Friend, Try the following code: 1)Create an applet
Applet - Applet
, Applet Applet is java program that can be embedded into HTML pages. Java applets... in details to visit.... http://www.roseindia.net/java/example/java/applet...Applet  what is the concept of applet? what is different between
difference - Applet
as JFC?s (Java Foundation classes). 2) AWT components use native methods Swing components use the methods that are written in Java. Therefore AWT is heavy... are rectangular 5) Swings components are made in pure java and they are platform
applet - Applet
*; import java.awt.*; public class CreateTextBox extends Applet implements... information,visit the following link: http://www.roseindia.net/java/example/java/applet/ Thanks
need code for login in asp.net with c#
need code for login in asp.net with c#  hai iam trying to develop a project in asp.net with c#,so i need a code for login page using which admin and other users can log in.plz help me, thanks in advance
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
standart login form for messenger in java
standart login form for messenger in java  hi i need login from for chating messenger in java. but its structure would like this Home Register Login User ID Password   Hi Friend
Applet - Applet
------------------------"); g.drawString("Demo of Java Applet Window Event Program"); g.drawString("Java...Applet   Namaste, I want to create a Menu, the menu name is "Display... java.awt.event.*; public class menu2frame extends Applet implements WindowListener
Java program - Applet
Java program  Can you please provide me a code for scientific calculator in java I need that in urgent.Please post me the answers  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorial/java
The Java Applet Viewer
should be Java enabled.To create an applet, we need to define a class that inherits... The Java Applet Viewer       Applet viewer is a command line program to run Java applets
java - Applet
java  what is applet
difference between applet and swings
Applications while Applet need HTML code for Run the Applet 5)Swing have its own...difference between applet and swings  what are the major difference... for Abstract windows toolkit whereas le Swing is also called as JFC?s (Java
The Java Applet Viewer
should be Java enabled. To create an applet, we need to define a class... The Java Applet Viewer       Applet viewer is a command line program to run Java applets
java applet - Applet
java applet  wants to creat address bar on my java applet.  Hi Applet don't provide a facility to create a address bar directly. You just create a text box. In this text box if you enter any http address
Including applet in JSF (XHTML)
Including applet in JSF (XHTML)  Hi I want to generate graphs in facelets project. We are using JSF 2.0. We have Perspective for Java to generate graphs. in this project. So, Perspective for Java is providing an applet which i
Java Applet
Java Applet   How to add Image in Java Applet? what is getDocumentBase
The Java Applet Viewer
,  the browser should be Java enabled. To create an applet, we need to define... The Java Applet Viewer       Applet viewer is a command line program to run Java applets
java applet - Applet
java applet  I want to close applet window which is open by another button of applet program. plz tell me!   Hi Friend, Try...://www.roseindia.net/java/example/java/applet/ Thanks
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  what is applet?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/applet/ Thanks
Jav Applets - Applet
Jav Applets  I need to write a small payroll program, using applet... OpenWindow extends Applet implements ActionListener { Label l1,l2,l3...*rate; t3.setText(Integer.toString(total)); } } 2)applet.html: Java
What is an Applet
What is an Applet - Java Applet Tutorial       Introduction Applet is java program that can... of Java Plugin Applets runs in a sandbox, so the user does not need to trust
Login authentication & mysql - Java Beginners
Login authentication & mysql  Hi , Could you guide or provide sample coding for the following scenerio. I need to code authentication for user login I need to create a user account which is the user can register
jsp plugin implementation - Applet
folder under the WEB-INF folder and put my java code file and its corresponding classes inside the WEB-INF/classes folder. When i execute my jsp page, APPLET NOT INITED error displayed in my status bar. I opened the java console. The error

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.