1,171 Posted Topics

Member Avatar for chira.laura.9

Where do you have problems with in specific? I'd suggest you to perform a Google search on 'Sokoban', look at existing implementations, play a couple of them and see how it works. Familiarize yourself with the rules of the game. Start coding, and when you encounter problems come back and …

Member Avatar for bguild
0
5K
Member Avatar for Toni Rahman

[Here](http://lmgtfy.com/?q=java) and [here](http://www.catb.org/esr/faqs/smart-questions.html).

Member Avatar for stultuske
-3
147
Member Avatar for Toni Rahman
Re: C++

[Here](http://lmgtfy.com/?q=c%2B%2B), [here](http://www.daniweb.com/software-development/cpp/threads/78223/read-this-before-posting-a-question) and [here](http://www.catb.org/esr/faqs/smart-questions.html).

Member Avatar for Lucaci Andrew
-3
135
Member Avatar for jeffbeck8

Golden advice from a quick skim through your code: Line 122-123: **NEVER EVER** leave your catch blocks empty! **[1]** It will hide away every potential error and problem at the time one occurs. Whenever you feel tempted to leave a catch block empty, always at least insert a call to …

Member Avatar for jeffbeck8
0
196
Member Avatar for 03hasnam

You can use [filters and sorters](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting) on a JTable, if all the data is already in your table model.

Member Avatar for tux4life
0
559
Member Avatar for shotokanpoloto

Have you tried connecting to your database using the Netbeans Services tab? This should work before you proceed.

Member Avatar for shotokanpoloto
0
571
Member Avatar for Osaid9

Open your file in append mode: PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));

Member Avatar for tux4life
0
4K
Member Avatar for Violet_82

> My problem is with the constructor: where does it get called? I would have thought in this line > Player player; but shouldn't this be Player player = new Player();? You are right in saying that the line `Player player;` does not call the constructor, however, if you look …

Member Avatar for Violet_82
0
191
Member Avatar for Darshan5

Implement your own table model as described in: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html http://www.informit.com/articles/article.aspx?p=332278

Member Avatar for tux4life
0
65
Member Avatar for vipin.luhach

Implement your own [AbstractTableModel](http://docs.oracle.com/javase/6/docs/api/javax/swing/table/AbstractTableModel.html) and let it interact with the database. You'll have to provide your own remove method there, and make use of the fireTableRowsDeleted method to notify the JTable that a row was deleted. Here are two links that should provide you with the information you need (including …

Member Avatar for tux4life
0
193
Member Avatar for zlloyd1

>The error I am getting from this is, "Non-static variable panel, cannot be referenced from a static context". Let's analyze what the compiler is trying to tell us: * **Non-static variable panel**, let's see... variable panel is declared on line 7, and there's no static keyword there, so it is …

Member Avatar for tux4life
0
333
Member Avatar for sid78669

> For re-usability it would be better to return the long value, rather than set a fixed named variable that's declared elsewhere? In addition it would be a good idea then to also rename the method to `getUniqueIdentifier()`.

Member Avatar for ~s.o.s~
1
468
Member Avatar for utkarshsahu

>how do i get a1 as in its control name in swing and not the actual string http://stackoverflow.com/questions/4958600/get-a-swing-component-by-name You could also put the components that represent your board squares in an array and translate the input from your textfield to the corresponding array index.

Member Avatar for tux4life
0
207
Member Avatar for nickerst

1. Your attribute declarations (lines 14-23) should be outside any method (now they are in your main method, move them out). 2. You've put your applet() method (lines 28-43) inside your main method, move it outside of your main. 3. You miss a curly ending brace for your main and …

Member Avatar for nickerst
0
324
Member Avatar for silvercats
Member Avatar for Aditya_4

Line 45 in the code you posted: `public static Void Main(String[]args)` correct it to: `public static void main(String[]args)` (`main` without capital and `void` without capital) (Even though it will compile with `Main` as identifier, it won't run because there's no `main` defined)

Member Avatar for Aditya_4
0
205
Member Avatar for mukororokudo

First off, **if you don't need the synchronization** provided by a [StringBuffer](http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuffer.html), then prefer using a [StringBuilder](http://docs.oracle.com/javase/6/docs/api/java/lang/StringBuilder.html). Here's what the Java API states about StringBuilder: *This class provides an API compatible with StringBuffer, but with no guarantee of synchronization. This class is designed for use as a drop-in replacement for …

Member Avatar for JamesCherrill
0
230
Member Avatar for sparkthesunoff

>how do I draw that exact apple tree i specified in my txt file? What exactly did you do in your AppleTree's paint method? >Should I put them in a Map here? Nope. >public String color; >public int ID; Change to private and make getter methods for these. In your …

Member Avatar for tux4life
0
803
Member Avatar for sripad44

He better learns [this](http://www.catb.org/esr/faqs/smart-questions.html) first.

Member Avatar for tux4life
-2
202
Member Avatar for VISPFORALL

>CAN ANYBODY PLEASE TELL HOW TO LEARN C++ Coding Read books, write alot of code, be prepared to fail alot... >IS THAT THEROY IMPORTANT Pretty much. >PLEASE HELP ME TO MAKE MY CARRIR . . . MY AIM IS TO BECOME A SOFTWARE ENGINEER Read books, write alot of code, …

Member Avatar for tinstaafl
-1
106
Member Avatar for vikarna

>i want to read the data from text file and write to excel file. You'll need to be more specific on how the data is formatted in these files, perhaps include an example of how your text file looks, and how your "excel file" should look.

Member Avatar for peter_budo
0
2K
Member Avatar for Petranilla

Take a look at: http://www.homeandlearn.co.uk/java/java_formatted_strings.html . Use `String.format()` instead of `System.out.printf()`.

Member Avatar for Petranilla
0
120
Member Avatar for Java is King

Try a [GridLayout](http://docs.oracle.com/javase/6/docs/api/java/awt/GridLayout.html). FYI: It is also possible to do this entirely without buttons, it would be more complicated though (since you'd need to compute the clicked square from the coordinates of the mouse click).

Member Avatar for tux4life
0
198
Member Avatar for Nandhinidevi

You should be more specific as to what you want to do with your truncated number. Do you want to put it in a `String`? Do you want to print it to the screen and keep the exact value in your variable? Do you want to truncate the result in …

Member Avatar for tux4life
0
216
Member Avatar for love1969
Re: Days

[Read this first](http://www.catb.org/esr/faqs/smart-questions.html). Have fun with it ;-)

Member Avatar for jwenting
0
104
Member Avatar for sirlink99

>does not move past the accept method In fact it does move past the accept method. The reason why your "Client connected" message is not displayed is because you add it to a `String`, but you don't append it to your `JTextArea`. >What could be creating the problem that I …

Member Avatar for JamesCherrill
0
474
Member Avatar for mumaga

currentRoom = room; Room currentRoom = new Room(); // here is the problem Why creating a new room there, can't you just use the one passed to the constructor? Also, could you clarify the following, not sure if I understand it: > My problem is that Character is an Abstract …

Member Avatar for mumaga
0
269
Member Avatar for mumaga

> couldnt figure out why the output line always appears twice! like: > you have added computer to your inventory > you have added computer to your inventory My first guess would be the following code from `takeItem()`: playerInventory.addItemToInventory(itemToBePicked); // line 16 if (playerInventory.addItemToInventory(itemToBePicked)) // line 17 Notice that `addItemToInventory()` …

Member Avatar for mumaga
0
121
Member Avatar for maduxi

The HashMap is a good suggestion, although I want to add something to it. Personally I wouldn't recommend putting an Integer in it, since Integer is immutable, and you'll have to issue a `put()` everytime you want to update the count. I suggest you create a Counter class that wraps …

Member Avatar for maduxi
0
345
Member Avatar for fallen21468

**@fallen21468:** In addition for when you get more experience with Java, you might want to keep this link bookmarked: http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice

Member Avatar for fallen21468
0
1K
Member Avatar for ibthevivin

> Hello ... I think all of these are O(n) That's not true, take a look at (B) and (D), where the index is divided by / multiplied by two. These are O(log(n)). This is O(n): int index = 1; while (index < n) { ... index++ // index is …

Member Avatar for tux4life
0
208
Member Avatar for sofien.fkih
Member Avatar for tux4life
0
100
Member Avatar for Noopit

`while(plaintext.length() > 0)` Strings are immutable, and the reference is never set to anything else. This has the potential to cause an infinite loop. The reason why it doesn't at runtime is because you keep incrementing `counter`, and accessing characters from that String by invoking `plaintext.charAt(counter)`, eventually it will lead …

Member Avatar for tux4life
0
3K
Member Avatar for AnnA.B

Create an array which holds the board state. (don't forget to initialize the board before using it) 1) Write code to display the board (from the array). (Test whether everything is displayed correctly). 2) Write code to accept user input. 3) Write code which processes the user input, and places …

Member Avatar for joao.jose.520
1
1K
Member Avatar for schippi

> Please wrap your code in code-tags the next time you post any code. > Whew! That's a lot of errors: > RollingDice.java:12: ';' expected > public static void main (String[] args ) > ^ > RollingDice.java:16: <identifier> expected > die1 = new Die() ; > ^ > RollingDice.java:17: <identifier> …

Member Avatar for JamesCherrill
0
344
Member Avatar for tux4life

A program which displays the prime factors of a given number, all the 'hard' work is done by the [B]factorize()[/B] function: [CODE=c] /* Find out the prime factors * of a given number and print * them on the screen */ void factorize(int n) { int d = 2; if(n …

Member Avatar for delta_frost
0
795
Member Avatar for hhilo2002

Pointers are often used in combination with dynamic memory allocation ... Lets say you want to create a table of objects, but it depends on the situation where the program is in, you would rather use a pointer to a table of objects (dynamic memory allocation) ... But when you're …

Member Avatar for neithan
0
195
Member Avatar for sillyboy
Member Avatar for daviddoria

Assert is a C++ macro and when the compiler comes across assert, it replaces the assert call with the instructions to evaluate an expression + the instructions to exit the program if the expression returned false ... e.g.:[ICODE]assert(1>2);[/ICODE] will exit the program because 1 isn't greater than 2 ...

Member Avatar for vibhor48
0
294
Member Avatar for tux4life

This is how mine [B]strcmp[/B] function would look like if I'd to implement it from scratch :)

Member Avatar for ibykow
0
696
Member Avatar for nschessnerd
Member Avatar for revenge2

[QUOTE=revenge2;895494]hello there. i've installed mingw compiler and im wondering how i would go about setting up notepad++ to compile my c/c++ code?. How do i do this? -regards.[/QUOTE] I assume that the [B]g++[/B] command is in your PATH and that your environment variables are set correctly. Then follow these steps: …

Member Avatar for jussij
1
853
Member Avatar for tux4life

I've written a program to add two hexadecimal numbers ... Njoy ! tux4life

Member Avatar for alebuddy
0
1K
Member Avatar for madhub2v

[B]>>i found it from a book.[/B] [B]>>is it cheating to learn from any body who knows well?[/B] I don't believe that code comes from a book. If that person ``who knows well' writes such code, full with magic numbers, and no comments at all - just to give a few …

Member Avatar for Ezzaral
0
2K
Member Avatar for adkool
Member Avatar for marirs07

Ever heard of "Google" the mighty search machine? Let me introduce you to what you can find with it: [url]http://stackoverflow.com/questions/142016/c-c-structure-offset[/url]

Member Avatar for Narue
0
160
Member Avatar for tux4life

I've written a C++ function which converts an integer to a (C++-)string ... [CODE=C++] ... string s = itos(5698); cout << s << endl; /* Will print '5698' on the screen */ ... [/CODE] You MAY use this code for anything you want but [B][COLOR="Red"]you aren't allowed to sell this …

Member Avatar for ztdep
0
1K
Member Avatar for lizardcakes

It's apparently a heat problem ... Consider installing some extra coolers into your computer ... You'll also have to remove that exploit from your computer ... Maybe you should also try using another antispyware like Spybot S&D or Ad-aware Free ?

Member Avatar for Usman.88
0
111
Member Avatar for lynnajoe

[QUOTE=HelloMe;1507546]ups the brackets again "[" code "]" here your code "[" /code "]" like i said, the brackets without quotations :)[/QUOTE] You can use the [I][B]noparse tag[/B][/I]([ICODE][noparse][noparse][/noparse][/noparse][/ICODE]) to make it more clear. [B]Writing:[/B] [noparse][noparse] [code] // Your code here [/code] [/noparse][/noparse] [B]Will yield:[/B] [noparse][code] // Your code here [/code] [/noparse]

Member Avatar for lynnajoe
0
216
Member Avatar for programing

[QUOTE=programing;1507704] i am read java how to program are you know other good books .? >[/QUOTE] Read the ``[URL="http://www.daniweb.com/software-development/java/threads/99132"]Starting Java[/URL]' sticky thread, it contains plenty of useful resources for every programmer learning or using Java.

Member Avatar for programing
0
176

The End.