Code For OCR Scanner Not Working As Applet

May 18, 2014

I need to make a scanner (that has a built in ocr) output some content to a browser. I haven't gotten to the browser yet, but the code works when I run it as an application. With the scanner, I received Java code that makes the scanner take a picture, then read from it and output it back to the console. I added a few lines to make it an applet:

Java Code:

import gx.*;
import pr.*;
import java.applet.*;
public class DocScan extends Applet {
/**
*
*/
private static final long serialVersionUID = 1L;

[Code] .....

I am using Eclipse as an IDE. Right now my goal is to simply make the scanner "flash". I know that the output is to the console and I will not see anything from it in an applet, but it should still flash.

When I run this code as an application, it works. The scanner takes a picture and then it outputs what it has read to the console.

When I run this code as an Applet, the applet starts and does nothing. It just stays there with no errors of any kind (at least that's what Eclipse is showing me).

I read that I should allow the applet access, so I edited:

Java Code:

c:program filesjavajre8libsecurityjava.policy mh_sh_highlight_all('java');

And added this at the end:

Java Code:

grant {
permission java.security.AllPermission;
}; mh_sh_highlight_all('java');

Which should allow applets full access. However, there is no change - the applet still launches and does nothing. Why is the code not working when I run it as an applet?

View Replies


ADVERTISEMENT

Code Not Running Scanner NextLine After Using Scanner NextInt?

Feb 14, 2015

package jdbc;
import java.sql.*;
import javax.sql.*;
import java.util.*;
public class Jdbc {
public static void main(String[] args) {

[code]....

View Replies View Related

Scanner Is Not Working

Apr 24, 2014

I wrote a piece of code:

for(int i = 0; i < x; i++){
System.out.println("Enter students full name:");
sName[i] = result.fullName(sc.nextLine());
sExam[i] = result.examName("VB");
System.out.println("Enter students exam score:");
int scor = sc.nextInt();
sScore[i] = result.examScore(scor);
sGrade[i] = result.examGrade(scor);
}

When i run it i get:

Enter number of students:
1
Enter students full name:
Enter students exam score:

The problem is, i cant enter "full name", program is just jumping to the next step "exam score".

View Replies View Related

Applet Viewer - Show Status Method Not Working

Apr 6, 2014

import javax.swing.*;
import java.awt.*;
import java.net.*;
import java.io.*;
public class App extends JApplet{
public void init(){
showStatus("applet");
}
}

This code does nothing to my statusbar.

I use applet viewer for my applet.

View Replies View Related

Implementing A Face That Smiles And Frowns - JButtons Not Working In Applet

May 9, 2015

I have to implement a face that smiles and frowns. I figured the easiest way to do this was to use JButtons. I also can't close the applet without hitting "end program". I was given a bit of code and had to add onto it. Here's what I have so far.

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.Color;
import javax.swing.*;
public class AnimationFace extends JFrame {
public static final int WINDOW_WIDTH = 400;
public static final int WINDOW_HEIGHT = 400;
 
[Code] .....

It's 90% done but once I changed the face from smile to frown, it lost an eyeball.

View Replies View Related

Java Applet With Third Party Jar Not Working - No Class Found Exception

Aug 31, 2014

I have written a java applet. Few months before It was working all fine but my client has some other requirements now and I have to edit it. I am getting two problems:
 
1. I could not execute it on my local computer as it always gives "your security settings have blocked a local application from running". I have edited the settings from Control Panel but it is then started giving permission error on including permission in manifest file it started giving trusted library error and still it is not resolved.
 
2. Can I know how to work with third party library with applets. I have imported the library and uses its few classes but when I tried to load applet it always give no class definition found error. I have some ways mentioned online like use comma separated names for all the jars but no luck so far.

View Replies View Related

Swing/AWT/SWT :: Crop Image Code In Applet

Apr 8, 2014

Code to crop and save an image in applet.

View Replies View Related

Servlets :: Email Sending Code Is Not Working?

Mar 20, 2014

package signup;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates

[Code].....

View Replies View Related

Moving Object In A Frame - Code Not Working

May 7, 2014

I have made a code that should allowed me to move an object in a frame, using the arrow keys. But I don't know why, is not working.

package joc;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.ImageIcon;

[Code] ....

View Replies View Related

Cipher Code - Encryption Test Cases Not Working

Oct 1, 2014

I have following Cipher Code and test for it. But I am getting following exception.

Java Code:

java.lang.IllegalStateException: Cipher not initialized
at javax.crypto.Cipher.checkCipherState(Cipher.java:1672)
at javax.crypto.Cipher.doFinal(Cipher.java:2079)
at com.anjib.util.CipherUtil.encrypt(CipherUtil.java:67)
at com.anjib.util.CipherTest.testEncryptDecrypt(CipherTest.java:23) mh_sh_highlight_all('java'); Java Code: public class CipherUtil {
private static Logger log = Logger.getLogger(CipherUtil.class);

[Code] ....

View Replies View Related

Pythagorean Theorem Program - Code Isn't Working When Written In OOP Style

Feb 11, 2014

I'm attempting to make a simple Pythagorean Theorem program (A squared + B squared = C squared) but am running into problems when I write it as object oriented. The darn thing works when written as a simple process, but that isn't Java now is it? Here's the simple:

public class PythagoreanTheorem extends ConsoleProgram {
public void run() {
println ("Finding C from A and B.");
double a1 = readDouble("Input A: ");
double b1 = readDouble("Input B: ");
double aSq = (a1*a1);
double bSq = (b1*b1);
double cSq = (aSq + bSq);
double c = Math.sqrt(cSq);
println ("C = " + c);

[code]....

View Replies View Related

Project Is Working On JFrame - But Not Working On JApplet

Apr 10, 2014

I am developing an application to share my client screen with server, it is working well on swing. But i want to develop as web application, i am trying to using applet. But i am facing the fallowing problem..,

1) The Applet screen also open and project also running well on server mechine. But unable to see the client screen on the server.

2) The problem may be to display the JDesktopPane or JInternalFrame.

My working Server Code extends withe JFrame..Java Code:

package remoteserver;
import java.awt.BorderLayout;
import java.awt.Container;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import javax.swing.JApplet;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

[code]....

View Replies View Related

Scanner Ignores Last Int

Feb 9, 2015

why does sevenPointsOrLess only work if I declare it as a String and use next() instead of nextInt()? Also why does it take part of the next line with it?

Here is the text I am trying to scan:

England,3,0,1,2,0
Samoa,1,0,3,0,1

Code:

lineScanner.useDelimiter(",");
country = lineScanner.next();
Won = lineScanner.nextInt();
Drawn = lineScanner.nextInt();
Lost = lineScanner.nextInt();
fourOrMoreTries = lineScanner.nextInt();
sevenPointsOrLess = lineScanner.next();

Results:

country = "England"
Won = "3"
Drawn = "0"
Lost = "2"
fourOrMoreTries = "2"
sevenPointsOrLess = "0 Samoa"

View Replies View Related

Scanner In Java

Jan 3, 2015

I'm trying to write a basic java program so that when I run it, I can store the names and codes of some of my school textbooks...I try the scanner statement to input the name of the book but an exception is thrown when I type the name of the book..I have attached the code for my program.

import java.util.Scanner;
public class Books{
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
System.out.print("Enter amount of products : ");
int products= s.nextInt();
long [] code= new long[products];
String[] names = new String[products];
for (int x=1;x<(products+1);x++){
System.out.println("Enter IMEI number "+x);
code[x] = s.nextLong();
System.out.println("Enter name "+x);

[code]....

View Replies View Related

Web Services :: Code Implementation Generated By Axis2 Code Generator?

Aug 23, 2010

I was a bit confused of the code generated by the Axis2 Code Gen.

I have created a logIn(String username, String password) method in my service and used Axis2 Code Gen to generate the Stub.

I try to access the logIn method from my Client using the Stub like below:

TestServiceStub stub = new TestServiceStub("http://localhost:8080/axis2/services/TestService");
String test = stub.logIn("user","pass").

but instead of UserName and password as the parameters, the Stub created a Login object as the parameter for the logIn method. like the one below:

stub.logIn(Login login1);

I wanted to try the logIn method by providing a static userName and password but it seems impossible because the Stub changed the parameter for the logIn method.

how to test the logIn method.

View Replies View Related

Modify Code That Converts Binary Code To Decimal Numbers

Aug 29, 2014

The code here I have works fine if I just want to ask the user to enter four digits: //java application that asks user to input binary numbers(1 or 0) and convert them to decimal numbers import java.util.Scanner; //program uses class scanner public class binarynumber{
 
//main method that executes the java application
public static void main(String args[]){
//declares variables
 
int digit;
int base=2;
int degree;
double decimal;
int binary_zero=0;
int binary_one=1;
//create scanner for object input

[code]....

The thing is, I want the java application to input more than four digits for the user and I want it to loop it manytimes f until the user ask it to stop.

View Replies View Related

Scanner Isn't Accepting Doubles

Jan 25, 2014

I had to use scanner to receive input from the user for a formula and everything compiled and worked correctly except when I entered a double into the Scanner, it only accepts ints and gives me this error every time I enter a double:

java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at TestA1Q2.main(TestA1Q2.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272)

I know that you usually get that error when the Scanner expects something else that is different from what you type and I have looked over my code time and time again and cannot find anything. I created a test program to see if it was just that problem and not something else in the code and I still got the same error but when I tried compiling and running it here browxy.com everything worked and I got the right answer for the formula. Here's the test I used:

import java.util.Scanner;
public class TestA1Q2 {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter a double");
double velocity = keyboard.nextDouble();
}
}

At this point I'm thinking it might be a problem with my install of DrJava and I've tried re-installing but nothing changed.

View Replies View Related

Scanner Cannot Be Used As Variable In If Statements?

May 18, 2014

I created a variable for the scanner called serena. Serena variable is equal to what the user inputs. My if statement says that if the answer the user enters is not equal to the actual answer then it is to display "wrong". It is a basic math game I am working on. NetBeans is telling me that I cannot use the scanner in an if statement?

package pkgnew;
import java.util.Scanner;
public class New{
public static void main(String args[]){
Scanner serena = new Scanner(System.in);
double fnum, snum, answer;

[Code] ....

Do I have to define Serena as whatever number the user inputs? If so, how?

View Replies View Related

Can Use Java Scanner With String?

Jan 18, 2010

I couldn't get this code working:

import java.util.*;
public class scan {
public static void main (String args[]) {
String testi;
Scanner scan = new Scanner(System.in);

[Code] .....

Did i write something wrong or can't Scanner be used with String?

View Replies View Related

Scanner Array Initializing

Oct 12, 2014

Scanner sc = new Scanner(System.in);
Question question = new Question();
Quiz quiz = new Quiz();
System.out.print("Enter the prompt: ");
question.prompt = sc.nextLine();

[Code] .....

Here is the example run that I am trying to achieve:

* 1. Enter the prompt: What is the capital of the USA?
* 2. Enter a possible answer: New York City, NY
* 2. Is New York City, NY the correct answer (y/n)? n
* 3. Enter a possible answer: Pittsburgh, PA
* 3. Is Pittsburgh, PA the correct answer (y/n)? n
* 4. Enter a possible answer: Washington, DC
* 4. Is Washington, DC the correct answer (y/n)? y
* 5. Enter a possible answer: Chicago, IL
* 5. Is Chicago, IL the correct answer (y/n)? n

The problem is that my for loop runs through correctly the first time, but doesn't seem to react to me initializing my choices array after that. It ends up looking like this:

Enter the prompt: What is the capitol of the USA?
Enter a possible answer: New York City, NY
Is New York City, NY the correct answer (y/n)?n
Enter a possible answer: Is the correct answer (y/n)?

But I cannot understand why it's doing that.

View Replies View Related

Scanner Taking Input Twice

Oct 29, 2014

I have a small bug in my program. The user is asked what person(s) information they want to access but lets say they want captain they must enter "captain" twice. I think it will make more sense to you with the code. I have searched all over to see what is causing the bug but still have found no resolution. I even tried making two different scanners but that didn't work either.

I know the while loop (line 16) I am using is causing the bug because it works fine without that but then I cannot validate the input.

package myproject;
import java.util.Scanner;
public class Enterprise {
public static void main (String[]args){
String userInput;

[Code]......

View Replies View Related

Scanner NextLine Won't Enter Anything

Jan 26, 2014

My program is supposed to let me enter the following info for 3 employees: name, number of hours worked this week, and hourly pay rate. It lets me enter the name for the first employee, but for the second and third, it skips over the name and forces me to enter the number of hours worked and pay rate without a name. I have the code and the output posted below. First the program code:

Java Code:

import java.util.Scanner;
public class SalaryCalc {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String name;
double hours;
double rate;
double grossPay = 0;
double overtime;

[code]...

Enter hours worked this week: mh_sh_highlight_all('java'); Notice I can only enter the name for the first employee (Bigfoot). If I wanted to enter "Nessie" for my second employee's name, it skips over the name prompt and prompts me for the hours worked instead.

View Replies View Related

True And False / Scanner

Jul 7, 2014

My goal is to ask them for their name and if they got it right then it says yes while if they wrote it wrong, it would say no.

Java Code: public static void main(String[] args) {
Scanner name = new Scanner(System.in);
System.out.println("What is your name?");
String sname = name.nextLine();
name.close();
System.out.println("Are you sure it's " + sname + "?");
Scanner tfname = new Scanner(System.in);
String stfname = tfname.next();

[code]....

View Replies View Related

While Loop In Combination With A Scanner

May 17, 2014

I have the following task given to me (to be solved in NetBeans) :

View the contents of the file tuinman.txt: each line has a (real) number, followed by a line text.

Write the readGardener () method that reads the file completely. Only if the number is negative, write the rest of the line. (For each input line, a new line output.)

Extra: Adjust your method so you get the text after each negative number, written "word by word", among themselves. A word can contain characters that are not "letters" are (,,. '") - ,this you may ignore.

"tuinman.txt" is dutch for "gardener.txt". This txt file is located in the same map where build,nbproject,src, etc... are located. I couldn't solve this task so i looked at the solution. It didn't work... So i tried the solution of the extra bit:

package labo.pkg2;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Methods {
public void readGardener() throws FileNotFoundException {

[Code] ....

The txt file is added as an attachment to this post.

The weird thing is, the first thing the program prints is "Van" "morgen" "ijlt",... wich are words from line 19 in the txt file. All the ones before line 19 the program won't print, even if the number is negative. Even weirder, the next thing that is printed after line 19 is the NUMBER from line 20, nowhere in this code do i tell the program to print a number, and yet it does... But that's not all! From line 19 on, he just prints every single thing in the document except for the negative number, if your mind didn't explode already, it sure did now!

So in short: I need some code that prints all the lines from the txt files that start with a negative number. Only the text may be printed though, there may be no numbers in the output!

The txt file, i couldn't add it as a attachment

123
-456,12 De tuinman en de dood
184,67 was hij, Kees, de enige die het zag, want niemand lette d'r op...
-845,14
-8,12452 Een Perzisch Edelman:
157,24 Dus daar gaan we dan.

[Code] ....

View Replies View Related

Input Color Code In HSV And Output Equivalent RGB Code

Oct 9, 2014

I need to create a Java program that takes an input a color code in HSV and outputs the equivalent RGB code and Vice versa.

Example:
If you test on the color RED in RGB:
Input: (255,0,0)
Output: (0,100%,100%)
If you test on the color RED in HSV:
Input0,100%,100%)
Output: (255,0,0)

View Replies View Related

Console Input Of Strings Using Scanner

May 9, 2015

I am having a great deal of frustration trying to use the scanner to get user input from the eclipse console. Here is what I am trying to do.

Print a menu for the user with options, take that (1) char input and run it into a switch statement for processing. I have that done and it is working fine.

If the user chooses to enter strings for storage, They are instructed to enter their string and press enter to complete that string entry. Then enter the next string and press enter, etc.

So I have a While loop for this. Get the scanner input, store it in the LinkedList, get the next scanner input, etc. I get the scanner string and store it in a Linked list. That works fine. The user is instructed to simply enter a blank string to end the entry procedure, like just press Enter on the new line without typing a new string.

The problem is the scanner doesn't seem to return anything for me to Test to close this procedure. How do I TRAP the fact that the user just pressed enter so I can end my procedure? I have tried next() and nextLine() and reset(), etc. And I am getting knowhere.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved