7,116 Posted Topics
Re: After sorting the array, you just have to compare each entry with the one before and the one after it. The first one that's different from the ones both sides is the smallest unique value. | |
Re: So, if you've got two threads executing at the same time, and they both try to use the same object (such as an OutputStream) at the same time, you can get "unexpected" or "unpredictable" results (aka absolute chaos). The synchronised (...) { ...} syntax mens that the current thread tries … | |
Re: Just as a matter of curiosity, I tried putting together a neat/compact version of this for my own amusement, and was surprised to see a strange pattern in the number of iterations needed for different number of decimal places correct. [CODE]Iteration 19 3.09162380666784, correct to ±0.05 (1 decimal place) Iteration … | |
Re: Try sticking a couple of System.out.println("step n"); type statements in the listener and the paint method so you can see when/whether they are getting called. That should help you to pinpoint where it's failing. ps: not sure why you have a [iCODE]Draw graph = new Draw();[/iCODE] in the listener - … | |
Re: I don' t know how to do this via Hyperterminal, but if you use a (free) command line terminal emulator instead of hypercard, you should be able to use it to send commands using the ProcessBuilder class in Java | |
Re: image.getScaledInstance(... required size ...); | |
Re: Enclose the name in double quotes? ls -s "dir 1/fileName" dir2/NewfileName | |
Re: (String)(Vector) looks unlikely. Whatever it is that follows is being cast to Vector, then immediately cast to String, which won't work. Try defining your Vectors with the appropriate types ,as in [icode]Vector<String> sv = new Vector<String>();[/icode] so you don't have all those horrible casts. | |
Re: I can't see the bit where you add the TextArea to your JPanel or any part thereof (?) | |
Re: So, I understand that you need to keep each digit separate and have algorithms that loop along the digits (no matter how many there may be) to give the answer. For the multiply - write down two multi-digit numbers on a piece of paper and multiply them together by hand. … | |
Re: It's saying that whatever class of object that is returned by photoElements.item(iElement) does not have a getAttribute(String) method. (Is id a variable? In which case it shouldn't have quotes round it). You need to look at the doc for photoElements.item to see what it returns, the look at that class's … | |
Re: [url]http://java.dzone.com/news/animated-javafx-meets-netbeans[/url] | |
Re: YOu can make an executable jar file (google it) that will run when people double-click it, provided they have the java runtime already installed on their machine. If you're using Eclipse or something similar it create it for you. | |
Re: public class GUI extends javax.swing.JFrame{ { = extra { = error | |
Re: [QUOTE=add4;834392]Because i want to block some site.[/QUOTE] Then why not just put a dummy entry in the hosts file? | |
Re: JTable really is the right way to do this, so it's worth the one-time effort to learn about them! Here's a quick sample of what you need to create a suitable table model (I haven't compiled this, so expect the odd typo, but it should be good enough to get … | |
Re: I think your last big if test should be all && not || - ie (word not in file 1) AND (word not in file 2) AND ... but I'm not sure. It would help if you used a code=java tag rather than just a code tag so we get … | |
Re: Post all the relevant code ( code=java tags) please. | |
Re: Add methods to the stand-alone classes so their functionality can be called from Java, eg public sendChat(String nick, String message). Then, in the GUI have entry fields for the required data, when the user clicks OK, get the data from the fields and use it to call the functionality via … | |
Re: You could create a little class to hold the event description and the database ID (and maybe any other relevant stuff). You can add those class members to the JList, and it will display them by calling their toString() method, so define a toString() that just returns the event description. … | |
Re: You don't set the timeout in the constructor, it's an optional parameter on the connect(...) method. | |
Re: Do you want the second panel to be open all the time, or do you want it to appear when the user selects a film in the first panel? | |
Re: Yoy seem to be on the right track here - copy the data fromn the TextFields into the fields of your Adult object (using the set... methods, or just putting all the values in the new Adult(...)), then add the Adult object to the array. NB Java arrays begin with … | |
Re: Sounds like you need to send TCP/IP messages between the two machines using Sockets. To get started see [url]http://java.sun.com/docs/books/tutorial/networking/sockets/[/url] | |
Re: tracks.add(new Track()); looks for the constructor Track() but you didn't define one, just one with a whole string of parameters | |
Re: Looks like a job for a regular expression: [url]http://java.sun.com/docs/books/tutorial/essential/regex/[/url] | |
Re: Maybe because your txt value exceeds the 16 char max size that you set for the text box? | |
Re: Yes, you can do it with a custom renderer - I've dome something similar myself. | |
Re: Good morning neutralfox. Wow, that server code really has been cleaned up! All you need to do in response to the button being clicked is to get the text from the input field and pass it as the parameter to the server's send method. The only problem I see in … | |
Re: ss.accept(); blocks its thread waiting for an incoming connection. Because you run that on the Swing thread everything gets blocked, and the whole program freezes until an incoming connection is received. You normally spawn a new Thread to run the accept() in. ps. Its not a good idea to have … | |
Re: You've forgotten to put the values of mouseX and mouseY into the two TextFields | |
Re: Check that your code for Couple has a setVisible(true) in its constructor | |
Re: [url]http://www.comweb.nl/java/Console/Console.html[/url] | |
Re: Your cacAveragePrice method needs an ArrayList as a parameter, and when you call it you don't supply a parameter | |
Re: [QUOTE=jk_bscomp;824917] If I will run my Server program, the output will be 0:0:0:0:0:0:0:1. [/QUOTE] Is that an IPv6 address? | |
Re: Sorry to hear that your Google search facility is broken. :icon_cheesygrin: Anyway, I did a Google search for [icode]JDBC ODBC driver[/icode] on your behalf, and this [url]http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/bridge.doc.html[/url] was the very first entry. | |
Re: Sorry, don't have the time to do much on this, but start with a Card class (52 instances!) and a Player class (that holds a list of the Cards that the player holds, the player's current cash and bet, and has the logic for stick/twist etc). Maybe a Dealer class … | |
Re: If you want to read/write an object via writeObject / readObject the object's class must implement the Serializable interface. It's a bit weird, because that interface doesn't define any methods! It's a sort of flag to Java that if you define the class (Archive) as [icode] implements Serialiable[/icode] then you … | |
Re: 1. Java integers are 32 bits. 2. Java Strings are 16 bits per character 3. To compare them or use the String in arithmetic expressions, you first need to convert the string to integer with something like [icode] int i = new Integer("12345"); [/icode] | |
Re: This may help [url]http://www.roseindia.net/java/beginners/java-create-directory.shtml[/url] | |
Re: compareTo returns -1, +1, or 0 depending on whether the string sorts before or after, or is exactly equal to the other string. You're testing for +1, so that's why you get false "equals". To see if one sting occurs inside another one, use String.indexOf(String), which returns the index where … | |
Re: Executing a long-running process in the Swing thread is a big no-no, for exactly the reasons you have discovered - ie the whole GUI hangs up while the process executes. Your only solution is to run the FTP process in a separate thread. Just place the call for your FTP … | |
Re: I suspect that 11 factorial is greater than the maximum value of a Java int (about 2,000,000,000), so you'll have to use a different data type (eg long) to go bigger. | |
Re: Hold x velocity constant, set an initial upwards y velocity (depending on how hard he jumps). In each time interval reduce the y velocity by a fixed small amount (modelling the effect of gravity). As the y velocity reduces to zero then goes negative he will follow an inverted parabola, … | |
Re: That's a lot of code to scan, but I can't find anywhere where you actually call anything to do an FFT. And maybe I'm being dumb, but I can't find any code to do an FFT anyway. Can you point me in the right direction? | |
Re: As in mouse clicks? Look at the Robot class in java.awt, it allows you to move the mouse, click left/right button etc under program control. | |
The End.