7,116 Posted Topics

Member Avatar for aanders5

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)

Member Avatar for aanders5
0
260
Member Avatar for nickecarlo

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

Member Avatar for nickecarlo
0
219
Member Avatar for carolinatech

"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".

Member Avatar for zeroliken
0
286
Member Avatar for techyworld

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.

Member Avatar for JamesCherrill
0
364
Member Avatar for sharvil_maniyar
Member Avatar for Hussam Alahmadi

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 …

Member Avatar for JamesCherrill
0
2K
Member Avatar for JamesCherrill

What (if anything) is the difference between these two? [CODE]String[] sa = {"ABC"}; String[] sa = new String [] {"ABC"};[/CODE]

Member Avatar for JamesCherrill
0
183
Member Avatar for nickliutw

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.

Member Avatar for dantinkakkar
0
152
Member Avatar for Syrne

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 …

Member Avatar for hfx642
0
226
Member Avatar for jarograv

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 …

Member Avatar for Philippe.Lahaie
0
191
Member Avatar for freedomflyer

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 …

Member Avatar for freedomflyer
0
1K
Member Avatar for bcain2121

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 …

Member Avatar for JamesCherrill
0
288
Member Avatar for riahc3

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 …

Member Avatar for riahc3
0
238
Member Avatar for hurrycart
Member Avatar for stultuske
0
129
Member Avatar for liphoso
Member Avatar for stultuske
0
245
Member Avatar for shaan_046
Member Avatar for 09cody

[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]

Member Avatar for JamesCherrill
0
299
Member Avatar for gedas

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]

Member Avatar for JamesCherrill
0
1K
Member Avatar for MineCrafter

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

Member Avatar for JamesCherrill
0
584
Member Avatar for Stjerne

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 …

Member Avatar for JamesCherrill
0
156
Member Avatar for vuquanghoang

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.

Member Avatar for Philippe.Lahaie
-1
257
Member Avatar for artemis_f

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.

Member Avatar for stultuske
0
1K
Member Avatar for Hitman Mania

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 …

Member Avatar for JamesCherrill
0
169
Member Avatar for Samwal

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 …

Member Avatar for JamesCherrill
0
218
Member Avatar for adil_bashir

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 …

Member Avatar for dantinkakkar
0
168
Member Avatar for jackbauer24
Member Avatar for zeroliken
0
309
Member Avatar for sha11e

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 …

Member Avatar for stultuske
0
3K
Member Avatar for 47pirates

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 …

Member Avatar for dantinkakkar
0
221
Member Avatar for riahc3
Member Avatar for HBK_100

[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 …

Member Avatar for JamesCherrill
0
182
Member Avatar for shibu2all

[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 …

Member Avatar for dantinkakkar
0
186
Member Avatar for DEAD TERMINATOR

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, …

Member Avatar for stultuske
0
355
Member Avatar for hyperstars

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 …

Member Avatar for JamesCherrill
0
201
Member Avatar for mohamed moamen

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 …

Member Avatar for mohamed moamen
0
248
Member Avatar for TIM_M_91

Have you tried the obvious SET PLAYCOUNT = PLAYCOUNT + 1 ... seems to work in ordinary SQL

Member Avatar for TIM_M_91
0
176
Member Avatar for ilovejava

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 …

Member Avatar for rubberman
0
114
Member Avatar for jackbauer24

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 …

Member Avatar for jackbauer24
0
172
Member Avatar for aliasadsahu

[CODE]public String toString() { return super.toString() + ...[/CODE] The superclass toString is called because the subclass's toString calls it ( [ICODE]super.toString()[/ICODE] )

Member Avatar for JamesCherrill
0
126
Member Avatar for nered

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 …

Member Avatar for JamesCherrill
0
433
Member Avatar for ali.jay110

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 …

Member Avatar for ali.jay110
0
341
Member Avatar for angryKitten

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. …

Member Avatar for JamesCherrill
0
137
Member Avatar for v3ga
Member Avatar for ShaRp codeR

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.

Member Avatar for ShaRp codeR
0
385
Member Avatar for shifat96

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 …

Member Avatar for shifat96
0
941
Member Avatar for RLS0812

NameHere is a method that takes a String[] as a parameter. You try to call it without supplying a parameter

Member Avatar for FALL3N
0
309
Member Avatar for tharindupro

You could Google [ICODE]java play video[/ICODE] ... or did you want someone to do that for you?

Member Avatar for JamesCherrill
0
246
Member Avatar for newbie14

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.

Member Avatar for JamesCherrill
0
377
Member Avatar for riahc3

[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] …

Member Avatar for riahc3
0
210
Member Avatar for riahc3

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.

Member Avatar for riahc3
0
208
Member Avatar for mohamed moamen

Delay the start of playing the sound at the server until the client is ready to start playing it?

Member Avatar for JamesCherrill
0
91

The End.