7,116 Posted Topics

Member Avatar for king000000
Member Avatar for jwings

I couldn't see where you call excute() for your SwingWorker, which may explain why it doesn't execute. In any case, all it seems to do is to start a swing Timer, so why bother? Just start the timer from your ordinary in-line code. If you get exceptions. post them so …

Member Avatar for JamesCherrill
0
173
Member Avatar for jockfaire

If you want a specific L&F for your application then it's best to set it programatically - just think about what happens when you or someone else runs it on a different machine.

Member Avatar for JamesCherrill
0
142
Member Avatar for Johannady2

You are reading images one ata time, but then trying to create a new array for each image. You can't assign an image to an array, just to one lement of the array, eg private ImageIcon[] icons = new ImageIcon[4]; icons[0] = getClass().getResource(name[0]); icons[1] = getClass().getResource(name[1]); // etc (or use …

Member Avatar for JamesCherrill
0
607
Member Avatar for TTTHXC

Looks like basics[i] is null for some value of i. Print i and basics[i] at that point in the code to see which element is not initialised, them backtrack in your code with prints to see why/where the initialisation is missing.

Member Avatar for TTTHXC
0
103
Member Avatar for Majestics

Are you using a layout manager? Layout managers ensure that your forms can re-size as required, eg when moving from one OS to nother with completely different font sizes. They come in various flavours, from very simple to you-can-control-everything-in-great-detail. See http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html

Member Avatar for Majestics
0
165
Member Avatar for LuisJ

You use a loop just like in C, except that instead of just breaking out of the loop you use a tidy do/while loop, eg do { // stuff // get answer for y or n to continue } while (answer.equals("y"));

Member Avatar for JamesCherrill
0
200
Member Avatar for lakshay21

The thread sleep method doesn't work well, if at all, in Swing. Your thread blocks Swing's own thread from executing, so the screen never gets updated. You have to use a swing Timer to update your animation every "n" miliisecs. Here's a trivial exaxmple that shows the correct technique: import …

Member Avatar for JamesCherrill
0
160
Member Avatar for gedas

Come on gedas, you're better than that. Just Google ` java send http request`

Member Avatar for JamesCherrill
0
87
Member Avatar for spowel4

Good start, but inside the loop you have an array that you also need to loop through - ie you need 2 nested loops.

Member Avatar for JamesCherrill
0
220
Member Avatar for soham.m17
Member Avatar for Johannady2
Member Avatar for rajesh1158

PriorityQueue uses a private array to hold the queue. It automatically re-sizes the array when needed. By specifying an initial capacity you set the initial size of that array. Its just an optimisation thing - if you know how big your queue will be then the array can be made …

Member Avatar for JamesCherrill
0
201
Member Avatar for MoMule

Line 91 you call getWidth() without an explicit object, so that's the same as this.getWidth(). "this" is the current instance of JavaApplication12, which extends JFrame and inherits getWidth() from it. So 132 seems like a perfectly reasonable value. You will see a different result if you call ant.setVisible(); rather than …

Member Avatar for MoMule
0
1K
Member Avatar for SuperManofBC

DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" What have you done so far?

Member Avatar for SuperManofBC
0
210
Member Avatar for mehnihma

That seems to suggest that players is declared as a String - you haven't posted it declaration.

Member Avatar for mehnihma
0
533
Member Avatar for speakon

There's no code there that can update the database, so how exactly are you trying to update the values?

Member Avatar for speakon
0
377
Member Avatar for yuyuttiu

I just had a quick look, so maybe I missed something , but anyway... The original correctly uses a Timer to call its actionPerformed method at regular intervals. That's how the animation is updated and finally repaint() is called to tell Java that the screen needs to be updated. (Java …

Member Avatar for yuyuttiu
0
652
Member Avatar for TIM_M_91

Your main method runs, it creates an instance of your class, and then it's finished. If you add some code to call the "f" method then you should see some output. ps having a variable called f and a method called f isn't an error, but it is potentially confusing.

Member Avatar for JamesCherrill
0
185
Member Avatar for GeekTool

^ basically right, except that nowhere does Java define any mapping between 0 and 1s vs the boolean values false/true. Bitwize operators work on each bit of an int value, the logical operators work on individual boolean true/false values, but there's no connection between these two versions.

Member Avatar for NormR1
0
561
Member Avatar for AP07KJT

> I've changed: > discsArray = new ArrayList<CD>(); > peopleArray = new ArrayList<Person>(); > To > discsArray = new ArrayList[CD]; > peopleArray = new ArrayList[Person]; Those changes completely destroy the original meaning of the code, so although they may compile it's unlikely that it will now work as intended. What …

Member Avatar for JamesCherrill
0
3K
Member Avatar for andy_m

Probably becuase v2 is zero on line 24. Perhaps you should be setting v2 somewhere?

Member Avatar for andy_m
0
140
Member Avatar for ruzt
Member Avatar for zina_a

Realistically I don't think you can. If machines on the network chose not to talk to you then you can't find them. You can use the "ping" protocol to find machines that are happy to respond to a "ping", but that's about as far as it goes.

Member Avatar for JamesCherrill
0
75
Member Avatar for asif49

1. In a linked list the nodes are not numbered, so it makes no difference whether you chose the count from 1 or 0 as long as you count the correct number of total entries in a consistent way. 2. Each node in a linked list contains an Object, and …

Member Avatar for asif49
0
109
Member Avatar for MasterHacker110

FYI my Win 7 JDK/JRE installation didn't set any program association for .class files, just .jar's

Member Avatar for MasterHacker110
0
134
Member Avatar for venkateshyeluri

Zaad's suggestion is a good way to go. You can improve it slightly to protect against people searching the web for well-known MD5 values by "salting" the password, ie adding some extra garbage characters (hard coded in your program) to the password before calculating the MD5 digest.

Member Avatar for JamesCherrill
0
218
Member Avatar for TTTHXC

You don't say how you re-wrote it, but for future reference, a Java char is a numeric value. If you get a single char (eg by converting a String to a char array) then you can just use that value in a numeric expression without any further conversion, eg String …

Member Avatar for JamesCherrill
0
263
Member Avatar for anuj_sharma

> Can we create a text file of the size specified by the user? Yes. Just ask for the size and write that number of bytes to a new file. For large amounts of space it may be safer to create a new directory and fill that with 1GB files, …

Member Avatar for anuj_sharma
0
115
Member Avatar for jade_91

Do you mean each node can contain an int **and** a String, or that each node can contain an int **or** a String, or do you mean you want to have two types of lists, one containing only ints and the other containing only Strings? (Each of those has a …

Member Avatar for Zaad
0
428
Member Avatar for GeekTool

> An integer literal is of type long if it ends with the letter L or l; otherwise it is of type int. It is recommended that you use the upper case letter L because the lower case letter l is hard to distinguish from the digit 1. http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

Member Avatar for sabbib
0
154
Member Avatar for hous3aholik

How exactly do you intend to use the boolean array? What is the logical proposition that will be true ort false for each element? Most people define a Card class, and have an array of Cards.

Member Avatar for JamesCherrill
0
747
Member Avatar for prem2

@satyarao: I think after one year the OP has either solved this or given up, regardless of the value or otherwize of your suggestion.

Member Avatar for JamesCherrill
0
173
Member Avatar for programing

See line 30. After you press OK it is waiting for you to type in file name on System.in

Member Avatar for NormR1
0
790
Member Avatar for libathos
Member Avatar for reitzscape

Seriously - you have 9000+ line java file? That's insane. Break it up into individual files for each class. Usually "error: class, interface, or enum expected" means you've messed up one or more { } pairings, but with a file that size you'll have a job finding them. If all …

Member Avatar for NormR1
0
345
Member Avatar for ilovejava

DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Start your own thread.

Member Avatar for JamesCherrill
0
323
Member Avatar for thompsonSensibl

What exactly do you mean by the object's name? Objects in Java do nor have names. You can have an instance variable `String name;` in the Fruit class and set that.

Member Avatar for JamesCherrill
0
179
Member Avatar for programing

You create the window's contents in the `init` method, but nowhere do you call that method. This is not an applet.

Member Avatar for NormR1
0
580
Member Avatar for DEAD TERMINATOR

Line 239 after an error you re-call getCoordinates but you do NOT use the returned value at all.

Member Avatar for NormR1
0
168
Member Avatar for EPerminas

It's pointless trying to add more code until the code you already have compiles and, as far as is possible, executes correctly. Stage 1: fix those compile errors.

Member Avatar for JamesCherrill
0
374
Member Avatar for arathy nair

That looks like your keys are Strings. In the Comparator you could parse them into integers and compare those values.

Member Avatar for JamesCherrill
0
228
Member Avatar for socialbutterfli

That's println (short for print line). You have a capital I for India instead of a lower case l for Liverpool

Member Avatar for socialbutterfli
0
1K
Member Avatar for erms

setRGB(x, y, 2000000) - why not? plus, see this: http://www.devdaily.com/blog/post/java/getting-rgb-values-for-each-pixel-in-image-using-java-bufferedi

Member Avatar for NormR1
0
287
Member Avatar for sciwizeh
Member Avatar for vinnitro

You have overidden JApplet's paint method, which is the method responsible for ensuring the contents are painted. That's why they don't get painted. Add a call to super.paint(g) as the first line of your paint mathod. This will ensure that everything in the applet gets painted before you draw your …

Member Avatar for vinnitro
0
205
Member Avatar for SCass2010

In Java you do this by creating a utility class with all those functions defined as static (so they don't need an instance to be created). A good example is the Math class in the standard Java API http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html you can simply `import` this class at the start of your …

Member Avatar for SCass2010
0
441
Member Avatar for kumaresen

I'm going to disagree with the previous advice (sorry guys). Initialising word to some arbitrary value will make the compile error go away, but it won't help your program to work properly. Looking at the code, it looks like you want word to contain the text that the user typed …

Member Avatar for NormR1
0
241
Member Avatar for Johannady2

You should be able to do it by checking System.in.available() inside the timer's loop each second to see if the user has typed anything. If he has then you can use a next... to see what that input was, and exit the timer loop as appropriate. Unlike next... available() does …

Member Avatar for JamesCherrill
0
413
Member Avatar for ippo

If you have "n" tickets each with "m" numbers on it, you can represent that as a 2D array [n][m] ... The `Collections` class has methods you can use to `sort` a list of numbers into order...

Member Avatar for JamesCherrill
0
1K

The End.