7,116 Posted Topics

Member Avatar for Szabi Zsoldos

WARNING: To anyone copying code for a homework assignments: Your teacher can probably spot solutions copied from the web. If so you will get 0 marks, and may be penalised for cheating. YOu are also wasting your own time by cheating instead of learning. Write your own code! Szabi: I'm …

Member Avatar for Szabi Zsoldos
-1
528
Member Avatar for ParPau

Look at the Enum.valueOf method - it gives you the enum value from a String. Eg you pass it the String "May" and it it returns the enum value Average.May

Member Avatar for jwenting
0
271
Member Avatar for custurd122000
Member Avatar for JamesCherrill
0
1K
Member Avatar for Builder_1

Browser is easy, especially in JavaFX, maybe too easy because it doesn't leave a lot of places for you to show your skills. Media player may be better (also in Java FX) because you can add lots of value around the metadata, media library management etc. There's a lot of …

Member Avatar for Builder_1
0
279
Member Avatar for mustafaaltup

mustafaaaltup: Your question is too vague. Please be more specific. How far have you got with this? What, exactly, is stopping you now?

Member Avatar for jwenting
-1
187
Member Avatar for Junior.frogie

This is a good introduction: http://www.makeuseof.com/tag/java-virtual-machine-work-makeuseof-explains/

Member Avatar for JamesCherrill
0
126
Member Avatar for mstoltz1

All that code for the random numbers (lines 16-21) looks seriously over the top and thus error-prone. (It's already broken; it returns numbers 0-11. Even after you fix that it still has a higher chance or returning a 1-4 than a 5-12. Not to mention using Math.pow(10,2) instead of 100.0) …

Member Avatar for JamesCherrill
0
2K
Member Avatar for new_2_java

Is that a hex 52 or a decimal 52? LDAP error 52 (hex) is the totally unhelpful "Local error occurred", but if that's 52 decimal (34 hex) it's the self-explanatory "The server is unavailable" http://support.microsoft.com/kb/218185

Member Avatar for new_2_java
0
2K
Member Avatar for wasme

We are just volunteers here, so nobody will be in a position to give you extended one-on-one training. But if you have specific questions or errors we will be happy to help through these public forums, where everyone can contribute to the solution.

Member Avatar for wasme
0
197
Member Avatar for Raymond_3

That looks OK - maybe the parens are already out of step before that code? Also, I don't know what the data type for tempUnit is, but it's unusual to see a char as parameter for equals. char is an integer primitive type, for which == is appropriate.

Member Avatar for JamesCherrill
0
192
Member Avatar for ikel

Looking at that table the most obvious approach is to create a simple class that represents one row, with instance variables for each column. The whole table is then just a one-dimensional array of objects of that class. That array is also then 90% of what you need for a …

Member Avatar for JamesCherrill
0
302
Member Avatar for HacruLeian

Your code is almost right - you have the right pieces but the order is a bit messed up. Read each line of the file, split each line into words (ie use `split` with the default separator of a space), then use chatAt to get the first letter of each …

Member Avatar for HacruLeian
0
1K
Member Avatar for yaya123

See this thread http://www.daniweb.com/software-development/java/threads/475808/how-to-play-mp3-files-in-java-using-eclipse - especially the very last post

Member Avatar for JamesCherrill
0
107
Member Avatar for kristian.ssyn

A JButton with an ImageIcon will automatically set its own preferred size to fit the icon. The problem comes when you use a layout manager that re-sizes the buttons to achieve the desired layout. You need to chose layout managers for your frame and panels that don't resize the buttons. …

Member Avatar for JamesCherrill
0
13K
Member Avatar for Richa_2

Exactly what errors? - post the *complete* text of all your error message, don't expect people to guess. [edit] Thank you. You should expect some answers now.

Member Avatar for Richa_2
0
297
Member Avatar for abhig

The awt GUI classes were superceeded in 1998 by Swing. Yes, 1998 - more that 15 years ago. You are seriously wasting your time learning or using it. Update your code to use Swing (JApplet etc).

Member Avatar for JamesCherrill
0
452
Member Avatar for amir4g

1. If you get an error ALWAYS post the complete error message here. Don't exp3ect people to guess. 2. You are using AWT (Frame) rather than Swing (JFrame). AWT has been obsolete for over a decade now. You should update your code to use Swing components - it's not hard. …

Member Avatar for JamesCherrill
0
351
Member Avatar for kristian.ssyn

new ImageIcon(...) is famous for not throwing any exceptions when it fails to find the file; it's just null. JLabel is happy to accept null for its image icon, so the final result is no image and no error messages. We see that quite often in DaniWeb "help!" posts. Use …

Member Avatar for JamesCherrill
0
269
Member Avatar for Lia_2

What exactly is the error message the *compiler* (not the runtime) gives for that line? Is line 21 the System.out.println ? It's absolutely pointless to try to execute a program that has compile errors. *Always* fix *all* the compile errors before trying to run the program.

Member Avatar for hannahaddad
0
307
Member Avatar for corby

Wazan: Do not hijack old forum threads by posting a new question as a reply to an old one http://www.daniweb.com/community/rules Start your own new thread if you have a question.

Member Avatar for JamesCherrill
0
6K
Member Avatar for yasheela

Looks like it moight be out of scope, but until you fix your indentation it's too hard to see.

Member Avatar for hannahaddad
0
140
Member Avatar for nabilmahesaniya

Have a look at http://docs.oracle.com/javase/tutorial/getStarted/application/index.html#MAIN

Member Avatar for Philippe.Lahaie
0
157
Member Avatar for daniel1977

AFter entering 23 do you enter a space or a carriage return? (If you just type 23 the it will be waiting for the next character in case that will be a digit.)

Member Avatar for hannahaddad
0
252
Member Avatar for ameer.mhmed

Nice OO thinking - the User class is excellent, but the other class... horrible naming! A method called `OConnexion` in a class called `OConnection` that returns a `Connection` is guaranteed to confuse people. Did you start out with a constructor, then change it when you realised you couldn't return a …

Member Avatar for ViolaPAllen86
0
404
Member Avatar for mjsh

It's so easy to re-generate the sequence given the starting number, so I wouldn't bother trying to store sequences. Just write a trivial `displaySequence(int startingNumber)` method - it's just the loop/if from lines 21-30 with a print statement in the loop. Then just call that passing highestNumber. If you are …

Member Avatar for JamesCherrill
0
823
Member Avatar for susanna.newkirk

Hello Susanna Thank you for sharing that with us, but is there any particular point you wanted to make, or question you wanted to ask?

Member Avatar for susanna.newkirk
0
773
Member Avatar for rubeea.jaffari

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". That means that once your paintComponent method starts NOTHING else will happen in Swing, including no mouse or keyboard events, until your method …

Member Avatar for JamesCherrill
0
444
Member Avatar for asif49
Member Avatar for erik.pierce1

I can't see how that could run without throwing Exceptions - eg line 117, deckPanel is not initialised, so that will throw a null pointer exception. How are you trying to run this? javaw or what?

Member Avatar for erik.pierce1
0
132
Member Avatar for Richa_2

You try to define method1 but you are still inside the main method. You ca't define a method inside another method.

Member Avatar for Richa_2
0
301
Member Avatar for danie93

Hi milil Please don't EVER do this in code that a learner may read: catch(Exception ex) { } all you are doing is guaranteeing that when it goes wrong they will have no idea why. Always start with an `ex.printStackTrace();`

Member Avatar for JamesCherrill
0
13K
Member Avatar for london-G

Q_SIZE is 16, which you use to get a value for action. So you get a random action in the range 0 - 15, which you use as an index into the array But the array seems to have 15 elements ie [0] to [14]

Member Avatar for london-G
0
646
Member Avatar for lena1990

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
0
136
Member Avatar for mukta.dhiman

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
0
173
Member Avatar for kumar.rupesh

This one of those "which is best, football or cricket?" kind of questions. People are going to disagree strongly, mopstly based on personal preference and bias. To get things started: my personal preference and bias is Java because you will need a lot of complex data structures and complex processing …

Member Avatar for kumar.rupesh
1
231
Member Avatar for snowy365

Strings in Java are immutable - you cannot change them. Have a look at StringBuilder which is like a String but you can do stuff like inserting blanks into the middle of it...

Member Avatar for JamesCherrill
0
150
Member Avatar for nabilmahesaniya

Check out the very first post in the Java forum "Starting Java [Java tutorials / resources / faq]" http://www.daniweb.com/software-development/java/threads/99132/starting-java-java-tutorials-resources-faq There are excellent book recommendations in there

Member Avatar for raj.mscking
0
156
Member Avatar for stikku

The problem is probably in the code you didn't post! Eg: If you don't set a size and/or minimum size for your mypanel then the layout manager for its parent will look at mypanel's children (none) and decide that 0x0 pixels is a big enough size for it. `final Graphics2D …

Member Avatar for JamesCherrill
0
260
Member Avatar for ayushi_1

I guess you missed the very first post at the top of the first page of the Java forum?

Member Avatar for danie93
0
146
Member Avatar for JavaPadawan

This arraylist is a list of Document objects ArrayList<Document> someStuff = new ArrayList<Document>(); The application prompts the user for lastname, firstname, code and then uses those values to create new Document object, which it then adds to the list. It may be clearer if we break the statement down into …

Member Avatar for arnab.batabyal.54
0
22K
Member Avatar for soujanya.bhat.184

You coded `54. setDefaultCloseOperation(EXIT_ON_CLOSE);` and Java is doing what you told it! That option instructs Java to exit the whole program when the JFrame is closed. I realise that you are practicing with Threads here, but t4 just executes an `addActionListener`, which isn't enough for you to be able to …

Member Avatar for mKorbel
0
362
Member Avatar for pwolf
Member Avatar for Varunkrishna

Date was badly designed in version 1 of Java because it didn't cope with multiple time zones or calendars. For most purposes it was replaced by the abstract Calendar class. That was designed to have concrete subclasses for different calendars (eg Jewish), but you will probably want the subclass GregorianCalendar …

Member Avatar for jwenting
0
379
Member Avatar for hira.jehangir.3

You need to decide what you mean by sorting a 2D matrix. The code you have sorts each row individually - which is one passible answer, but it looks like you may want to sort all the values, regardless of rows or columns, in which case I have to ask …

Member Avatar for JamesCherrill
0
5K
Member Avatar for ameer.mhmed

How about returning a boolean? // pseudo-code! public boolean passwordIsOK() { get the password if (the password is correct) return true; else return false; } then you can say if (passwordIsOK()) ... do whatever

Member Avatar for stultuske
0
119
Member Avatar for ZixCo

You declare the array variable `som` but you don't initialise it, so som is still null, it doesn't refer to an array yet, the array doesn't exist, it has no members, so you can't use `som[0]`

Member Avatar for JamesCherrill
0
163
Member Avatar for xfinity.Ace

You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some …

Member Avatar for stultuske
0
207
Member Avatar for SK33

Java will autobox/unbox int<->Integer, double<->Double,etc, so milil's example is OK.

Member Avatar for raj.mscking
0
188
Member Avatar for murali2489

I don't know what your overall intention is for how this code should execute, but 1. You have a single block of code synchronised on a single instance of Animal. That's legal but useless - for it to be of any value you need two synchronised blocks or two threads …

Member Avatar for JamesCherrill
0
244
Member Avatar for sciprog22

Nobody here is going to be stupid enough to waste any time trying to debug a program that discards and ignores relevant Exceptions. Given the problem you have described, your commenting out line 75 is a candidate for the DaniWeb all-time greatest mistakes hall of fame. I know there is …

Member Avatar for sciprog22
0
907

The End.