1,678 Posted Topics

Member Avatar for nymph

[url]http://java.sun.com/javase/6/docs/api/java/lang/SecurityManager.html#checkDelete(java.lang.String[/url]) That might be of interest to you. I'm pretty sure if there is some security measure, you aren't going to be allowed to delete the file. That is, after all, the point... right?

Member Avatar for stultuske
0
90
Member Avatar for death_oclock

It's not necessarily better style/design. And if the job of one function requires another function, then you should call the other function within the first function. You shouldn't use main to do it. And I'm kind of curious how to do this as well, which is why I am upping …

Member Avatar for death_oclock
0
156
Member Avatar for ezkonekgal

I don't know what Garwick's algorithm is. Logically, if one section of the shelf needs more room, you will then have to re-divide the other sections so that the whole thing takes up the same amount of room as it did previously. Obviously, your project description is suggesting a method …

Member Avatar for ezkonekgal
0
218
Member Avatar for blackslither

Dijkstra's algorithm would not be easy to modify, I don't think. . if you do the algorithm on paper, you end up with a 'trail' of visited Nodes in your shortest path. This means that when you program it, you're essentially keeping track of each Node on the shortest path. …

Member Avatar for Murtan
0
1K
Member Avatar for boburob

Another thing, that isn't the source of your problem... you might need to have a different Object for each layout. You're using the same 'cards' GridLayout for both. I'm not really sure about that but I typically see a different one for each panel. (Someone confirm or deny that?)

Member Avatar for BestJewSinceJC
0
185
Member Avatar for Superstar288

If your class that you're making an ArrayList of is called Supplier, write a toString method in the Supplier class. The toString method should return a String that contains all the information (name, etc) for a Supplier. Then, for each Supplier in the ArrayList, do yourTextArea.append(Supplier.toString())

Member Avatar for Superstar288
0
149
Member Avatar for legilimen

Well, just for the hell of it, I'm going to write a Sudoku program also. It might take me a few days since I have other things to do this week and I don't know how to play the game yet. Lol. Could you post your input that's taking a …

Member Avatar for BestJewSinceJC
0
254
Member Avatar for peter_budo

How can I access variable in the frame from a component 2-3 levels bellow? The class that contains the user ID and password should have a get method. Just call it and return the relevant info to caller. No need to pass it to things that don't need it.

Member Avatar for BestJewSinceJC
0
166
Member Avatar for srs_grp
Member Avatar for ronpar2584

If its possible to do so then the Javadoc for RandomAccessFile will tell you how. edit: It looks like it should do it by default from what I just read. Post your code in code tags.

Member Avatar for ~s.o.s~
0
791
Member Avatar for Eggplant

[QUOTE=~s.o.s~;764923]> whenever you access a method, it gives you a summary of what the > method does, as given in the API ...so do the online java docs. But in most of the cases we end up with a bunch of CTRL + SPACE programmers who find it too troublesome …

Member Avatar for Eggplant
0
390
Member Avatar for 0-Roisin-0

Make a boolean allNums = true; 1. Create an array of size 20. 2. Loop: Read the numbers in, and put them into the array 3. Loop: Check the array at each index. If the number isn't there for any index, set allNums to false. 4. If allNums is true, …

Member Avatar for BestJewSinceJC
0
132
Member Avatar for PhiberOptik

try this [CODE=JAVA]File file = new File("C:/theFile.txt"); file.delete();[/CODE]

Member Avatar for PhiberOptik
0
354
Member Avatar for BestJewSinceJC

I managed to delete the only up to date saved copy of an important Java project I had (I know, I know). I have the compiled .class files and I know it's possible to decompile them. Can anyone direct me to any references or anything to help me do this …

Member Avatar for BestJewSinceJC
0
132
Member Avatar for Rameses

You can't use "==" as a comparator on Objects. On Objects, "==" will only tell you if the two Objects are at the same memory location, I believe. In any case, it will not compare the two things for equality like it would if you said "does int 1 == …

Member Avatar for BestJewSinceJC
0
93
Member Avatar for Joaoalex7

I would imagine that Puneetkay is correct since this is what I know from experience. But if you want to explicitly delete the file, use the File class. [url]http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html[/url] File myFile = new File("fileName.txt"); myFile.delete();

Member Avatar for BestJewSinceJC
0
704
Member Avatar for sheff21

Have you managed to send the site a request to look up the weather (based on the zip you send it) yet? If not, plain text isn't going to do you any good. So let us know which part you are stuck at.

Member Avatar for ~s.o.s~
0
158
Member Avatar for confusedGirl

Not really. I could be wrong, but I remember this girl making earlier threads similar to this one. Not that she deserves to be harassed, just ignored.

Member Avatar for BestJewSinceJC
0
202
Member Avatar for Alishaikh

I think you could also save yourself a lot of the if statements if you used a counter to index the correct part of the array along with modulus and/or division.

Member Avatar for ~s.o.s~
0
117
Member Avatar for randomFIRE

Does it have to be a JOptionPane? JOptionPane's are usually supposed to be used to display messages, not get them, I think. They can also display a list of choices and get the user's choice. Here's the Sun tutorial for JOptionPane: [url]http://www.j2ee.me/docs/books/tutorial/uiswing/components/dialog.html[/url] If you're open to using different types of …

Member Avatar for puneetkay
0
111
Member Avatar for bahr_alhalak

I don't see how giving suggestions is an unfair advantage, as long as nobody is doing his work for him. I can understand if you're unwilling to help him because he hasn't shown any effort (as I am) but if it's an unfair advantage, then any help given on Daniweb …

Member Avatar for verruckt24
0
142
Member Avatar for srs_grp

You didn't mention what you want to do with the data once you retrieve it. But you can retrieve any of the digits using theString.charAt(index). You can also use Integer.parseInt(String) once you get that digit, to see if its a 0, a 1, or neither. There might be a performance …

Member Avatar for BestJewSinceJC
0
228
Member Avatar for George2

George, I think I understood everything you were saying up to here. "I also want to register/unregister message sender/receivers dynamically." What does that mean? Because up until then, it sounded like you simply wanted a generic priority queue, which is not hard to implement yourself, since Java already provides a …

Member Avatar for BestJewSinceJC
0
433
Member Avatar for confusedGirl

Why would you use a loop to search? Look at the methods for the Vector class. Particularly, look at the indexOf method. If you override the equals method from the Object class, then use indexOf, it will return the index of the thing you are looking for. So your "search" …

Member Avatar for Ezzaral
0
343
Member Avatar for TheWhite

Yes, but that still doesn't guarantee that value will == 0, unless you explicitly set it to be so.

Member Avatar for BestJewSinceJC
0
98
Member Avatar for javafrustrated

And you don't have to use recursion to test whether something is a palindrome or not.

Member Avatar for BestJewSinceJC
0
160
Member Avatar for americaneagl

You want to put your choices in a while loop, so that they will continuously be displayed on the screen. [CODE]while(true){ // Your choices that you listed above go here. The way the program should exit is when the user inputs '4' to exit, you should say System.exit(0); // You …

Member Avatar for BestJewSinceJC
0
105
Member Avatar for amgupt01

[url]http://java.sun.com/j2se/1.4.2/docs/api/java/io/PrintWriter.html[/url] Look at the API. Do you see a constructor for PrintWriter that takes a String as an argument? (Change your code so that your PrintWriter takes the correct argument) You might want to look at this link, since from the API, it isn't immediately obvious which type of Object …

Member Avatar for gprest
0
176
Member Avatar for dimplomat15

First of all you need a class to represent each 'game'. The class would contain the following data: int correctNumber; int guessesAllowed; int guessesLeft; You might need a few more things. You also need to split each task into methods. For example, prompting the user for their guesses could be …

Member Avatar for dimplomat15
0
145
Member Avatar for Speedy Hawk

You can't create Objects of an abstract class. So its impossible to add them to an ArrayList. An abstract class defines methods/data so that any classes which extend it have to implement those methods/data. Read this. [url]http://java.sun.com/docs/books/tutorial/java/IandI/abstract.html[/url]

Member Avatar for Ezzaral
0
151
Member Avatar for programmingme

Couldn't you also convert the char to an integer, then compare the two chars? Being careful, of course, for case considerations?

Member Avatar for programmingme
0
145
Member Avatar for it2051229

Google 'Timer Java'. If I remember correctly, a similar question to this one was asked a few weeks ago, and the solution is to use the Timer class because it is invoked on the Event Dispatch Thread (and thus won't cause problems w/ your GUI stuff)

Member Avatar for Ezzaral
0
94
Member Avatar for ezkonekgal

Do you not understand Vernon's point about the variable ba? Learn the basics first, then work your way up. Btw, what are you referring to when you say 'input name'? Also, post your code that you think is incorrect, or ask a specific question. And make sure to use code …

Member Avatar for BestJewSinceJC
0
2K
Member Avatar for BestJewSinceJC

If I have a hash function h(k, f(i)) and f(int i){ return c * i; } And the first index that it tells me to insert the element at already has an element there, what do I do? Would the proper way to insert an element the first time be …

Member Avatar for BestJewSinceJC
0
246
Member Avatar for BestJewSinceJC

I'm trying to read in the whole file at once. If this code ever fails, my whole project will fail. I'm using the following: byte[] theFile = new byte[input2.available()]; then, input2.read(theFile); The API says something about blocking. What exactly is blocking, when will it happen, and how will it affect …

Member Avatar for BestJewSinceJC
0
91
Member Avatar for PhiberOptik

I just spent 5 minutes looking over your code and I have no idea what you're talking about. Could you explain what you want each one of your classes to do? Then, explain which of these classes is not working like you want it to, and explain how you want …

Member Avatar for BestJewSinceJC
0
218
Member Avatar for star100

Use code tags when you post code. Also, all you have to do to figure out if your code is correct is print out the array after you read it in. If it doesn't print out the same thing as the input file, then it isn't correct. To refer to …

Member Avatar for BestJewSinceJC
0
113
Member Avatar for nyalex

If I'm not mistaken, she is just looking for a way to "pause" after each word is displayed, but she doesn't know it. She thinks what Stul said above - that it's just not working - but it probably is working and just is disappearing too fast to be seen. …

Member Avatar for nyalex
0
296
Member Avatar for BestJewSinceJC

[CODE]public void generateBits(Node root, int current, int counter){ if (root== null) return; if (root.left == null && root.right == null){ list.add(new HuffCode(root.theChar, current, counter)); } else{ current<<= 1; //move all the bits 1 spot to the left generateBits(root.left, current, counter+1); generateBits(root.right, (current | 1), counter+1); } }[/CODE] Somehow, this method …

Member Avatar for BestJewSinceJC
0
98
Member Avatar for BestJewSinceJC

I had a problem w/ efficiency - The problem was that using String concatenation was inefficient for large text files, when reading the whole file into the String. I've since thought about it, and I guess this is because Strings are immutable - so every time concatenation is done, a …

Member Avatar for masijade
0
141
Member Avatar for xandres

Making a class serializable in java means that you can read it from and write it to a file in binary form. So when your program exits, that is when you should be writing all of your objects to the file. When your program starts, you read them in from …

Member Avatar for xandres
0
202
Member Avatar for BestJewSinceJC

I'm having trouble with storing bits as a byte. I've read probably 30 different sources about this already. I'm doing Huffman Compression. Lets say I read in the character "c" and I am supposed to output "1010". How would I go about doing that? I know how to write bytes …

Member Avatar for BestJewSinceJC
0
135
Member Avatar for neo_gr8est1

[QUOTE=neo_gr8est1;751733]Can someone please help with this project of mine? I am not really good at GUI... create a new account, check account status. and make purchase with a credit card. Create a New Account You must ask the user to input some information: applicant's name (e.g. "John Smith"), application date …

Member Avatar for javaAddict
0
94
Member Avatar for MrDiaz

^ That code looks wrong. Who modifies main to throw an Exception? Also, since his Exception is printing "Invalid ID", your code would print the same thing twice. And most importantly, when you declare a method as 'throws Exception' in the method header, the method that calls it has to …

Member Avatar for MrDiaz
0
130
Member Avatar for Demonisya

There are a lot of ways you could produce that code using while loops or for loops, but most of them should not be coded using a while loop or for loop, unless your teacher is trying to make you use a math formula to calculate the number of '*' …

Member Avatar for Demonisya
0
174
Member Avatar for littlebean21289

Your professor already gave you basic steps on how to begin. Try those and when you get stuck, tell us what you don't understand. We won't do your assignment for you.

Member Avatar for BestJewSinceJC
0
149
Member Avatar for cproud21

You should only be setting mouseLeft, mouseRight, etc to true if, in fact, the mouse was moved in that sector. When your mouseMoved method gets called, you are setting ALL of them to true, then calling repaint. The way you're currently doing it, if mouseLeft were to be set true, …

Member Avatar for BestJewSinceJC
0
157
Member Avatar for hpdv2000
Member Avatar for Sereal_Killer

[QUOTE=Sereal_Killer;747062]there is no way to use the return value of a method for creating an int variable[/QUOTE] That is not true.

Member Avatar for VernonDozier
0
126
Member Avatar for littlebean21289

Your professor gave you whats called a GUI. A GUI is just a window that, in this case, provides the user with a way to enter data. Now, to elaborate on that idea, I'll comment some of your professor's code to help you understand what he wants you to do.

Member Avatar for littlebean21289
0
774

The End.