7,116 Posted Topics
Re: Do you mean you want to remove them from the array, or remove them from our GUI? To remove them from the GUI use the remove(..) method (exactly like the add method you used to add them to the GUI) | |
Re: Line 223 as in (userCode[i].equalsIgnoreCase(codesRead.codes[1]) && userQuantity[i] >= 1) { the first question is which of those is null? Immediately before that line print all those variables to see which is null (personally I suspect userCode[i]) When you know which it is, you should be able to see why | |
Re: "code is to repeat " tells you you need a loop. You can put the code enter a year and display the result into a while loop, and keep looping until the user enters "n". | |
Re: If you read that example you will see where it declares an array of numbers that are the data for the pie chart. Replace that with whatever code you want to get your dynamic data from whereever. | |
![]() | Re: Yes, Nimbus was new from 1.6 update 10 to be precise |
Re: You are heading in the right direction, but you haven't got there yet... in your loops starting lines 20,21 you need to ask: is this cell on the main diagonal (i==j)? if so the value must be 1, if not the value must be zero. If you find any exception … | |
What (if anything) is the difference between these two? [CODE]String[] sa = {"ABC"}; String[] sa = new String [] {"ABC"};[/CODE] | |
Re: Exception ex contains full details of what went wrong and exactly where it went wrong. Don't ignore it. Use ex.printStackTrace(); to see what it can tell you. | |
Re: In real life its rare to very rare that you write your own versions of Java API classes like those. Even if there is some small optimisation you could do for some highly specific application, you would have to offset that against the disadvantages of using "roll your own" code … ![]() | |
Re: Runtime.exec isn't going to do what you need. Assuming you are on Java 1.6 or 1.7 (which you should be) you can use the new Desktop class to open any arbitrary file in whatever application the OS associates with that file type (eg Image Viewer for jpegs). This tutorial tells … | |
Re: In a single-threaded environment you get a ConcurrentModificationException when you modify the [I]Collection [/I]that you are iterating over - ie by adding or removing or replacing elements. You don't get an error when you modify the attributes of the individual elements in the Collection (unless they, in turn, cause things … | |
Re: Hang on... this is a stack overflow, not a heap overflow. All the discussion so far applies to a heap overflow. Objects are created on the heap, and you overflow that by creating too many objects, or by preventing old objects from being garbage collected. The stack is where blocks … | |
Re: Typical roseindia - hardly an expert solution, and more important to this thread, does nothing about the file headers. riahc3 - have you had a look at the NIO (new I/O) classes in Java 7? They have lots of new stuff for copying files and handing file attributes - even … | |
Re: I vote for the simplest solution that will do the job - in this case a jar. | |
Re: What's the exact error message, and which line does it refer to? | |
Re: I think you want the Javascript forum - this one is for Java. | |
Re: [CODE] return ( e != null && e.getMother() == /* ?????? */)[/CODE] The java keyword [ICODE]this [/ICODE]refers to the current object - so if you are testing for e.getMother() being the current Elephant (the one in which this method is being executed) it's as simple as [CODE]e.getMother() == this[/CODE] | |
Re: Use split to get he tokens in ann array Loop thru the array processing every third element [ICODE](int i = 2; i<array.length; i+=3)[/ICODE] | |
Re: Don't hijack old threads If you have a question start your own thread If you post code post, it in code tags If you want people to read it, indent it properly | |
Re: dantinkakkar: That looks is an almost-right statement, this version is correct syntax: [CODE]try(DataOutputStream output = new DataOutputStream(new FileOutputStream(filename))) { ...[/CODE] the problem is that you can't use a try-with-resources on something that's declared outside the try (eg by being passed as a parameter). Stjerne: you are trying to create a … | |
Re: No way I'm downloading a RAR from an unknown source. Publish your code in this thread, [B][I]correctly indented, in code tags [/I][/B]if you want anyone to read ut. | |
Re: Member rules:[url]http://www.daniweb.com/forums/faq.php?faq=daniweb_policies[/url] including "Do not hijack old threads by posting a new question as a reply to an old one" Post your question in a new thread. | |
Re: Why are you using low-level mouse events for handling a button click? An actionlistener is simpler, and handles keyboard mnemonics as well. In general your code will be cleaner if you have separate listeners for each event and source, rather than one giant listener full of if tests on the … | |
Re: Swing graphics doesn't work the way you think. You don't control the Graphics and you you don't draw whenever you want. All these things are controlled by Swing. To draw you own stuff you override [ICODE]public void paintComponent(Graphics g)[/ICODE] and put your drawing code there. Swing will call that, with … | |
Re: Isn't this fun!! I tried a "manual" calculation in both double and long variables: [CODE] void calcDouble() { double c=11, cPow2 = c*c, cPow4 = cPow2*cPow2, cPow8 = cPow4*cPow4,cPow16 = cPow8*cPow8, cPow23 = cPow16*cPow4*cPow2*c; System.out.println(cPow23 + " " + cPow23%187); } void calcLong() { long c=11, cPow2 = c*c, cPow4 … | |
Re: Tic-tac-toe - some Swing, some arrays, some logic... but nothing too hard. | |
Re: Maybe the problem is the Robot is pressing keys at the "hardware" level, not at the logical character level. So for upper-case A you need to press VK_SHIFT then VK_A, then release them both On my UK keyboard ! is VK_SHIFT then VK_1, etc. But the code sequence for accented … | |
Re: Java writeObject writes objects in its own format that can be decoded by readObject. It includes headers that describe the content that will follow. You're not going to have much success reading an ObjectOutputStream with anything other than an ObjectInputStream. Conversely you're not going to have much success writing data … | |
Re: Use an instance of SimpleDateFormat to format a new Date() | |
Re: [CODE]catch (Exception e) { JOptionPane.showMessageDialog(...Cannot connect you to the database. }[/CODE] Actually there are many other Exceptions that could be thrown from your try block eg null pointer... who knows? But this code will make you think it's always a database connection problem When developing your code you should ALWAYS … | |
Re: [QUOTE]I just want to know that why are we using 3 sockets for client and not 1, and why 4 ArrayLists, [/QUOTE] I don't know where you got this code from but to me it looks very amateur - maybe a beginner's first attempt at a socket program? Unless there's … | |
Re: You can't return a null from a method that's declared as returning a primitive. If you want a return that clearly signals the fact that the method isn't complete yet, then there is a special double value called NaN ("Not a Number") that you can access via the Double class, … | |
Re: Depending on where you are going next with this, it may be a good idea to stop for a moment and think design. It sounds like you have a class that represents an Account, a Collection that holds multiple Accounts, and a text file that contains the data for all … | |
Re: You may also hit a memory limit - I don't know how much heap one connection and its associated application objects use, but even if its only 4k bytes a million connections pushed you over 4 gig. I think you need to look at a server farm that spreads the … | |
Re: Have you tried the obvious SET PLAYCOUNT = PLAYCOUNT + 1 ... seems to work in ordinary SQL | |
Re: In Java 1.5 there were some significant enhancements to the language (particularly Generics) and many classes were updated to use the new language features. Code written before 1.5 still works, but the compiler issues warnings where the code should be updated to the new standards. If you're still re-hashing the … | |
Re: I really can't think of a clearer way to explain this exception than the version you already have [QUOTE]WrittenText.txt (The system cannot find the file specified)[/QUOTE] You solve it by having the same file name for the file you write and the file you read. (count the "t"s in those … | |
Re: [CODE]public String toString() { return super.toString() + ...[/CODE] The superclass toString is called because the subclass's toString calls it ( [ICODE]super.toString()[/ICODE] ) | |
Re: The two key classes you will need are ServerSocket and Socket (short for "client socket"). You create a ServerSocket on your server. It listens for incoming requests on a chosen port. You create a Socket at the client that connects to the server. The ServerSocket accepts the connection and gives … | |
Re: It's hard to criticise the functionality of arbitrary code, but... [QUOTE]constructor was passing a null value, which in turn was setting a final variable. This variable will always hold a null value[/QUOTE] OK, so ConceptC is like ConceptA except that it has a serial no, and its parent is always … | |
Re: As I understand it you have a closed range of ints, and you want arbitrary subsets of that range to compare equal. You need some kind of data structure to encode which subsets are equal. Let's number the subsets. Values 1,2 should compare equal, let''s put them in subset 1. … | |
![]() | |
Re: VisualParadigm [url]http://www.visual-paradigm.com/product/vpuml/provides/roundtripcodeengine.jsp[/url] is OK, and best of all has a "community edition" that's free for non-commercial use. It also has an Eclipse plug-in. | |
Re: The JTextField stuff applies to a GUI text field, not to console output. Have a look at using printf instead of print, because that allows you to specify formatting for items when you print them at the console.. printf is a method of the PrintStream class, so you'll find the … | |
Re: NameHere is a method that takes a String[] as a parameter. You try to call it without supplying a parameter | |
Re: You could Google [ICODE]java play video[/ICODE] ... or did you want someone to do that for you? | |
Re: There's no obvious reason why adding a non-null element to a LinkedBlockingQueue would ever fail (except maybe out of memory?). Fix your printStackTrace so we can see if there's an exception. | |
Re: [QUOTE=riahc3;1759379]If Im located there, how would I go up a directory (To "C:\Archivos de programa\MyEclipse for Spring\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806\tomcat" ) ?[/QUOTE] You don't need all that manual "last index" parsing pain. Just create a File object to the original dir then use getParent() to give you the parent (one-up) dir. eg [CODE] … | |
Re: I don't think there's anything you can do in your sending program to bypass Outlook's junk filtering rules. (If there was, then then junk filtering would be useless.) You have to configure Outlook not to junk those messages, eg by white-listing the sender's domain. | |
Re: Delay the start of playing the sound at the server until the client is ready to start playing it? |
The End.