JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
static String test=null;
public Card() {
 setValue();//if we dont call this our value wont be set
}  
public static void setValue() {//set value
 test="of";
}

Why such ridiculous contortions? Why not just

static String test="of";
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

By matching the number and types of the parameters in the call to those in the constructor's definition (just like any overloaded method call)

stultuske commented: beaten by the punch :) +14
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

In that case, there's no difference.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Something like:
When the user selects the first operator that is the first node. When the use puts something in the ... to its left, that becomes the left sub-node of that node, similarly for the right ...
If one of those sub-nodes is another operator then that's a new node with its own left and right sub-nodes.

Maybe you just need to start coding something - eg just entering (a AND b) (no recursion needed here) then what you learn from doing that will help you towards the next step.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Well I'll be blowed! It seems I've had that wrong all along. Thanks for setting me right Norm.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

if (image == null) ...

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

new ImageIcon(...) is famous for not throwing any exceptions when it fails to find the file; it just returns null. JLabel is happy to accept null for its image icon, so the final result is no image and no error messages. We see that quite often in DaniWeb "help!" posts.
After a new ImageIcon(...) it's always a good idea to test for null and diagnose or throw an exception so you know what went wrong.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

It's not the compiler that can't find them, its the runtime. It seems it can't find the .class file, maybe because it's not in a folder called threadpool in the classpath?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

"NOT ( ( b ) AND ( a )) ... This formula is terminated has AND is the root"

Are you sure? I would expect the resulting tree to look like this:

NOT
                /   \
               /     \
            (null)   AND
                    /   \
                   /     \
                  a       b
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Just start writing a simple method eg
public static boolean isValidChange(String word1, String word2) { ...
You have 3 cases to test for - change, add, remove a letter. Code and test those 1 at a time. Start with 1 letter changed, that's probably the easiest.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That's right. It's messy, but $ is a special char in a RegEx and needs to be escaped with a \. But \ is a special char in Java string literal, and needs to be escaped with a second \. So to get a literal $ in a RegEx you need the Java string literal "\\$"

DavidKroukamp commented: gr* extra info, i jus tried \\ :) +6
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yes, the param for split is Regex, and $ is a special char in regular expressions. You have to escape it with a backslash to use it as a literal $

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That looks OK - test it with more than 1 runnable/thread. Does it run as you expect?

Blocking Queues:
Its a queue - a first-in first-out list. You can put things into it from anywhere, any time you want.
You have a thread that takes the first item from the queue and processes it, then takes the next item etc. If there are no items on the queue the take method blocks (waits) until someone else puts an item on the queue. There's some housekeeping to do around how you shut it all down when the program wants to exit, but basically that's it - just 2 methods: queue.add(aRunnable) and queue.take()
This tutorial looks OK: http://www.javamex.com/tutorials/blockingqueue.shtml

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If, like me, you're the kind of person who learns best by doing, here's what I suggest. It comes down to building the pieces one at a time, mastering each before moving on.
Create a little Runnable that prints "hello", sleeps a couple of secs, prints "goodbye" and finishes.
Create a little test program that instantiates your Runnable and creates a new Thread to run it.
Improve the test program that to include a blocking queue of Runnables and load a few Runnables onto it. Create a new Thread that loops taking Runnables from the queue and running them one at a time until the queue is empty.
Do the same thing but starting a number of instances of that Thread simultaneously. Now you have a simple thread pool implementation.

Do resist the temptation to skip steps. At each step you will learn about what code you need, what exceptions need to be handled etc, and what kind of problems and situations this simple version doesn't handle well. The whole thing shouldn't take more than an hour.
When you have finished you will understand what ThreadPoolExecutor is all about and how much it's doing for you, and you will understand how to use it, and why its constructed that way.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

OK, joking aside...
If you want to know "how ThreadPoolExecutor can be used to achieve my goal" then the tutorials (as opposed to the sample code) on the web are what you need. It's unlikely that anyone here is going to write a better one for this Thread.
When you say "I want to know how a thread is implemented and thread pool in implemented" what are you asking? Do you want to know about the internal mechanisms of Java threading (not easy) or just how you can implement (a) a simple thread and (b) a simple thread pool (easy)?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I googled ThreadPoolExecutor and immediately found loads of tutorials and examples for the use of this class. If your Google is broken I can forward some of them to you :-/

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

An abstract class can declare ordinary variables. An interface can only declare final static "variables" (AKA constants)

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

^ yes! Well spotted! Yet another demo of why correct indentation is essential.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Time for some debugging:
Add a print statement at the start of your actionPerformed to see if its being called.
Print table.getSelectedRow() just before the if, to see if it's what you expected.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If you can't see it in "uninstall a program" then you will have to seek it out and destroy it by hand. Start by looking in your PATH settings - command prompt seems to be finding the old version in your PATH. That should tell you where the old JRE is installed, so you can delete that whole directory. You;ll also have to hunt through all the other environment variables (eg CLASSPATH) to update them to point to your current version. It may take a few passes of trial and error to get all the referneces updated, which is why a roper uninstall is better.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

D:>java -fullversion
Java fullversion "1.3.1_01

You may think you have updated your Java, but this proves you to have a very old version of Java lying around, in addition to the newer version that your IDE is using.
It's not unusual to discover people have one Java runtime (eg in c:\Program Files), and another inside the IDE installation.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if(table.getSelectedRow()<0) // help required to implement this logic!!
{
JOptionPane.showInternalMessageDialog(rootPane, "Please select a row from the table first!");
...

At a quick look what you've got seems OK. What exactly is the problem with the code you posted?

mKorbel commented: +1 showInternalMessageDialog +11
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You seem to have a very old version of Java lying around. Just uninstall it then install the latest JDK (1.7.x).

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Yes it is. Difference is 30 mins, ie 30*60*1000 mSec. You display the difference in hours, not minutes, and in integer arithmetic this is truncated to 0 hours.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That's a good start. Does it give you the result you wanted?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

This isn't a "we do your homework" service. You have to do the work, and we help you.

DaniWeb Member Rules include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/forums/faq.php?faq=daniweb_policies
http://www.daniweb.com/forums/announcement8-2.html

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You can use the getTime() method to convert your Data object to milliseconds. Do that for both dates and subtract one answer from the other. That gives you the diff in mSecs.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You can use the SimpleDateFormat class to parse a time in format "hh:mm" and convert that to a Date object. You can convert two date objects to millisecs and subtract one from the other to get the time difference. You can finally use that to create a new Date object for the difference, and format it with the same SimpleDateFormat

Details, as always, are in the API JavaDoc

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I think you may be confused about how many classes there are?
public void paint(Graphics g){... is just an ordinary method in your Eyes class. Like any other method it can simply use the variables of that class, including the ints red, green and blue that were initialised in the constructor.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

No problemo. Mark this solved?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

AWT still works, and underlies Swing. You can think of Swing as AWT version 2. AWT and Swing work on all platforms, Windows, Linux, Mac ...

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

There are many ways, but why not go with the easiest to follow and most generic?
create a boolean dataIsValid = true
if you find bad data set it to false
test it before writing to the file.

But in this specific case you could return; from the method immediately after reporting an error.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Java has:
AWT the original GUI class library from Java 1, obsolete except to the extent that it was the basis for
Swing the updated and improved version of AWT that's current
SWT a Windows-specific class library that gives direct access to the Windows GUI environment. Much loved by IBM, but not system-independent like Swing.

You'll find vast amounts of Swing tutorial info on the web, but IMHO this is the best
http://docs.oracle.com/javase/tutorial/uiswing/

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I guess propertyIDTxt is a text input field of some kind? In which case you should be testing its text, not the field itself.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Google Java ProcessBuilder for examples and tutorials

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

.length gives you the size of an array.
To get the size of a String you need to call a suitable method of the String class - remember method calls always have a ( and a ).

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

if (propertyID.length < 1)
propertyID is an array, so you are just testing its declared number of elements.
I guess you intended to test the length of the String propertyID[numberOfPropertiesInArray]

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Normally you would have a stack where you can push values and operators as you parse them, and pop them when it's time time to execute each operator.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I looked at your files, now I don't understand your question!

how do I create a file with a list of all the words that can be accessed by an user input to verify if the word exists?

You already have that file

I dont know how to create or access this file through the main.

The code already has methods to read the file into memory, and check if a given word is present.

I know that I have to use equals or == to compare the input

The code contains an example of exactly how to do that

Maybe you need to read that code very carefully again - it seems to contain everythung you need.

Finally, when you have code to post, include it in your message and enclose it on CODE tags (highlight all the code and click the CODE format item above the message edit area). That way people can see the code easily, and with comments, constants etc colour-coded.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Just set a java.util.Timer to run your method after an initial delay of 30 minutes or whatever.


@stultuske: what are you smoking? Did you miss something out of that code, or was it pure Monty Python?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That's good news. Well done!
J

emclondon commented: :D +2
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Hide keeps your whole form with all its components and other variables live in memory - it just hides it on the screen. If you want to re-open it with the existing data etc still there, hide is appropriate.
If you want to re-open it with its contents/state reset to the original, then you would do better to get rid of the old form rather than hide it, and create a new one when you need it. You can get rid of a form by calling its dispose() method.

For close, check out JFrame's setDefaultCloseOperation method. That defines what to do when the close button is clicked. The default is to hide the window. Mostly you would use setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); for a main window in a simple application.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

OK. In that case it's easiest just to validate the input when you need to use it. c0rthingy's edited version is a good place to start - test for the length being exactly 1, use charAt to get the one char from the String, then test that for being in the right range eg 'a' to 'z'

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

OK, parallel post with your improved def.
Do you want to check that when the user types into the field? When the user pastes into the field? When Java code changes the field's text? When focus leaves the field? When the user presses OK?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

oh it means that i should accept a b but not bd fg

Do you mean that the input can only be 1 character (or String of length 1), not any longer?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

"there is only 2 ways"...
there's always another way...

the one in JTextField's JavaDoc is neither of those (it extends the default model), but has the official stamp of approval.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

What does "only characters... not strings" mean?

but whatever, here's one way
http://www.devx.com/tips/Tip/14311

and the intro to the JavaDoc for JTextField shows another way - this one is an officially-approved approach

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

When you ddisplay an Object in Java, it calls its toString method. Every Object has a toString method because they inherit one from the class Object. That inherited method prints the name of the class and the Object's hash code (probably, but not necessarily its address). To display something more meaningful for your class, override toString. Eg

class Person {
   String name;
   int age;
   ...
   @Override
   public String toString() {
     return "person " + name + ", " + age + " years old;
   }
}
Twistar commented: Thank you, this solved my problem! +0
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Just noticed you are using keyPressed rather than keyTyped, so you have a keyCode not a keyChar. KeyCodes relate to the physical keyboard, rather than to actual characters, so, for example you get keyChar 'A' from keyCodes <shift key> followed by <a>. Because <space> is a physical key, the previous code will work OK, but it would fail for 'A'. The correct way to test for a keyCode being the space key is

if (keyCode == KeyEvent.VK_SPACE)

Your lack of keyboard events is probably a focus issue - your listener needs to be attached to the component that has keyboard focus. This is often a problem! There is a better way to handle keyboard input like this, it's called Keyboard Mappings, see
http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html
... but it's quite a bit to adsorb at first, so you may prefer to sort out which component has the keyboard focus in your app.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Space is decimal 32, yes, but far better to use a char literal to avoid any possible confusion or error (remember that char is a numeric type):

if (key == ' ') ...