I just created an applet that I want to call from a html file.
The applet code looks like this (and works):
package jav12;
import java.awt.*; import javax.swing.*; public class Welcome extends JApplet { public Welcome(){ } public void init() { getContentPane().add(new Label("Yessss it works",Label.CENTER));
[Code] ....
When I click on the html file the content of the page is blocked and the applet isn't loaded. What can I do to fix this. I think it has something to do with rights. This is a crosspost to JApplet content blocked
I've got a problem with my home made game. When I created it as a JFrame application it runs smoothly, but when I tried to convert it to a JApplet the graphic is "lagging". I can see the graphics blinking/flashing .....
Here is the code:
public class FallingBalls extends JApplet implements KeyListener, ActionListener { // VARIABLES // boolean gameOver; boolean win; // Buttons JButton start, pause, restart; // Character "The Runner" (32px x 32 px)
I've got a problem with my applet when I run it in a browser (firefox mainly but nothing else is working neither). First of all, the program is "unsigned" according to firefox security system, but I don't think that's where to problem lies. When I start the applet (as an html application) it says:
AccessControlException
Then it says: Access denied ("java.io.FilePermission" "bla, bla, bla (img source on my harddrive)" "read")
How do I get this to work? This is the picture I'm trying to implement: [URL]...
I am developing a game where a player has to find a path in a maze. Right now the player can only click the buttons on the maze. I need an option to use the arrow keys.
I have picked up pieces from my code to illustrate my problem. Below is the code. If I call "AnyClass" in the "AppletClass" it works but when I call "MiddleClass" in the "AppletClass" and MiddleClass" calls "AnyClass" it does not work. In my project at www.hiredforoneday.com I call 4 panels in CardLayout before I call "AnyClass" which is the "Maze"
I am trying to make a japplet that has open, zoom in and zoom out buttons for pictures. I am not sure how to go about an open button that will read the file. I have the picture url hard coded in the file to open but would like an open button with a file/folder dialogue.
I'm not exactly sure what the draw button is supposed to do specifically, all i know is that it is supposed to draw both rectangles and ovals. The problem I am having is that when ever I click Draw Rectangle, it draws rectangles jusst the way I want but when ever I click Draw Oval, the program keeps drawing rectangles. I've tried repaint and clearRect methods but I did not manage to get them to work. I'm not sure what the problem is right here, I just cannot get it to work. Is there anything you guys can see that might be causing this? It's always good to have a different person look at it then myself. Also, I'm trying to implement a boolean for draw oval but I don't know where to put the if then.
public void init() { length = new JTextField(10); width = new JTextField(10); btnDraw = new JButton("Draw"); btnClear = new JButton("Clear"); btnDrawRectangle = new JButton("Draw Rectangle"); btnDrawOval = new JButton("Draw Oval");
So I'm trying to make an applet and I found that Thread.sleep() to simply delay is a bad idea.
I'm not sure how to use the Timer class to implement a same version of sleep() to delay 6 seconds. I am trying to do this in a for loop to delay before every loop. How can I implement this?
This code is after the init() method. For simplicity I didn't include. Assuming I did:
Timer t = new Timer(6000, null); public void actionPerformed(ActionEvent e) { try { URL rsUrl = new URL("http://rscript.org/lookup.php?type=namecheck&name=" + n1); BufferedReader br = new BufferedReader(new InputStreamReader(rsUrl.openStream())); for (count = 0; count < maxCount; count++) {
This is what he wants: He wants us to prompt the user to input x values and y values (that will be entered into an array when clicking one of the two buttons (this one will say: Add point)). When they click the second button (draw lines), it should take all the points and draw a line that connects all the points together using a method that we write. In the method we have to call the paint method up which the lines will be drawn. The lines drawn should be touching every point added. It shouldn't have parameters. It will also use Graphics painter = getGraphics(); We can't use frames either.
I have everything up until the method understood.
How to write a method that will draw a line from points inputted that is called up in the action listener when the second button (draw lines) is pressed.
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:
One of my official site is not disaplying the content in machine#1 IE10 browser.And the same site is showing data in another machine#2. I compared the both machines JRE and JDK settings but no difference found.
I'm a first timer at jsf, and right now I'm learning how to use ajax in jsf. i got a problem when i click a command link i want to change in a content, but when i run my web and i click the command link it didn't do anything. This is the source :
<?xml version="1.0" encoding="UTF-8"?> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"
[Code] ....
In this code when i click the Home button it suppose to change the ouput text to a string that store in my bean. This is my bean:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package UI; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped;
[Code] .....
At first the output text value is the same as the string i store in the bean. but when i click the commandlink, it didn't do anything, is there something wrong with my code?
I am trying to read a content of file downloaded from ftp and return it as a String. This is what I use:
Java Code:
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.commons.net.ftp.FTPClient; public class Test { public static void main(String [] args) throws IOException{ FTPClient ftp = new FTPClient();
[code]....
The code does not work, although all the links are correct.
I am working on a little project to create an App that can read contents from a website and return it back to my app. What protocol to use for that. Just the reading/retrieving content from a website.
I am fallowing programming tutorials on youtube.And this code is for reading zip files content.I did the same things like in the video.But Code dosent work
String contentType = fi.getContentType(); gives text/plain when my file is.txt file and gives image/jpeg when my file is .jpeg file but when my file is .jar or .docx it will return application/octet-stream and application/vnd.openxmlformats-officedocument.wordprocessingml.document respictively so what to do to get exact mime type.
I was trying to store the content JTextField on char..... Here's the instruction of program--->>create a GUI program that convert letter into corresponding no. EXAMPLE:
if user enter "c" then it will output "3"...... like a=1,b=2,c=3,......
Here's my code
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class convert extends JFrame { private static final int width = 400; private static final int height = 300; private JLabel EN,EQN;
I have a text file which contains to integer values I need to retrieve for each item (total of 56 items in the file). One is an item number, the other the weight ("Item: " + number + "Weight: " + weight). I am trying to build an array list that will add each set of data to it. I know that when I add the item array to the arraylist it is storing the array variable and not its contents, so is there a way to easily copy that data array to the array list?
I am trying to make a program to go on a stock website find the value a particular stock is at and display it to the user. Then repeat at your selected timeframe.
I can get my code to read the entire source of the page or open a page but I cannot seem to get it to find something within the source.
What It would do when completed. Get input from the user on what stock and sight to search and how often to check it. Once the run button is clicked I would like it to take the input from the user and run in the back ground going on the website searching the stock and display the numbers back to the user. I have only been able to have it display the entire source code though, not just the stock numbers.
I have a main class AddressBook where I use ArrayList<Contact> addressBook = new ArrayList<>(); to add information such as name and phone numbers in my Contact class. How do I go about accessing all the information (names, and phone numbers) that is stored in my Contact class? What happens when I print it out is it only prints out the last input of name and phone number and not the entire collection of names and phone numbers. How do I print out the contents of ArrayList?
I am creating a webapp project , in which i have loaded my JSP page having JSTL tags in a DIV tag successfully but when user clicks on a radio button a jquery fires which loads that perticular div tag , and the html content in that div tag is then loaded again but not the JSTL content..
Is there an existing way to bind the content of a ListProperty? Consider the following:
private final ListProperty<Worker<?>> workers = new SimpleListProperty<>(FXCollections.observableArrayList()); public ListProperty<Worker<?>> workersProperty() {return workers;} public ObservableList<Worker<?>> getWorkers() {return workers.get();} public void setWorkers(ObservableList<Worker<?>> workers) {this.workers.set(workers);}
[Code]...
What I want to do is bind the content of the stateWatchedWorkers list to workers. If the entire workers list is replaced, I want stateWatchedWorkers to be updated to match the content of the new list. Put another way, I want the stateWatchedWorkers list to be mapped to the current list being held by the workers property.