7,116 Posted Topics
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. ps: This is not a hard … | |
Re: Hello mbongiseni, welcome to Daniweb. Please don't join your question onto the end of someone else's thread. Please start your own new thread for your question. Before posting you may also want to have a look a the Java tutorials on the Oracle web site, eg http://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html | |
Re: The method MinDistanceNode() is defined in the Node class, so to call it you need a single instance of Node, not a whole ArrayList of Nodes | |
![]() | |
I'm suffering from a complete brainfreeze here; maybe some NetBeans user can un-block me without making me look like a complete idiot? Thanks. I usually use Eclipse, but for this particular project it has to be NetBeans. I have two projects defined. One is the main project with packages - … | |
Re: http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html | |
Re: It has no pointers. Pointer errors and related memory managment problems are a major source of security problems in C and C++ | |
Re: Hello gauravbit70, welcome to DaniWeb. Don't be put off by Stultuske, he's just having a bit of fun. Your contributions are very welcome here. Before posting please do check the dates on threads, and please don't just post solutions with no explanations or comments - we want people to be … | |
Re: Did you notice that this is the Java forum? Do you know that your program is not a Java program? | |
Re: You could push your messages onto a LinkedBlockingQueue from one thread, and loop processing them in another (take from the queue blocks if the queue is empty) http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/LinkedBlockingQueue.html (but I agree with jwenting) ps: Looking at the 8 ways in your link, it's number 4 ("Observable") that The Java GUI … | |
Re: You can create a Shape with those line segments, and use an AffineTransform in Graphics2D to rotate/shear/ etc But 8 hours from now? Wow, that's going to be tough. Your teacher must be really challenging you to give you such short notice. (I assume, of course, that you haven't known … | |
Re: You haven't posted all the relevant code, but using String and getBytes(Charset...) is the wrong way to go when you need to read and write raw bytes from/to a stream. Using any kind of String or Charset will result in bytes being interpreted and replaced according to their character equivalences … | |
Re: Obviously you haven't compiled this code, let alone tested it. Before you ask people to spend time looking at it, take the time to compile it and fix all the compiler errors that you can. If you can fix them all (which yu should be able to do) the write … | |
Re: Please post the exact complete text of yhour errors | |
Re: Java byte variables are signed, so they are in the range -128 to +127, hence -56 rather than +200 | |
Re: What *exactly* is you problem/question? | |
Re: Nobody has the time to read all that and try to understand what it is you need. Please ask *specific* questions, backup up by details of what you have already done youself to try to answer them. | |
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 doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence … | |
Re: You haven't given much background to help anyone pick the rigt answer, but, in general, if the columns are of various types, then you would be pretty safe with creating a class to represent one row (instance variables for each column) then having an ArrayList of those instances to represent … | |
Re: Don't forget to move your main method to inside the class definition (ie after line 7) | |
Re: You need a JDK (Java Development Kit) from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html The installer will put it in a default location, which is normally best. Eclipse should find it when you re-start Eclipse after installing the JDK. If yo have no previous experience of Java I strongly recommend that you do not start … | |
Re: Start with one simple validation, get it working, then repeat that pattern. Here's a typical pattern for inputting one value and validating it, with an initial prompt, and a different re-prompt after errors: display normal request for input while (true) { get user input if (user cancelled) exit program // … | |
Re: You have repeated code for number1 - number5 where you really only need one number - the loop will allow you to enter mutiple values... print "Input grades scores, -1 to exit" do input a number if (number >= 90) etc etc while (number >= 0) // exit if number … | |
Re: Check the JOptionPane documentation. There's a method that allows you to give a prompt (eg "Enter file name") and get the answer back in a String | |
Re: Almost. The syntax allows for a list of expressions in each part of the for, so `for(i=0,ii=result.length;i<ii;i++)` is OK. See Java Language Spec section 14.14 It's probably written that way to avoid re-evaluating result.length on each pass of the loop in a (mistaken?) attempt to optimise execution speed. But your … | |
Re: I don't know what language that is, but it's not Java. You're in the wrong forum my friend. | |
Re: Sounds like you expect A to connect directly to B? That implies that B has a server running an open server port that's accessible from the internet. Normally an app like this uses the server to route messages from one user to another, so no user needs to know anything … | |
Re: It's a good idea to use an @Override annotation whenever overriding an inherited method or implementing an abstract one, eg @Override public void setRent (boolean rented){ this.rented = rented; } This will immediatly generate a compiler error telling you exactly what you did wrong (and will be helpful for anyone … | |
Re: Hello bakawas, welcome to DaniWeb Normally we discourage people from posting to threads that have been dead for a year, but in this case you have posted an answer to the question that will be useful to anyone searching that topic, so thank you very much for your contribution. (ps … | |
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: Why are you talking about editing the "fixed Java classes"? The error is in your code. The error messages relate to a single error and show the sequence of calls (starting deep in the Swing event handler), via your faulty code, and maybe back into a Java API method before … | |
Re: Assuming you have done nothing bizarre with class loaders, this code snippet, running in an instance of a class loaded from the jar, gives you a File reference to the jar file... File jarFile = new File(this.getClass().getProtectionDomain().getCodeSource() .getLocation().toURI()); From that you can easily get a reference to any other dir … | |
Re: It seems to me that the problem isn't in the code, it's in the design of the GUI. In general you can't neatly make repeated selections or delete errors just by making selections in a list of choices. At the very least you could have "Add" and "Delete" buttons which … | |
Re: You can't. An array size is fixed when it is created, and cannot be changed. All you can do is to create a second array of the right size, copy all the entries into that one, point any reference variables to the new array, then allow the original array to … | |
Re: See http://docs.oracle.com/javase/tutorial/essential/environment/paths.html | |
Re: Why Java is platform independent? Because it's sometimes a very good thing to be able to write and run the same software on Windows/Linux/Mac. And how to set path in Java? That depends on which platform you are using (which demonstrates the practical limitations to complete platform independence!) | |
Re: There are lots of people here who will freely give their time to help you become the best Java programmer you can be. 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 … | |
Re: See the Java Language Spec 14.14 - it makes this very clear... http://docs.oracle.com/javase/specs/jls/se5.0/html/statements.html#14.14 | |
Re: Hello Cyrairac Did you have a question relating to that code? It's not clear why you posted it. | |
Re: When you add lines etc in your mouse handler there's no way for Java to know that this will affect the way the panel is painted, so the paintComponent won't get called. After updating the Lines etc, call the repaint(); method for your drawing panel, so Java will schedule an … | |
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 doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence … | |
Re: Java has two Date classes, one in java.util (that's the normal Java Date that connects to Calendar etc) and one in java.sql (that's the SQL-compatible version). Both classes have methods to get and set their value as a long, so you can use a long value to convert easily between … | |
Re: If you look at your actionPerformed method it simply instantiates a new Bingo, Adivina, or Blackjack by calling their no-args constructors when the appropriate button is pressed. All you need is a no-args constructor in each of those classes in which you create the window and make it visible. | |
Re: You can tell for yourself if it's right or not by *testing it* Why do you hope it's **not** right? | |
Re: Hello the_yuo You keep saying what you want. You are not prepared to try the excellent advice you have been given, so you do not understand how your existing code works. let alone understand how to change it. Unless you are prepared to show some effort in trying to help … | |
Re: The Oracle tutorials tell you everything you need. Start here:: http://docs.oracle.com/javase/tutorial/uiswing/index.html | |
Re: There's no problem using an s format for enums - print will actually use the enum's .toString() anyway, so you can use a fixed-width string format like `printf("| %6s | %6s | %6s |", board[0][0], board[0][1], board[0][2])` Where it all falls down is if you want to center the shorter … | |
Re: I think there's no easy answer to this one. You may be better off with some advanced OS-dependent macro system? | |
Re: NEVER NEVER NEVER ignore an exception when writing or debugging code! Java has created an instance of SQLException packed full of debugging info for you, and you have chosen to ignore it. Bad move. Repeat after me: `e.printStackTrace() e.printStackTrace() e.printStackTrace() ...` :) J | |
Re: Calls to instance methods are resolved at run time, so when you call addAll or add from an instance of InstrumentedHashSet the JVM looks for versions defined in InstrumentedHashSet, and only looks for them in HashSet if they are not overridden in InstrumentedHashSet (unless you explictly use the super keywod … |
The End.