7,116 Posted Topics

Member Avatar for Allison_1

There are lots of ways... One way is to create 3 arrays for name, lat and long, and populate them with the location data. Then when the user enters a name you can search the name array, then use the index where you found it to get the lat and …

Member Avatar for JamesCherrill
0
355
Member Avatar for simran_4

jp=new JPanel[12]; creates an array of 12 references to JPanels, but it doesn't create any JPanels, all the references are null, which is why you get the NPE on line 41. After creating the array you need to populate it by assigning new JPanels to each of its elements.

Member Avatar for simran_4
0
565
Member Avatar for scheppy

Post the exact complet etext of your eror messages. Don't expect us to guess what they are.

Member Avatar for JamesCherrill
0
280
Member Avatar for ronnel09_2

I don't have time now to study your code - I gave up when I saw you trying to add things to a JLabel! But you can't just add overlapping things to an ordinary frame or panel and have any control over which gets painted on top of which. But …

Member Avatar for ronnel09_2
0
196
Member Avatar for shchandhu

It depends... For primitives that are local variables declared inside methods or other blocks, and for method parameters, they are allocated on the stack and released as soon as they go out of scope. For primitives that are declared as static members of a class, the lifetime is the same …

Member Avatar for JamesCherrill
0
127
Member Avatar for nikolaos

Your PointOneClone(PointOne point) method seems weird - you pass it a parameter but you never use that parameter in the method. The usual convention for a "copy constructor" would be a constructor, not an ordinary method, taking another instance as its only parameter, and initialising its values from that other …

Member Avatar for JamesCherrill
0
210
Member Avatar for CoilFyzx

In defence of cool_zephy's suggestion... Storing a Serializable object - no matter how complex its internal structure and content - is a single call to writeObject. Restoring it ditto. Storing/restoring data with multiple occurences of complex data by mapping it into relational tables can be very complex and code intensive. …

Member Avatar for CoilFyzx
0
407
Member Avatar for rubeea.jaffari

Short answer: there are some hacks out there that try to avoid you needing a JVM - usually by packaging a version of a JVM and all the Java API classes into an executable with your classes. In general they don't work well, they prevent essential automatic security updates, and …

Member Avatar for stultuske
0
213
Member Avatar for azraa

You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java …

Member Avatar for JamesCherrill
0
186
Member Avatar for sangeethab

How can you possibly access a remote machine without using its IP address? YOu could use something like JmDNS to locate the remote machine, but you still have to use the IP address from JmDNS to access the machine itself. ps: DaniWeb Member Rules (which you agreed to when you …

Member Avatar for jalpesh_007
0
175
Member Avatar for srikanth2321

To use that jar from an ordinary Java application (ie not in Eclipse) you should place a copy of it somewhere in the system classpath

Member Avatar for srikanth2321
0
248
Member Avatar for ezra.kim.98

If you want to analyze the first line after printing all the lines then you need to store that first line somewhere. In fact, why not store all the input? Use an array or ArrayList of Strings to store all the data as you read it in, so it will …

Member Avatar for ObSys
0
314
Member Avatar for Abdul_19

You can read the image into an Image object, then use the PixelGrabber class to examine the individual pixels and get their colors, but after that it gets difficult - how exactly would you define "background color" and "foreground color" for some arbitrary image?

Member Avatar for ObSys
0
330
Member Avatar for SreeJo

You can call JTree's expandPath(TreePath path) or `expandRow(int row)` or the corresponding `collapse` methods to control which nodes will have their child nodes diplayed.

Member Avatar for mKorbel
0
158
Member Avatar for mussdroid

I guarantee that nobody human can possibly tell you what's wrong with your code if you don't show us that code!

Member Avatar for mussdroid
0
205
Member Avatar for sarthak25

You can append any String to a StringBuffer by using its append method, eg StringBuffer sb = new StringBuffer("pattern is "); String pattern = "/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/"; // will need to escape the \ chars as \\ sb.append(pattern);

Member Avatar for JamesCherrill
0
198
Member Avatar for mussdroid
Member Avatar for mussdroid

If that solved yoyur question, please mark this "solved" for our knowledge base. Thanks

Member Avatar for JamesCherrill
0
261
Member Avatar for 2384443

If that solved yoyur question, please mark this "solved" for our knowledge base. Thanks

Member Avatar for JamesCherrill
0
212
Member Avatar for djdanjo82

[QUOTE]- Add components to the ContentPane - not the root of JFrame[/QUOTE] Not sure if it was 1.5 or 1.6, but this annoyance has now been fixed and ... [QUOTE] As a conveniance add and its variants, remove and setLayout have been overridden to forward to the contentPane as necessary. …

Member Avatar for ramesh midatana
0
2K
Member Avatar for Benjamin_4
Member Avatar for JamesCherrill
0
135
Member Avatar for <M/>

Hi dev90 Before you put too much effort into this thread, you should be aware that <M/> has double-posted, and there is already a pretty full discussion of exactly the same code here: http://www.daniweb.com/software-development/java/threads/469611/similar-error-as-before

Member Avatar for dev90
0
322
Member Avatar for rohan21blade

In Checkout you create a new Index then immediately get LCNum from it. At that point the user has had no chance to interact with that Index, so its value1 has never been set, so it's null, which is why you get that SQlerror (phew!). The fix for this lies …

Member Avatar for JamesCherrill
0
295
Member Avatar for nay.htet.1481

Sounds like you may have hard-coded a file or path in your app that isn't present/valid on the other machine? Or it may just be lunch4J mis-behaving. Do you really need to use it? Why not just distribute a jar?

Member Avatar for stultuske
0
232
Member Avatar for JRDJ12

OK, so what's the question? Calculation of the minimum perhaps? [ICODE]if (min > grades[i])[/ICODE] how often is that true when min is 0?

Member Avatar for JamesCherrill
0
10K
Member Avatar for Graphix
Member Avatar for sciwizeh

It seems dangerous to have both an action listener and a mouse listener for the same button(s). I don't think there is any guarantee about the order in which these two listeners will be called, especially if there's a lot going on. Maybe the bug is caused by the action …

Member Avatar for sciwizeh
2
858
Member Avatar for <M/>

That's one way to do it. A more experienced programmer would probably separate the user interface from the calculation. The initialisations on line 7-9 are redundant because those values are never used. There's a much simpler formula for the area of a triangle defined by three Points a,b,c: 0.5*((a.x - …

Member Avatar for JamesCherrill
0
208
Member Avatar for xchris

It seems that getLevel was not implemented in the early releases (just returns -1 error code) It was listed as a bug around version 1.4.1, but as far as I could see it was never fixed. Part of the justification is that they could not agree a definition of "level" …

Member Avatar for xchris
0
1K
Member Avatar for Helpmeplease123

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.

Member Avatar for ObSys
0
259
Member Avatar for migu2990

What did you try? All you have shown is `return 0;` You just need a loop that goes through the array checking each entry to see if it matches the patterns, and deleting it if it matches. You can't just "delete" an entry in an array like that - you …

Member Avatar for migu2990
0
409
Member Avatar for Benjamin_4

JLabels etc accept simple HTML code to control formatting, headings, font color etc, eg aLabel.setText("<HTML><H1> Hello</H1>" + "<FONT COLOR="RED"><CENTER>World" + "<FONT SIZE=-2 COLOR="GREEN"> and friends");

Member Avatar for JamesCherrill
0
99
Member Avatar for <M/>

You also seem to be reversing the original number, whereas the "right" answer reverses the doubled value.

Member Avatar for kal_crazy
0
173
Member Avatar for Violet_82

The second code is valid only if its in a class that extends a swing component that accepts mouse listeners, eg `extends JPanel`. Because there is no explicit obect for the the call, it's the same as `this.addMouseListener` which is OK if `this` is an instance of a class that …

Member Avatar for Violet_82
0
486
Member Avatar for nikolaos

Also note that Integer is a class, so you are creating 1000 new instances of that class. That's not the same as 1000 ints (primitives) that would be just 4 bytes each

Member Avatar for mKorbel
0
777
Member Avatar for <M/>

YOu didn't post the requirements, but this line: System.out.println("The number of integers is " + num); implies that num should be a count of how many integers were entered, but what you are printing is just the latest integer. You don't count them.

Member Avatar for <M/>
0
336
Member Avatar for tbuchli
Member Avatar for <M/>

That code (with a Scanner declaration for kbinput, aqnd placed inside a method) compiles without any errors or warning in NetBeans, and gives the right answers when executed. Maybe the problem is not in that code but caused by something in the rest of the class?

Member Avatar for <M/>
0
228
Member Avatar for Pratique

Start by reading the tutorials: http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html

Member Avatar for JamesCherrill
0
77
Member Avatar for daniel_14

To prompt the user and get input in a simple gui, use JOptionPane (Google it for details). Display stuff in your text area by calling its append(String str) method. But if you wanted to make your text area work just like the console window for input and output then (a) …

Member Avatar for JamesCherrill
0
205
Member Avatar for albedini

albedini: please be polite. Old Apache is trying to help you. The very first sentence of his previous post explains why your print produces nothing with those call parameters. What is it about that explanation that you do not understand or think is irrelevant?

Member Avatar for JamesCherrill
0
263
Member Avatar for Pobunjenik

I suppose you did remember to call setDefaultRenderer or setCellRenderer (for the relevant columns)? And did you setOpaque(true)? because the default renderer is a JLabel, which is opaque(false) by default, so it never shows its background colour.

Member Avatar for mKorbel
0
459
Member Avatar for Derek_4

Initialise it to false, then set it to true in the code where you find or take an item? Or is the problem actaually more complicated than that?

Member Avatar for JamesCherrill
0
115
Member Avatar for Zubi0777
Member Avatar for StephenopolousINC

*A. Develop a working application that implements an interface.* So far you have no interface in your code. If only to meet the requirements of the exercise you could make Lootable an interface - it already sounds more like an interface (it's an adjective) not a class (its's not a …

Member Avatar for StephenopolousINC
0
928
Member Avatar for sk8ergirl

Your test data does not show you writing the ArrayList to the file. The exception is telling you that the data is the file looks like a single String. It may be a good idea to delete that file, and use your writeFile method to write an arraylist to tghe …

Member Avatar for JamesCherrill
0
239
Member Avatar for Ritesh_4

Are you looking for a Java-specific solution or something more general, eg a regular expression. Are you just looking for the following rules: ( "0" OR "+33" OR "0033" ) followed by a non-zero digit, followed by exactly 8 digits, blanks to be ignored? ... if so it's the same …

Member Avatar for Ritesh_4
0
136
Member Avatar for sk8ergirl
Member Avatar for JamesCherrill
0
370
Member Avatar for Derek_4

Well... First, you set newBoat to false on line 10 then try to see if it's false on line 11 - which ot always will be! Second, on line 11 you have coded an assignment rather than an equality operator

Member Avatar for JamesCherrill
0
136
Member Avatar for Necrozze

stultuske: its totally obvious that this is a task that he has been set. Yes, it makes no real sense, but as a programming exercise he has no choice but to program it as specified. Necrozze: One way is to loop through the strings taking one character (ie digit) at …

Member Avatar for Necrozze
0
359

The End.