Applets :: Displaying A Box Defined Based On DrawRectangle
Aug 7, 2014
I am currently in the middle of a certification program and doing quite well but now I am a bit stuck.
I have two classes in the program, one defines a box based on drawRectangle, the other is a simple Applet to display the box. This is the Box - Class :
import java.awt.Color;
import java.awt.Graphics;
public class Box {
private int upperLeftX, upperLeftY, height, width;
private Color boxColor;
[Code] .....
View Replies
ADVERTISEMENT
Dec 26, 2013
I am new to applets, and my manifest file is:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Permissions: all-permissions
Created-By: 1.6.0-internal (Sun Microsystems Inc.)
Name: com/myPackage/test/client/TaskApplet.class
SHA1-Digest: pLmraui35IkgfAq+v3WGj1LwCYQ=
The error I get is as follows...When the page is loaded I get the following error: java.lang.SecurityException: class "com.myPackage. test.client. TaskApplet" does not match trust level of other classes in the same package
View Replies
View Related
Apr 5, 2014
I have written some error checking code
File name ErrorPage.jsp
<%@ page language="java" isErrorPage="true" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Error</title>
</head>
[code]...
I have put error.jsp and badpage.jsp file in public access folder that is web content in eclipsewhen I am running the code I am status code of 500 and not the errorpage.jsp message .
View Replies
View Related
May 2, 2014
I have Spring/CXF project in RAD. I have the following problem message:The servlet mapping "XXX" refers to a servlet that is not defined.
<servlet>
<servlet-name>XXX</servlet-name>
<display-name>XXX</display-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>XXX</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
However, The servlet was defined in the web.xml file.I searched the internet and tried a few things but to no avail.
View Replies
View Related
May 23, 2015
I am trying to create a simple programme that adds two defined matrices together,
public class Question4 {
int [][] numeros1 = { {1,2,3},
{4,5,6}
};
int [][] numeros2 = {{2,5,8},
{3,7,9}
[Code] ....
View Replies
View Related
Feb 13, 2014
In my main method I am trying to create a Timer, but when I put new Timer(1000,listener) the constructor is not defined. It is when there is nothing in it. I find this super weird because in all my other programs this does not happen. I looked at the documentation and can't see what I am doing wrong, so I turn here.
ActionClass Java Code: import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.*;
public class Action extends JComponent {
[Code] .....
View Replies
View Related
Dec 3, 2014
I know that I am not 100% comprehending try/catch blocks, but after scouring message boards, forums, and Oracle, I still can't pick out where I am going wrong.
I have a ValidateInput class where I am trying to check that a String only has letters. If not, then throw an exception message via JOptionPane. I created my own NonLetterException class. When I call the method containing the try/catch Eclipse gives me an Unhandled Exception Type error.
in main()
ValidateInput validate = new ValidateInput();
String name = "error";
for(int x = 0; x < 1;){
name = JOptionPane.showInputDialog("Welcome. What is your name?");
boolean isItName = validate.stringInput(name); //error appears at validate.stringInput
if(isItName)
[code]....
Aren't I handling it in the try/catch? What did I miss?
Also, I have have tried the NonLetterException class as nested in ValidatedInput, but also not nested. To me nested makes more sense. I have never nested classes before, but it makes sense to me because I am not using this exception in other parts of my program.
View Replies
View Related
May 25, 2011
I'm having an issue when I try to define a variable in a JSP scriptlet, and then in a separate scriptlet on the same page attempt to use the variable. It looks like it goes out of scope.
I also cannot reference a variable from a servlet in a JSP expression tag. So I've had to write the entire page basically in one scriptlet.
I'm using Tomcat 6.0.
View Replies
View Related
Apr 1, 2014
I have a small issue understanding the following error message that Eclipse returns when i try to run the following code:
class Film {
String tytul;
String rodzaj;
int ocena;
void odtworz() {
System.out.println("Odtwarzamy film.");
[Code] .....
The message itself reads: "Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at FilmTester.main(Film.java:13)"
and the following on the line where the problem arises:
What gives? I'm positive i'm missing something obvious but i can figure it out why
View Replies
View Related
Jul 11, 2014
1.Is there any way by which i can see what is happening inside pre defined methods.
i.e. can i see there source code?
2.Somewhere i learned how to see the content of a pre defined class i.e. by using:
javap java.io.classname
but i dont know what javap means!
View Replies
View Related
Feb 15, 2014
Can a class be defined inside an Interface .
interface Inter{
class x{
public static void main(String[] args){
System.out.println("Hello World!");
}
}
}
View Replies
View Related
Mar 16, 2014
How Can I differentiate the System classes and user classes in my program written below by another program?
/**
* Employee Class containing all non-primitive data types.
*
*/
class Employee{
private String name;
private String phone;
private Integer age;
private Float salary;
[Code] ....
Any Technique that will decide which one of the fields (Integer, Address, DOB, String, Float) are user defined type. (An outsider class should used that will identify the Java classes and the user-defined classes.)
View Replies
View Related
Aug 29, 2014
My question is How to write a program to implement concept of creating user defined packages and importing the same? How to solve it.
View Replies
View Related
Apr 7, 2015
how to add an a user defined int into my existing array. Ive heard of using ArrayList but not sure how to implement it.
View Replies
View Related
Feb 15, 2014
What happens to a static variable that is defined within a method of a class ?
View Replies
View Related
Mar 30, 2014
Why I cannot use 2 public classes like below?
public class Hello {
public static void main(String[] args){
Welcomer welcomer=new Welcomer();
welcomer.sayHello();
[Code] ....
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The public type Welcomer must be defined in its own file
at Welcomer.<init>(Hello.java:9)
at Hello.main(Hello.java:5)
View Replies
View Related
Apr 9, 2015
I'm trying to build a program that will output what will ultimately look like a simple mario level turned on its side. As part of my output I need the user to define what mario looks like. I do this using Scanner and save the input to String mario. When I try to use that variable in another method it gives me troubles.
import java.util.Scanner;
public class Mario2
{
public static void mario() {
//user defines mario
String mario = ">->O";
Scanner keys = new Scanner(System.in);
System.out.println("What does mario look like?");
mario = keys.next();
System.out.println("Mario now looks like: " + mario);
[code]....
View Replies
View Related
Aug 9, 2014
this code won't compile because selected row must be declared as final because of it being defined outside the window listener. Is their anyway around this? If I make it final the first time that the variable is called it keeps it starting value until the GUI is closed.
butEdit.addActionListener (new ActionListener () {
@Override
public void actionPerformed (java.awt.event.ActionEvent evt) {
int selectedRow = table.getSelectedRow ();
final String [] values = custTableModel.getRowValues (selectedRow);
[code]....
View Replies
View Related
Sep 1, 2014
I am trying to remove the duplicate elements from ArrayList using .contains() if elements are primitive datatype it works but user-defined datatype does not work.
public class UserBean {
String name;
String address;
public String getName() {
return name;
[code]....
View Replies
View Related
Apr 3, 2014
Created a java.sql.connection object. Refering those obj inside public void run() { } If i declare as final inside a method, i can't refer those outside method due to scope. Cannot refer to a non-final variable dbConnObj inside an inner class defined in a different method...
View Replies
View Related
Jan 20, 2015
so i'm following a java tutorial from the book and it has a few challenge questions. and i'm stucked on one. i think i just don't understand what is it that its asking me. heres the question, Write a statement that reads a user's input integer into the defined variable, and a second statement that prints the integer. assuming scanner is given, and i checked my heading code is ok.
Scanner scnr = new Scanner(System.in);
int userNum = 0;
System.out.println("What is the product of 8 time 2");
userNum = scnr.nextInt();
[code]....
View Replies
View Related
Jan 10, 2015
I'm using a PrimeFaces UploadedFile xhtml page to select a csv file to read and write using a managed bean (SuperCSVParser.java). The file is read and written to an entity class which then persists the data to a database. The application works fine if I specify a file path on the physical server and select a csv file on that file path. But for the production version I want the user to select ANY file name from ANY directory on their local system.
I know about the FacesContext methods and I've looked at some methods from the java.io File class. Most of these methods are about getting the path from the server, where I want to 'pass' the path String from the client machine to allow the uploaded file to go through. When I try with the below code I get:
java.io.FileNotFoundException: data.csv (The system cannot find the file specified)
I'd like to know what I'm doing as I prefer not to explicitly declare a path in the final app. I'm almost sure that's possible.
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{SuperCsvParser.file}"
mode="simple"
auto="true"
[Code].....
View Replies
View Related
Sep 4, 2014
this is what I clobbered together for the O'Reilly Java 2 Course, final assignment. There may well be several issues still with this code, my main grief at the moment is: The mouseReleased does not react (it did in the assignment I lifted it from and made only minor changes). No matter where I click on the grid, nothing happens.
import java.awt.event.MouseAdapter;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.Container;
[code]....
View Replies
View Related
May 14, 2014
I do not think this is possible, but I'd like to confirm. If I have an HTML page that has an embedded Java applet, and that applet in turn renders an HTML document (within the applet window), is the HTML *within* the applet part of / accessible through the DOM for the parent page?
View Replies
View Related
Jan 31, 2014
We are using an applet in our web application. The applet of our application is dependent on bouncycastle jar,bcprov-jdk15.jar and few other jar's whose size comes around 4 mb. When using the appliaction on jre7, the applet is taking too long time to load than usual time. Is there any way to place these jar's in client machine? Will it improve the performance? Is there any other way to reduce the loading time of applet apart from placing jars in client machine?
View Replies
View Related
Feb 26, 2014
I have a simple applet that doesn't stray outside the sandbox. It used to work fine before Java 7 but now it craps out with security warnings. It does nothing but play a game, it doesn't even save the state of the game. This is the applet, it's a very simple chess program.
The warnings and popups I'm getting are:
activate javaTM platform SE 7U?allow now?activation blocked by security settings - I never changed any security settings and as I said, this applet stays firmly in the sandbox so I can't see what the issue is.Viewing the java error window I see
Java Plug-in 10.51.2.13
Using JRE version 1.7.0_51-b13 Java HotSpot(TM) Client VM
User home directory = C:UsersMike
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
[code]....
why it shows the C:UsersMike directory in the above listing, there is no access to files etc.The applet plays fine if I run it in appletviewer.What do I need to do to make this simply work in anyone's browser? I have a similar problem with a (rather funky) Connect 4 program I wrote. It worked fine for years and then just stopped with the Java 7.
View Replies
View Related