7,116 Posted Topics

Member Avatar for Anas Shahid

That's nowhere near enough info. But in any case there's loads of tutorial and sample code on the web, just Google it! Come back here when you have any specific questions, and remember the DaniWeb rules you agreed to when you joined, in particular "Do provide evidence of having done …

Member Avatar for JamesCherrill
0
222
Member Avatar for sushants

To be fair, the Java 7 source code for String begins public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final char value[]; ... so you could reasonably say that a String is an array of chars wrapped in a …

Member Avatar for JamesCherrill
-4
225
Member Avatar for abra_ka_dabra
Member Avatar for JamesCherrill
0
257
Member Avatar for london-G

How can a combo box be equal to a String? - they're completely different things. You didn't post the relevant code, but at a guess you probably want to compare the *text* currently in the combo box. I'm sure you can guess the method that gives you the text!

Member Avatar for JamesCherrill
0
160
Member Avatar for game06

Some people extend JFrame, others just create JFrame in the code. I see little reason to extend JFrame unless you want to call JFrame's methods (eg setVisible) from another class, but in real life it's never that simple anyway. You don't normally need to extend anything else for your panels, …

Member Avatar for pbj.codez
0
256
Member Avatar for Start4me

"For unknown reasons, gameLoop doesnt want to compile" - that's just silly. When you compile the compiler gives you detailed error messages, including the line number(s) involved. Start by posting the exact complete text of all your error messages.

Member Avatar for Start4me
0
356
Member Avatar for abra_ka_dabra

You haven't given any background about data size, data volatility, key-value duplicates etc, but if it's low volatility with only one value for each unique key, I would consider two Maps, the second one having the keys and values swapped so you can retrieve the key directly from the value. …

Member Avatar for stultuske
0
176
Member Avatar for trisha mehta

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 trisha mehta
0
5K
Member Avatar for CoilFyzx

You should be able to do that by creating your own TableCellEditor - Google for lots of examples

Member Avatar for CoilFyzx
0
452
Member Avatar for poopuh

You have two parts to this task. The second part is to create and start a new Thread to execute your code, but that requires a run() method (see the Thread API doc for examples etc). So, the first part is to extract the relevant code from its current place …

Member Avatar for JamesCherrill
0
645
Member Avatar for abra_ka_dabra

You are confusing variables and objects. Variables just contain references (pointers) to an object. You create new FileWriter and BufferedWriter *objects* each time. Because you only use one at a time it's perfectly OK to re-use the same *variables* to refer to those objects.

Member Avatar for JamesCherrill
0
6K
Member Avatar for sirlink99

I already told you in your previous topic that you cannot use a String to hold a byte array and expect to get it back unchanged. byte[] in = .... String s = new String(in); byte[] out = s.getBytes(); // depending on your default character set, out will NOT be …

Member Avatar for sirlink99
0
550
Member Avatar for Violet_82

It's a reasonable one to start with - small and easy. Just get stuck in and try a few things and see what works best. Implementation: simple guideline: put everything you can that is used in >1 subclass in the superclass, so you only have to do it once. This …

Member Avatar for Violet_82
1
250
Member Avatar for modesto916

You could simply have a load of JLabels in a GridLayout and set their text and background colours as required. You could use an array of the JLabels to keep track of them and access individual ones.

Member Avatar for modesto916
0
144
Member Avatar for abra_ka_dabra

javac is part of the development kit, the JDK. It's not in the JRE,that's just the runtime environment. Download the JDK - version 7 is the current major version

Member Avatar for JamesCherrill
0
351
Member Avatar for vongola.lee

... and throw an OfferException rather than a DivideByZeroException ahh... the power of copy/paste... ;)

Member Avatar for peter_budo
0
145
Member Avatar for peter_budo

Hi P.P. Welcome to DaniWeb Did you notice this thread was marked "solved" 6 years ago? Your contribution is welcome, but it's far too late to be relevant. JC

Member Avatar for JamesCherrill
0
9K
Member Avatar for Jasonfran

It's called the "Observer" pattern - sorry, no time to explain right now, but Google it for lots of examples etc.

Member Avatar for JamesCherrill
0
210
Member Avatar for limaya

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 doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence …

Member Avatar for JamesCherrill
0
137
Member Avatar for salomonsk8

Re stultusk's post: I agree absolutely except for the anonymous inner class listener. I would always try to use that rather than implementing the listener in the main class because it scales to any number of listeners and avoids the "do everything in one listener" multiple-if nightmare. (And with Java …

Member Avatar for salomonsk8
0
517
Member Avatar for abra_ka_dabra

The code you posted tries to parse "Thu Sep 28 20:29:30 JST 2056" with a format "dd/mm/yy", so of course that doesn't work. What exactly are you trying to do with the "dd/mm/yy" format?

Member Avatar for JamesCherrill
0
256
Member Avatar for Mr.M

For PCs there's only one Java to consider - it's the one from Oracle (formerly Sun) in Windows/Mac/Linux 32/64 bit versions. You'll need the "SE" version as opposed to the "EE" (Enterprise Edition) edition, and the full JDK (Java Development Kit) rather than just the JRE (Java Runtime Environment). NetBeans …

Member Avatar for stultuske
0
225
Member Avatar for overwraith

Callling run executes those methods on the current thread. You need the Thread class and its start method.

Member Avatar for JamesCherrill
0
134
Member Avatar for willjohanz

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
175
Member Avatar for hg_fs2002

The Java Language Specification has the definitions of how each each type of constant ("literal" in Java-speak) is represented/defined. See section 3.10 http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10

Member Avatar for JamesCherrill
0
185
Member Avatar for Start4me

Here's a minimal runnable exmple that illustrates the key things you need to do - in particular a "model" that has the current values for whatever changes overe time (pahse/position of moon, brightness of sky etc), a timer-based method that updates those variables in a predictable steady way, and a …

Member Avatar for JamesCherrill
0
380
Member Avatar for dragonofspam

1. As stuluske said the error message includes the exact line where the problem happened, so thaT''s where to look. 2. In your constructor you declare new variables for all your fields etc. These "mask" or "hide" the declarations you made on lines 10-15. You set values correctly for these …

Member Avatar for stultuske
0
328
Member Avatar for Venkat SM
Member Avatar for JamesCherrill

Firefox 21.0 on Windows 7 64bit, the menu of forums (fora?) across the top is corrupted - the Community Center menu doesn't fit and gets wrapped onto the next line. ![75fb4bfb66c2f19e631374a974745dcc](/attachments/small/1/75fb4bfb66c2f19e631374a974745dcc.PNG "align-left")

Member Avatar for Dani
0
178
Member Avatar for sriramtashua

This thread http://www.daniweb.com/software-development/java/threads/455139/creating-an-autobalancer has a good example of Comparator - about 2/3 of the way through.

Member Avatar for stultuske
0
199
Member Avatar for game06

It's not painting because you don't call its paint method. (You create a new Player on line 18, but you never do anything with it). From the code fragment you have posted it's hard to see what value the Player class is bringing to this program. The map has the …

Member Avatar for sirlink99
0
1K
Member Avatar for Nomas11

`println` always adds a new line at the end of whatever you are printing. If you don't want every print on its own line just use `print`, or `printf` if you want more control over formatting. ps your lack of indentation, and random use/non use of {} for single-line ifs …

Member Avatar for JamesCherrill
0
140
Member Avatar for CloudZELL91

I don't want to be discouraging, but there's nothing in there that gives any kind of clue about what happened. Unless there's some other info you can find I doubt that anyone here will be able to help... sorry.

Member Avatar for ccbutler
0
338
Member Avatar for poopuh

Are you sure your arrays are initialised? Just declaring them isn't enough... char[] outPass; // declares a reference variable of type char[]. Its initial value is null; // any attempt to use outPass will give a null pointer exception outPass = new char[99]; // creates a char array, and sets …

Member Avatar for JamesCherrill
0
195
Member Avatar for kgizo

The Integer class has a parseInt(s) method that parses a string and converts it to an int value (or thows a NumberFormatException if the string does not represent a valid int value). You'll need an array of ints, same size as the array of Strings, and a loop that onverts …

Member Avatar for JamesCherrill
0
184
Member Avatar for boiishuvo
Member Avatar for Pobunjenik

ArrayList is still broken. Every time you call `new Player()` you execute the default constructor and start a new ArrayList. That's perfectly good logic considering that the ArrayList is an instance member - one ArrayList per Player, but I doubt very much that it's what you want. Presumably you want …

Member Avatar for Pobunjenik
0
478
Member Avatar for emily.webb.9026

It looks like nobody here knows JFeatureLib. Did you try the the JFeatureLib Google group? https://groups.google.com/forum/?fromgroups#!forum/JFeatureLib

Member Avatar for JamesCherrill
0
745
Member Avatar for Violet_82

Your folder structure needs to match the package structure, so what you just said is only true if the classes are all in the same package.

Member Avatar for Violet_82
0
362
Member Avatar for Mr.M

I hope you're prepared for a very steep learning curve! You'll need some basics on Swing (Java's standard GUI classes). Oracle's tutorials are excellent if you just want all the info without too much hand-holding. Have a look at the first few sections starting here http://docs.oracle.com/javase/tutorial/uiswing/index.html if it looks too …

Member Avatar for JamesCherrill
0
317
Member Avatar for poopuh

You need 4 nested (identical) loops. The System class has a method that gives you the current time in mSec. Call it before and after, subtract the two for elapsed time. Have a go, see how far you get, come back here if you get stuck (post what you hace …

Member Avatar for poopuh
0
251
Member Avatar for nurib

nurib: 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 As a final year student you should be capable of doing more than just whining. Post what you have …

Member Avatar for Schol-R-LEA
0
333
Member Avatar for bibiki

The idea is to ensure that you always get a valid completely initialised object - you keep calling the setters in the builder until your object is fully specified, then, and only then, you call build() and that returns a complete valid object (or throws some kind of "incomplete or …

Member Avatar for bibiki
1
161
Member Avatar for mKorbel

Here's a little demo I wrote a while ago that runs on Java 7 and has a transparent/shaped/undecorated window (`JFrame window2`). Maybe you can find what you need to know in this code? I remember that the order of the setUndecorated/setBackground/setOpacity/setVisible is critical. J. import java.awt.Color; import java.awt.Dimension; import java.awt.Font; …

Member Avatar for mKorbel
1
1K
Member Avatar for anisha.silva

So what ex actly is the complete text of the exception? It should tell you exactly what went wrong and where. And what was the value of userInput41? You are asking people to help, but you have not provided the info they need.

Member Avatar for anisha.silva
0
423
Member Avatar for CoilFyzx

> I recommend that you avoid java.awt.GridBagLayout Just for balance - most of my Java work is GUI-centric, and GridBagLayout is the *only* layout manager I use for anything other than trivial cases. It's the only one that gives me enough control over what happens when the systen font is …

Member Avatar for JamesCherrill
0
943
Member Avatar for game06

If the player is in one tile, and the wall is in another tile, and the Rectanges correspond to whole tiles, and one tile cannot be both 1 (player) and 2 (wall), then I don't see how any of there rectangles will ever intersect. Touch, yes, but overlap, no. Maybe …

Member Avatar for JamesCherrill
0
472
Member Avatar for Bhavya scripted
Member Avatar for Violet_82

It's just a convenience thing. It means you can print anything simply like Object something = ... // can be absolutely anything System.out.print(something); // will always work because print actually calls something.toString() and it will always work and usually tell you enough to identify what `something` was.

Member Avatar for Violet_82
1
227
Member Avatar for phani1092

You are confusing objects with reference variables. When you say `String s = "ABC";` "ABC" is an immutable String object, and s is a (not immutable) reference to a String. The current value of s is a reference to the "ABC" object. `s = s + "DEF";` You now have …

Member Avatar for JamesCherrill
0
329

The End.