7,116 Posted Topics

Member Avatar for toring

Painting: see http://docs.oracle.com/javase/tutorial/uiswing/painting/ Timing: start a javax.swing.Timer, and return. Every time the timer fires you can update whatever needs updating and return. Inbetween the timer firings Swing will be free to update the screen.

Member Avatar for JamesCherrill
0
491
Member Avatar for tdurgule

The info you need is in the Oracle tutorials [here](http://docs.oracle.com/javase/tutorial/essential/io/charstreams.html)

Member Avatar for JamesCherrill
0
125
Member Avatar for Slavi

MVC! Separate the GUI from the game logic as much as possible. Store everything in the game logic, and provide accessors for any user interface (console, GUI, HTML etc) to enter moves and keep them selves up to date.

Member Avatar for Slavi
0
750
Member Avatar for gharris55
Member Avatar for VernonDozier

Within the limits set by the individual components' min/max sizes, GridBagLayout distributes the available space according to the x/y weights - the higher the weight the more of the available space goes to that component. If you set all the weights equal then, within the min/max constraints, the window should …

Member Avatar for Doogledude123
0
4K
Member Avatar for Big-D2xL

You can't just print an array by saying System.out.println(myArray); all you get is a coded output like [[Ljava.lang.String;@73a175] that says it's an array of Strings at a particular address (etc) Either print the elements one at a time in a loop, or use a method from the Arrays class to …

Member Avatar for Big-D2xL
0
259
Member Avatar for moaz.amin.37

You have been posting here long enough to know that you should give the complete details of any error messages, and explain what symptoms you are seeing. ps CHECK YOUR SPELLING (AGAIN)

Member Avatar for moaz.amin.37
0
170
Member Avatar for Zachary_1

That's a stupid amount of test data for code that isn't working yet. Start with one two or three elements. Add some print statements to your code to see which loops/class are being executed with which values.

Member Avatar for JamesCherrill
0
1K
Member Avatar for moaz.amin.37

The symbol it can't find is "showMessageDiloge" (see line 4 of the error!) It's because you spelled it wrong. See the API doc for JOptionPane for the correct spelling

Member Avatar for mKorbel
0
177
Member Avatar for Vegito1991

What you are asking for is a lot simpler than the code you already have, so why are you finding it difficult? (You did write that code from scratch, didn't you?) Maybe if you explain exactly why you are stuck then we will know how best to help you.

Member Avatar for stultuske
0
2K
Member Avatar for moaz.amin.37

The loops are confusing this. Try a simpler example int i = 1; System.out.println(i++); System.out.println(i); int j = 1 System.out.println(++j); System.out.println(j);

Member Avatar for sepp2k
0
472
Member Avatar for Slavi

There's two parts to this: Easy: When doing the DFS and you find a path, instead of stopping just add the path to an ArrayList and keep going. The DFS algorithm should ensure every path is visited exactly once. More interesting: exactly how do you define and instantiate a single …

Member Avatar for Slavi
0
1K
Member Avatar for Doogledude123

Just because Soduku is displayed in a 2D grid that doesn't mean you have to store it internally like that. And there are very good reasons why you shoudn't. You have 81 cells. You want to look at groups of cells like {1,2,3,4,5,6,7,8,9} - a "horizontal row", or {1,10,19...} - …

Member Avatar for JamesCherrill
0
875
Member Avatar for moaz.amin.37

length is like an instance variable that arrays have. It contains the length (size) of the array. In this case it's telling you how many command line arguments there are

Member Avatar for stultuske
0
517
Member Avatar for soche123

Code posting does work - start your message, click the code button you should see a new window in which you can post your code. If that's not working can you post a screen shot that shows what your'e trying? Thanks

Member Avatar for JamesCherrill
0
265
Member Avatar for Sar_1

From the small amout of info you have given I wuld say yes, that sounds like MVC.

Member Avatar for JamesCherrill
0
181
Member Avatar for edygraca

If you have have if (instance of A) do A's version of something... if (instance of B) do B's version of something... then that's usually a sign that A and B should be subclasses of some common superclass, with `something` as a method that is overridden in A and B

Member Avatar for JamesCherrill
0
176
Member Avatar for LVZombie

7 works because on lines 32-36 you print all its fields explicitly. For the others you use `System.out.println(Supplies);` This is all about the toString() method... Every Java class inherits a toString() method from the Object class, so methods like println use that to convert the object you want to print …

Member Avatar for LVZombie
0
584
Member Avatar for harish_peram

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) …

Member Avatar for JamesCherrill
-1
101
Member Avatar for moaz.amin.37

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Type name: "); String name = reader.readLine(); System.out.println("Hello " + name); System.in is the InputStream associated with the console. You create a BufferedReader using that stream, then you can call its `readLine()` method to get the user's input.

Member Avatar for moaz.amin.37
0
409
Member Avatar for gear762
Member Avatar for mKorbel
0
219
Member Avatar for shomy

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there.

Member Avatar for shomy
-1
287
Member Avatar for gaurav_17

I want a Clapton special edition black Fender Stratocaster. You get me my stratocaster and I'll do your homework for you. If that's not possible then maybe you should read the forum rules that you agreed to when you joined DaniWeb, including "Do provide evidence of having done some work …

Member Avatar for JamesCherrill
-1
95
Member Avatar for Muni123
Member Avatar for GRENDY

That's mergesort, not margesort. That's probably why you had trouble finding it on Google. Anyway, Google "mergesort" and you'll get a huge range of tutorials that explain it. [This one](http://www.codenlearn.com/2011/10/simple-merge-sort.html) seems very clear and not too technical, so it's a good place to start.

Member Avatar for stultuske
0
156
Member Avatar for ckide
Member Avatar for hericles
0
377
Member Avatar for AbstractEden

Everything to do with Swing (eg painting the screen, running actionPerformed methods) happens on a single thread - the "Event Dispatch Thread", or "EDT", or "Swing thread". Your actionPerformed is run on the EDT, which means that once your actionPerformed method starts NOTHING else will happen in Swing - no …

Member Avatar for Hiroshe
0
1K
Member Avatar for Gracious_1

You may not want to use that code for a number of reasons including: Copying someone else's code for your homework is cheating It corrupts the data by discarding the newline delimiters It's a memory hog if the files are large (uses double the file size) It does horribly inefficient …

Member Avatar for Gracious_1
0
308
Member Avatar for howemonster

You need to look more closely... there is no such thing as a null char in Java. What exactly are you seeing?

Member Avatar for howemonster
0
148
Member Avatar for Doogledude123

Highly highly unlikely that you have found a new bug in System.err.println after all this time. System.err is intended for logging system error messages for the developer/administrator, not for messages to the user. If you mix it with System,out and System.in you can't guarantee the exact order in which it …

Member Avatar for JamesCherrill
0
398
Member Avatar for LVZombie

You get the name *before* you enter the loop, so that's only executed once, at the start of the program. Your main two options are: 1. repeat lines 21/22 just before the end of the loop, so you ask for "name or stop" before starting the next pass of the …

Member Avatar for jwenting
0
256
Member Avatar for Vlad_2

Is it wrong? In what way? Do you have an error message? Does it goive the wrong results? You must tell us everything you know if you want help.

Member Avatar for Vlad_2
0
8K
Member Avatar for Builder_1

Builder_1: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have got so far and someone will help you with any detailed questions you may have.

Member Avatar for Hiroshe
0
139
Member Avatar for SpottyBlue

If you want to fix the problem then yes, of course, you will have to change the code. Yourr methods are designed to take the old balance as a parameter and return the new balance. Right now you are ignoring the new balance that's returned. You need to asssign that …

Member Avatar for howemonster
0
418
Member Avatar for abra_ka_dabra

Not that I know of, but its easy enough to loop through your array printing the values (with commas inbetween) to a PrintStream based on the output file.

Member Avatar for howemonster
0
424
Member Avatar for sheelap

Primitives like int, char, float, boolean are not Objects, so the language is not 100% OO. The reason was for efficiency and speed - primitives have much lower overheads than objects.

Member Avatar for mike_2000_17
0
207
Member Avatar for MasterHacker110

Just have a method that re-enables the components, and call that as part of whever listener is handling the close of the other window.

Member Avatar for mKorbel
0
210
Member Avatar for MasterHacker110

Is that XML correct? shouldn't <Account AccountNumber="1234567890"> be <Account> <AccountNumber="1234567890"> given how you are parsing it?

Member Avatar for MasterHacker110
0
303
Member Avatar for Vegito1991

That's not enough of the code to see why a variable should still be null, but for starters try printing `out` and `txtmsg` just before that line to see which is null.

Member Avatar for JamesCherrill
0
384
Member Avatar for moaz.amin.37

By "screen" do you mean the console window, as in System.out? If so, be aware that the console output device may be to a printer or a sequential file, in which case "clear the screen" makes no sense, and attempting to execute a "cls" as a system command will have …

Member Avatar for JamesCherrill
0
337
Member Avatar for CervantesLost

That line is OK, but you have an error on lines 11 and 18 where the capitalisation of the variable name is different. It's pointless trying to run a program if there are compiler errors.

Member Avatar for JamesCherrill
0
188
Member Avatar for masonketcham

Exactly the same reason, exactly the same fix. If you want a \ in your Regex then you have to code two \ chars in the Java String literal, because \ is used in Java String Literals for special characters like \n (newline)

Member Avatar for masonketcham
0
187
Member Avatar for Doogledude123

Recursion is the answer if you want to hand-code this. The basic structure goes like (pseudo code): method searchDir(Dir d) { for each File f in d if f is an ordinary file check it against the search criteria if f is a directory call searchDir(f) NB: By now you …

Member Avatar for JamesCherrill
0
265
Member Avatar for sana.f.qureshi_1

Can you explain something for me please? I thought the transition table for a DFA looks somnething like table[current state][next token] = next state so conceptually I'd expect to see something like // state n is inside a a comment, n+1 is normal parsing table[*]['{'] = n; // { takes …

Member Avatar for sana.f.qureshi_1
0
180
Member Avatar for valmiki007

(because chars are integer numeric values you can simply use them to index into an array of counts - in which case that algorithm is as efficient as you will get.)

Member Avatar for JamesCherrill
0
176
Member Avatar for NyQii

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules

Member Avatar for jwenting
0
267
Member Avatar for new_2_java

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question

Member Avatar for JamesCherrill
0
6K
Member Avatar for riffat.jaffery.3

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) …

Member Avatar for stultuske
-2
111
Member Avatar for ali11
Member Avatar for neutralfox

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question

Member Avatar for JamesCherrill
0
1K

The End.