7,116 Posted Topics
Re: 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) … | |
Re: 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. | |
Re: We don't know what a Layer is here, but it obviously has a name field that's accessed via its getName method. That's used as part of the file name, ie the file name is made up of three parts: whatever is in the variable fileName, followed by whatever the layer.getName() … | |
| |
Re: This is your first post, so you get some extra tolerance, but the code you posted did not produce the output you said it did. If you want our help you must start by being honest with us. | |
Re: Just had a very quick look - but shouldn't the while on the first line 4 be ` while( ! current.next.getStateName.equals(key.getStateName))` (as you coded it, if the first entry doesn't match you will immediately exit the loop) | |
Re: DaniWeb Member Rules 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. Be specific. | |
Re: From Java 1.6 onwards you can directly call JavaScript code and pass values and object in and out of it. But for the specific case of mailto you can simply use the Desktop class (Java 1.6 or later) and put the whole message in a URI and call the [mail](http://docs.oracle.com/javase/6/docs/api/java/awt/Desktop.html#mail%28java.net.URI%29) … | |
Re: YouTube Terms of Service, section 5B says: > You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content. You shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other … | |
Re: DaniWeb Member Rules 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. | |
Re: You really should get a programmer's editor and clean that code up - proper consistent indentation would make this kind of problem obvious. Anyway, I count four "if ... {"s, but there are five "}" before the else, so that's the error. | |
Re: "do" is a Java reserved word - just like if, class, while, return etc etc You can't use a reserved word as an identifier. You could change it to "doh" - that would seem appropriate :) http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html | |
Re: 1. This is a 6 year old thread - the OP has certainly moved on by now 2. Which version are you referring to when yo say "This version" | |
Re: mKorbel's advice is good. Unlike KeyListener, a DocumentListener will correctly deal with copy/paste and programatic changes to the text. as well as anything the user types | |
Re: You execute two count++ per iteration of the loop, that's one too many. | |
Re: http://docs.oracle.com/javase/tutorial/deployment/applet/security.html | |
Re: The complex statement on line 1 could be going wrong in a number of places. Break it up into separate statements and print the result at each step to confirm what it is really doing. Similarly, print the results of the readUTF to confirm exactly what that is doing. You … | |
Re: When parsing you may find [this](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html) useful | |
Re: @phile.meena.1 You are creating some confusion here. Please explain in a LOT more detail what you want to do. Right now it sounds like "I want to develop a full-size commercial database application in Java and I don't know anything about programming" - in which case you should allow at … | |
Re: 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 include: "Do provide evidence of having done some … | |
Re: Line 32 - need to cast to IntData to access that classes' fields | |
Re: @alanso: Please try to be sensible. You have told us that you have "a lot of errors" in some code that you haven't posted. How do you think anyone can possibly help you with unknown errors in unknown code? In your next post you need to post the exact complete … | |
Re: > ... insisting that the rating supplied by the user be valid. > rating should be 1 to 5; The first verion does not even try to do this, so it cannot be right. The second version does, but it has a logic error in the if test, which you … | |
Re: Yes, we'll help, but you need to show some effort first. Post what you have done so far. DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: The official Java documentation is always the definitive place to look. [Here's](http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.5) what the Java Language Specification says about how an instance is created and initialised | |
Re: near line 51, where you keep track of the highest score, you can also update a String variable to store the name associated with that score. Then hyou can print that variable after the loop. | |
Re: deck1 is a single object, it is NOT an array of cards. It happens to contain an array of cards, but that's not relevent except to how it's printed out. So deckArray is an array list of 1 element, an instance of Deck. When you remove that 1 element the … | |
Re: You declare totalPur inside the loop, so you get a brand new totalPur each time thru the loop and the previous one(s) are forgotten. Declare and initialise it *before* you enter the loop so the same variable is used throughout. | |
Re: Line 34 you are assigning the value of true to the variable stop. The test for equals is == You may also be blocking the Swing event dispatch thread depending on what the restof your code looks like. Everything to do with Swing (eg painting the screen, running actionPerformed methods) … | |
Re: Splitting on blanks is not such a good idea. The file format is defined by columns, so that's how you should parse it. Splitting on blanks will fail if any of the data fields contain an embedded blank, eg San Juan on line 3. The best answer is to substring … | |
Re: public static String createID(C) That won't compile becuase when you define a method you have to say what type the parameter is. You can save a lot of time by trying to compile your code and fixing as many errors as you can before posting here and waiting for someone … | |
Re: This thread was finished 3 years ago. It's interesting, but far too late to contribute now. Thread closed, | |
Re: You could override paintComponent to paint the background yourself, then draw the tile repeatedly in a nested x,y double loop to tile it across/down the whole area. You could optimise that by doing it once to a new full-size image if necessary, but it probably won't be necessary. | |
Re: Create a new buffered image. Get its Graphics. Draw your canvas on the Graphics. (Use your existing paintComponent method and pass the BufferedImage's Graphics to it.) | |
Re: Maybe put them into the array starting at the end and filling backwards? ie keep deck[x] = new Card(rankValues[j], suitValues[i]); but start x at 51 and decrement it in each pass of the inner loop instead of incrementing it. ps When you have an answer to a problem please mark … | |
Re: Your enums store the text you need (eg "Ace", "Spades"), so all you need is an accessor method in the enums to return that text (or simply override toString in the enums to return it) | |
Re: Here's what the Java API documentation has to say: > stop() > Deprecated. > This method is inherently unsafe. (...) Many uses of stop should be replaced by code that simply modifies some variable to indicate that the target thread should stop running. The target thread should check this variable … | |
Re: There are quite a few syntax errors there - missing () etc. Compile your program to get a list of syntax errors and fix them (start at the top and re-compile after each one, as an error early in the code can disrupt parsing of the code that follows). Then … | |
Re: If you want it to look good, here's how you do it: Create an image file (jpeg or whatever) for the junction, and one or more small image files for the car(s). Program a JPanel with your own paintComponent method. In that method draw the junction image on the JPanel, … | |
Re: The improvements in 1.7 are no big deal over 1.6, and many corporates take forever to update, so I wouldn't worry about that. If you're happy with the core concepts I would recommend writing as much code as possible and getting feedback (eg from here) rather than just reading about … | |
Re: PritiP Please read the DaniWeb member rules before posting - it helps to keep our web site well-organised. DaniWeb Member Rules 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 This … | |
Re: pwd is defined as a Long, and a long will be auto boxed when assigned to a Long... | |
Re: When you have something like ` void met(List<? super Animal> l2)` you are saying that the parameter will be a List of type "x"where "x" is Animal or a superclass of Animal. Note that at compile time you don't know what "x" will be exactly - it could be Animal, … | |
Re: I haven't read all that, but it certainly looks like pretty good code. One point: you use equals when looking for a given object in the list. Are you sure that's what you mean? Equals may return true when the object is a different object but the writers of that … | |
Re: No, you don't ***have*** to use KeyListener. mKorbel's advice is good. Apart from anything else his approach will also handle copy/paste into the field correctly. It also uses classes that Sun/Oracle have already written for this purpose, so no need to re-invent the wheel. | |
Re: (At least) two approaches: 1. Make each image an imageIcon in a JButton and use an ordinary ActionListener for the buttons. Chose a suitable button margin to make it look good. 2. Add a MouseListener to the panel where the images are drawn and use th x.y coords of the … | |
Re: for (int i = 0; i < comix.length; i++) { Scanner console = new Scanner(System.in); String temp = console.nextLine(); Your problems start here. Your loop starts with i = 0. It gets the search word from the user, and tests the first element of comix. It then goes to the … | |
Re: As a new employee you are unlikely to be asked to do a new project. New hires are usually assigned maintenance tasks, mostly because that teaches them about the existing systems, and partly because they are bottom of the pecking order and nobody likes maintenance. So a typical task may … | |
Re: Is there a Player class? Does it have get/setColor methods? Is the color initially null? Why not just have a test in the potting logic that says if ball is yellow or red AND player1.getColor()==null, call setColor as appropriate? | |
Re: Line 56 - has an incorrect ; - just delete it public static void main(String[] args) { // method body } |
The End.