Applet Won't Calculate Discount For Matinee Movies
Feb 21, 2014
I have an applet program here that allows the user to choose a movie then a number of tickets from a drop-down list. A check box should display for users to click so they can receive a discount for matinee movies. The user should be able to click a calculate price button to display the total cost and a clear button to clear each drop-down list and the check box. The program compiled but when I clicked the calculate button, it generated so many error codes like java.lang.nullPointerException and a lot more. I just wanted the program to work properly. Code below:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Proj4exe2 extends Applet implements ItemListener, ActionListener {
Choice movieChoice = new Choice();
Button calcButton = new Button("CALCULATE");
[Code] .....
The applet code:
<html>
<applet code = "Proj4exe2.java" height = "450" width = "450">
</applet code>
</html>
View Replies
ADVERTISEMENT
Feb 9, 2015
i finished up a project here and seem to be running into some issues. I figured its my notation, when i ask a user to enter a number, if its below 10, it should *only* print "No Coupon." but what appears to happen is that the program prints "No Coupon" Plus the "discount coupon and % of purchase."
import java.util.Scanner;
public class assign1c { /* Start of Class 1c */
static double cost;
static double coupon = 0;
static String x = "No coupon";
public static void main(String[] args) {
// TODO Auto-generated method stub
[code]...
View Replies
View Related
Oct 24, 2014
double price;
String PriceStr;
int quantity;
String QuantityStr;
PriceStr = JOptionPane.showInputDialog("Enter the price: ");
price = Double.parseDouble(PriceStr);
QuantityStr = JOptionPane.showInputDialog("Enter the quantity: ");
[code]....
So i tried to make it allows the user can continue pick the option and calculate the total of every time they select the option, mine is only 2 times.
View Replies
View Related
May 8, 2015
whats the problem in my code : if i enter 2 movies are being displayed,it accepts only 1.
The code:
class theatrebooking {
public static void main(String args[])throws IOException {
Scanner in=new Scanner(System.in);
System.out.println("********************************************************************************************");
System.out.println();
System.out.println("System requires updation");
[Code] ....
View Replies
View Related
Feb 12, 2014
I'm trying to code an if-else statement where I need to find the percentage discount on an item without hardcoding it.
double Item1=30.50;
double Item2=40.50;
double discount=.07;
These are the values I have. Basically I just need an explanation of how to code a statement so I receive the calculated discount of a Full or Compact.
Here is the excerpt from the code, I can copy the whole code in too if needed.
Java Code:
System.out.println("You selected Item1.");
System.out.print("Have coupon? [Y or N]");
answer = kb.next();
if (answer.equalsIgnoreCase("n"))
System.out.print("Price is 30.50 per day.");
if (answer.equalsIgnoreCase("y"))
>This is what I'm looking for< mh_sh_highlight_all('java');
View Replies
View Related
Aug 13, 2014
i have created a frame with a menu bar displaying contents..now i want to set a username and password to that flame through an applet how to add applet to the frame??
here is my code ..
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
class MenuFrame extends Frame{
String msg="";
int flag=0;
CheckboxMenuItem debug,test;
[Code]...
View Replies
View Related
Apr 3, 2014
Why we do not need main in applet .....
View Replies
View Related
Aug 4, 2014
I am facing problem when displaying my applet on jsp. I have convert my applet project into CustomColor.jar. my package is dcs.raj.MyApp
I have import my jar into project property. But still it is showing error on all browser, i have changed the java control panel > Advanced > Java Consol > Show console.
But still I am facing the same problem.
My Jsp code is
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<APPLET CODE="dcs/raj/MyApp.class" archive="CustomColor.jar" WIDTH=400 HEIGHT=400>
</APPLET>
</body>
</html> mh_sh_highlight_all('java');
View Replies
View Related
Feb 5, 2014
I have a java application in which when starting it a map is opened and a screen is captured. The capturing is in certain time interval. I want to enable the user to change the interval for the automatic capturing the map. I placed a text box in a JPanel. I want to pass the value which was entered in it to the html page which opens a Google map. Since I am new in java programming, I found that I can do it by using applets. I made an applet, and tried to call it in the html file. But now instead of opening the map file in a browser, it opens very quickly only black window.
Here is my applet:
package cege.ui;
import java.applet.Applet;
import java.io.IOException;
import cege.ui.GuiMain;
public class AppletTInterval extends Applet {
private int TimeInterval=0;
[Code] .....
And the code in the html file where I try to call the applet, i.e. to pass the value which is returned by the applet is:
<script src=
<!--"https://www.java.com/js/deployJava.js"></script>
<script>
var attributes = { id:'AppletTInterval',
code:'cege.ui.AppletTInterval', width:1, height:1} ;
var parameters = { jnlp_href: 'AppletTInterval.jnlp'} ;
[Code] .....
Can I use this way to pass a value from the java class file (from the JTextField into the html file?
View Replies
View Related
Mar 11, 2002
I coded up a simple applet and some html with an applet tag and it tested out OK using the applet viewer. But it doesn't do anything (except draw a grey empty box 100x200) when executed from the application server. For the applicaton server test, I put the applet tag in the HTML Body of the JSP page i.e.
<applet code=CatApplet.class height=100 width=200> </applet>
The applet class file is in the same directory as the JSP page. The source for it is:
import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.io.*;import java.net.*;
import java.util.Date;public class CatApplet extends JApplet{public void init (){setBackground(Color.green);
resize (250,100);}public void paint (Graphics g){g.drawString ("lets get some cat gui going", 35, 15);}}
Why won't my applet run when the applet tags are in the JSP page?
View Replies
View Related
Apr 13, 2014
Can explain difference between applet and application?
What are differences in code? How to write application?
What are differences in use? I looked for some answers, but I can't understand what they are talking about.
For example:
Application:
Called as stand-alone application as application can be executed from command prompt
Applet:
Requires some third party tool like a browser to execute
But... While I export applet in exclipse I can use it without any browser, just like application(as I and avarage user knows it).
Ok, I understand difference like "Applets cannot read from or write to hard disk files."
So. What should I use while creating what?
For example, something as simple as windows calc, some 2d simply platformer, some more expanded app, like idk, spotify or media player or whatever?
Since after update 51 of java web applets are nearly useless(as I know, maybe I'm wrong?), what is better?
Can application have GUI or it is only applets thing(stupid question?)?
Where can I find any application tutorial? Everything that I found was for applets. Why?
View Replies
View Related
Apr 6, 2014
know if you can launch an applet through other means, other than web browser or through the Eclipse.
You know when you write an applet in eclipse you just extend a class and you hit Run (application) and the applet launches.
Or you can export the applet and run the applet from a browser.
Is there another way, to launch an applet like you would a JFrame?
Or the ways I just mentioned above are the only absolute ways to launch an applet?
View Replies
View Related
Nov 23, 2014
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.applet.*;
public class ImageViewer extends Applet implements ActionListener {
MenuBar mb = new MenuBar();
[code]....
Can i insert FileDialog in applet?i want if i chose "Open" in file menu, it will open FileDialog and i can chose some Image file.
View Replies
View Related
Apr 3, 2014
How to use initialized applet class?
View Replies
View Related
Sep 30, 2014
how to make an applet out of this program but can't seem to do it.
Java Code: import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JLabel;
import javax.swing.JFrame;
import java.io.*;
import java.util.Scanner;
[code]....
Technically, when you run the program, a gif page appears (that I put as a placeholder) and when you press the letter 'n' JCreator runs the program, displaying a character P on a .txt field made using the Notepad on Windows. You can move it left, right, down, and up andf it will move accordinly. However, each time I make such action, the compiler has to rewrite to whole .txt field with the new position.
My former tutor said that in order for it to be "real-time", we have to use an applet.
View Replies
View Related
Aug 3, 2014
The PNG Image is already in the src package thingie...
It's a 400 * 258 image...
Java Code: package frame;
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
public class Temperature_Convert extends Applet
implements AdjustmentListener {
private Image temp;
private Scrollbar bar;
[code]....
View Replies
View Related
Apr 13, 2014
Is there any way to save variables while I'm using applet as single runnable .jar file?
For example if I start app first time some variable has value of 100. While using app it changes to 200. After closing app it disapear and next run gives me 100 again instead of 200. Is there any way to save that 200?
View Replies
View Related
May 10, 2014
import java.applet.*;
import java.awt.*;
import java .awt.event.*;
[Code]....
View Replies
View Related
Apr 8, 2014
I need to create an applet that displays a grid of command buttons which I have done. I then need to create a new class that draws a silly picture of an alien, which I have also done. Where I am completely stuck and confused, is that I do not know how to get the drawing into the applet. My code is below. I really do not fully understand why this is not working or how to get it working.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MartianGame extends JApplet implements ActionListener {
DrawMartian aMartian = new DrawMartian();
DrawJupiterian aJupiterian = new DrawJupiterian();
[Code] .....
View Replies
View Related
Mar 29, 2015
How do i add my applet to a JFrame? (Ex. When i click on a Menu Item on my frame, i need the applet to be displayed.
The code of my Frame:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
[Code].....
View Replies
View Related
Apr 27, 2014
I am a new to Java and currently doing a study on applets.
I was looking for the demo folder in the jdk but I cannot find it. I was previously using jk7_51 and now using jdk8. and both of them do ot have the folder. I downgraded to jdk6 but i still could not find the foler. I need it since i need to try out the applets that come with the jdk. What I should do?
View Replies
View Related
May 26, 2012
I'm using jdk7 and I get this error when I compile Exception in thread "main" java.lang.Error: Unresolved compilation problem: at First.main(First.java:16)
Java Code:
import javax.io.*;
import javax.awt.*;
import javax.lang.*;
import javax.applet.*;
import javax.net.*;
import javax.util.*;
import javax.swing.JApplet;
import javax.swing.JFrame;
public class First extends JApplet {
public void init() {
getContentPane().add(new JLabel("Applet!"));
[code]....
View Replies
View Related
Aug 30, 2014
So I am trying to make this java applet that will display a random image of three that is a sub folder of my src folder within my project.
When you run the project currently all you get is a white applet. Here is the code:
import java.applet.Applet;
import java. awt.*;
public class myPictures extends Applet {
Image action;
public void paint(Graphics g){
int rint = (int)(Math.random() * 3);
if(rint == 0){
action = getImage(getDocumentBase(), "../../images/bee3.jpg");
} else if(rint == 1){
action = getImage(getDocumentBase(), "../../images/bee1.jpg");
} else {
action = getImage(getDocumentBase(), "../../images/bee2.jpg");
} } }
View Replies
View Related
Feb 25, 2014
I am new to applets and I am trying to create a program to display color and font. See my code below, I am getting some errors below.
import java.awt.Graphics; //program uses class Graphics
import javax.swing.JApplet; //program uses class JApplet
import javax.swing.JOptionPane; //program uses class JOptionPane
public class AdditionApplet extends JApplet
{
private double sum; //sum of values entered by user
private double average; //average of values entered by user
[Code] .....
java:11: error: cannot find symbol
Color skyBlue;
^
symbol: class Color
location: class AdditionApplet
java:12: error: cannot find symbol
Font sansFont;
[Code] .....
6 errors
Process completed.
View Replies
View Related
May 4, 2014
I want to display a picture but it isn't working:
public class BildApplet extends Applet {
Image car;
public void init() {
this.setBackground(new Color(200, 200, 255));
car = this.getImage(getDocumentBase (), "redcar.gif");
[Code] ....
Why not?
View Replies
View Related
Nov 28, 2014
I am trying to run a Java applet (.jnlp) file through OSX. The purpose of the applet is to upload files to an SQL server. When I try to run the applet, I get an "Unable to launch the application" error because "No application resources are specified for this platform" After some digging , we noticed there are only resource instructions for "Windows".
Would there be any way possible to make this compatible in an OSX environment through a few alterations to the code, or would this be an issue that the original developers would have to resolve?
Here is the specific code pointing to the Windows Resources:
<resources os="Windows" arch="amd64">
<j2se version='1.6+' initial-heap-size="64m" max-heap-size="512m"/>
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/uploader.jar' main='true' />
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/lib/jnlp.jar' download="eager" />
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/lib/transform.jar' download="eager" />
[Code] ....
View Replies
View Related