|
thanks i'll check it but i know the problem is that i am not allowed to read that file but the strange thing is there isn't any problem with firefox.
|
|
|
|
|
i've tried same code without applet and i am still getting same error i've done plenty of things with images in java but never experienced something like this. is there a way to make file readable?
|
|
|
|
|
ok i've found the problem. strangely java cannot load images when they are in the same folder with .java files so copying images to another folder solved the problem. if someone else have this problem ^^
|
|
|
|
|
I've read all articles in the internet, but couldn't succeed in array input. it gives me an error at System.in.read(client[i]); Can you tell me the simpliest way to input int array? Thanks.
package biznes;
import java.io.InputStream;
public class Vavejdane {
void Input() {
int[] client = new int[10];
for ( int i : client)
{
System.out.println("Vavedi masiva");
System.in.read(client[i]);
}
}
}
|
|
|
|
|
LORDA12 wrote: for ( int i : client)
You are iterating over all integers stored in the array. Which means that i will take the values of the integers currently in the array (which are not initialized), which means i will have an undertermined value. The you use this i to access elements of your array, which is wrong.
You should write your loop this way:
for ( int i=0; i<client.lenght; i++)
(not sure anymore if it is client.size or client.lenght, you have to look it up since I do not use arrays this way much often).
|
|
|
|
|
The problem is not there. Java initializes automatic to 0. The problem is in System.in.read(). I don't know what parameters I need to input the array from the keyboard.
|
|
|
|
|
LORDA12 wrote: The problem is not there. Java initializes automatic to 0.
There's certainly a problem there anyway: first you shouldn't relly on initialization, this is a very habbit, and second even if everything is initialized at 0, it means that you will always store your character in the first element of your array (all the elements of your array are initially 0, so if you iterate over them and do client[i], it will always point to the first element of your array).
Furthermore, did you look at the documentation of System.in.read ? It doesn't accept any parameter and returns a character. So, you have to write it this way:
client[i] = System.in.read();
Also, as it is returning a character, you should store the return values inside a character array. What do you want to do exactly ? Ask the user to type in numbers (so, he can enter several characters for one element of your entry) or ask the user to type in characters (one character for each element of your array) ? This makes a big difference.
|
|
|
|
|
LORDA12 wrote: I've read all articles in the internet
Really? all 24 billion of them? Wow, you should apply for an entry in the Guinness Book of Records.
Did you look in the official Java documentation? the page on System.In? that explains how Read() works.
|
|
|
|
|
Try this:
client[i] = System.in.read();
[editied so it'll work]
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
modified on Monday, November 8, 2010 10:01 AM
|
|
|
|
|
" System.in.read(client[i]);" it can be compiled?
according my experience ,you may do like :
DataInputStream dIn = new DataInputStream(System.in);
for ( int i = 0; i<10; i++)
{
client[i] = dIn.readInt();
}
|
|
|
|
|
Hi,
I'm kinda new to programming and with not much knowledge on Java. But this is urgent!! I need help in research. I'm need to create a mobile application using Android and Eclipse.
Objectives:
To develop a mobile application that would be able to push help messages in the event whereby the mobile user requires assistance.
Scope of project:
Develop a mobile application that;
• A module to detect movements
• A decision making module with the intelligence to trigger an alert based on a set of rules
• A module to push an alert message to a 3rd party e.g. via the SMS
Any ideas on how I should go about doing this? Thanks in advance. Best Regards.
|
|
|
|
|
Smaini Nurbs wrote: I'm kinda new to programming and with not much knowledge on Java.
Well I would suggest you spend some time here[^] learning the language.
Smaini Nurbs wrote: But this is urgent!
Only to you I'm afraid.
Smaini Nurbs wrote: I'm need to create a mobile application using Android and Eclipse.
Based on your previous statement I would suggest you are expecting too much. Programming is a fairly complex discipline and without a good grounding in the language you want to use, and the platform you are developing for you are not likely to find this very easy. If you feel your knowledge of Java is sufficient then you will find lots of samples by looking at the articles here on CodeProject, or by doing a Google search.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi everyone,
I not really good with programming, so I need some help. Does anybody know how to create a stopwatch for an Android phone using Java programming? I don't know where to start. So this is what I have found so far. Thanks in advance for the help.
package com.novoda.runbuddy.activity;<br />
<br />
public class StopWatch {<br />
<br />
private long startTime = 0;<br />
private long stopTime = 0;<br />
private long elapsed = 0;<br />
private boolean running = false;<br />
<br />
<br />
public void start() {<br />
this.startTime = System.nanoTime();<br />
this.running = true;<br />
}<br />
<br />
<br />
public void stop() {<br />
this.stopTime = System.nanoTime();<br />
this.running = false;<br />
}<br />
<br />
public void reset() {<br />
this.startTime = 0;<br />
this.stopTime = 0;<br />
this.running = false;<br />
}<br />
<br />
public long getElapsedTimeMicro() {<br />
if (running) {<br />
elapsed = ((System.nanoTime() - startTime) / 1000);<br />
}<br />
else {<br />
elapsed = ((stopTime - startTime) / 1000);<br />
}<br />
return elapsed;<br />
}<br />
<br />
public long getElapsedTimeMilli() {<br />
if (running) {<br />
elapsed = ((System.nanoTime() - startTime) / 1000000);<br />
}<br />
else {<br />
elapsed = ((stopTime - startTime) / 1000000);<br />
}<br />
return elapsed;<br />
}<br />
}<br />
|
|
|
|
|
yes, that's a class with certain methods which to me look like it could work for a stop watch.
Start here
And it would be easier to start with some regular Java-Programming, android needs some more advanced skills.
regards
Torsten
I never finish anyth...
|
|
|
|
|
can u help me write a code to get the frame that is clicked by a user while playing a video.
is there a way to do this in flash player?
|
|
|
|
|
This sort of question is impossible to answer in a forum like this. Take a look at some of the articles here on CodeProject for some sample code.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
Did you notice that your code is impossible to read here? Please edit your original question and fix the <pre></pre> tags and indentation so your code appears correctly like so:
private static void debug(String msg) {
if (DEBUG)
System.out.println(msg);
}
Use the Preview button to check it before posting.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
sorry about the code... i already correct that.. n thanx for your correction i really appreciate that
|
|
|
|
|
why removeRange() method in ArrayList class is given as protected access specifier?
What changes will make in coding when compared to other methods?
Please any one explain with coding....
|
|
|
|
|
I actually never used this method
It's much smarter not to throw out certain values of a ArrayList. Instead set up a allow / disallow mechanism. This has some benefits like an advanced set content of the list, and the possibility of switching values back on.
Also, if a ArrayList is modified, imho there is a new object thrown back(? - not absolut shure about that)
regards,
Torsten
I never finish anyth...
|
|
|
|
|
Because it is overriding a method in a base class.
See AbstractList.removeRange.
The javadocs for that method provides the implicit reason for the method. It is intended as a performance assist to children only. It is not intended for public usage.
|
|
|
|
|
I want to create a Netbeans desktop application and use Hibernate to communicate with the database. I wish to use Eclipse to configure the communication with the DB since Hibernate Tools in Eclipse allows you to automatically create the Dao objects (very useful since they receive and return objects i.e Employees object), along with mapping files and Java classes.
How can I make this configuration in Eclipse and then move it to my Netbeans desktop application? Will there be any issues if I do this? I have around 1 year experience using Java and use Hibernate daily, but have never configured Hibernate from scratch or created a Java desktop application from scratch.
|
|
|
|
|
I guess you could copy the config?
Eclipse & Netbeans are just IDE's. The functionality you are after must have some config/code behind being generated that you can use. That said, if you feel the need to use one or other then I would recommend you stick to the one.
As a n aside, at work we have some people who use Eclipse and others use Netbeans, it does not actually make a lot of difference. If i just want to do something quick, I prefer to use notepad++ for editing and the command prompt for builds. But then I am old.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
The problem is that Netbeans provides better tools for creating a desktop application, while the Hibernate Tools of Eclipse to generate my dao files.
|
|
|
|