7,116 Posted Topics

Member Avatar for denmarkstan

Me too, I'm baffled. Do you really want to convert a method name (System.out.println) to an int??? You need to explain exactly what it is you are trying to do!

Member Avatar for hanvyj
0
162
Member Avatar for rushhour2

That's way too much code to try to analyse just for fun. Start to load you code with lots of System.out.println statements working backwards from the point where you get the unexpected null output - sooner or later you will find the point where it all goes wrong and then …

Member Avatar for quuba
0
147
Member Avatar for theurbanist

Even at the pseudocode level that's not going to work: firstStep = console.nextLine(); eg "ooxxx" secondStep = firstStep.replaceAll(o, x); "xxxxx" thirdStep = thirdStep.replace(x, o); "ooooo" System.out.println(thirdStep); "ooooo" This needs an extra step: replace all the o with some temp char replace all the x with o replace all the temp …

Member Avatar for rapture
0
170
Member Avatar for Neversleepin

Would be useful to know which file caused the refused access - especially if it was the output file. A few debugging print statements would help.

Member Avatar for bibiki
0
1K
Member Avatar for mbouster

@toko What you wrote applies only to versions of Java before 1.5 (apart from the bit about primitives which was just wrong). It's very misleading to post that now. @mbouster: You should ignore that, and stay with the 1.5 syntax as shown by pbl. There is normally no need to …

Member Avatar for jon.kiparsky
0
230
Member Avatar for ajst

Here are a few: You can use it to hack into methods that are declared private. Eg there's a popular hack to give access to the Windows registry by gaining access to the private methods used by the Preferences class to read/write the registry for its own purposes. (NB I'm …

Member Avatar for ajst
0
155
Member Avatar for sirlink99

[QUOTE]I have a problem with this code and I do not know what is causing it.[/QUOTE] This is a joke, yes? Do you understand what a "problem description" is? If it's an NPE you could give us just the tinyest little clue to work on - like which line?

Member Avatar for sirlink99
0
119
Member Avatar for Katana24

Create a String constant "*********************************************" then use substring(0,numAster) to pick the right numbert of *s from the fromt of it.

Member Avatar for masijade
0
167
Member Avatar for inilahs

AFAIK BigInteger will handle as many digits as you have memory for, certainly 600 is OK.

Member Avatar for JamesCherrill
0
118
Member Avatar for shack99

Each time you call your method test you create a new ArrayList. Just declare and initialise it outside that method.

Member Avatar for shack99
0
180
Member Avatar for blueman:-0

Where are the form and the label? Where do you make them visible? We need the rest of your code.

Member Avatar for JamesCherrill
0
90
Member Avatar for methmignonne

Have a look at the PixelGrabber class for getting pixels from images in general

Member Avatar for methmignonne
0
1K
Member Avatar for deb081900

See this recent post [url]http://www.daniweb.com/forums/thread334990.html[/url]

Member Avatar for JamesCherrill
0
641
Member Avatar for Alex_

Don't have time to cehck this now, but don't you need a default constructor for a Serialisable class to be restored?

Member Avatar for Alex_
0
2K
Member Avatar for draven07

First split the String into words (see the split(...) method in String class), process each word using charAt etc, the put all the words back together into a sentence.

Member Avatar for draven07
0
96
Member Avatar for ayan2587

With the commented line in you read the whole file into the buffer. Then in the while you start by reading again - but the file has now been read so you get an immediate end-of-file and the var is et to -1. read(byte[]) works just fine.

Member Avatar for ayan2587
0
104
Member Avatar for gedas

Drawing over a line to delete it doesn't work too well because you will end up with gaps in the other lines where the deleted line overlapped them. Each time a button is clicked update a list of which lines should be visible, then clear the whole drawing area and …

Member Avatar for JamesCherrill
0
75
Member Avatar for christos312

This is (IMHO) a horrible design omission in Swing - AFAIK there's no simple method to get the selected JRadioButton in a ButtonGroup. Most people just loop thru the buttons using their inherited isSelected() method to find the one (if any) that's selected OR they have a Listener for the …

Member Avatar for christos312
0
602
Member Avatar for lse123

There's no such thing as a .exe for a Java program (unless you use an unsupported dodgy system-dependent utility to try to create one). A .jar file is just a zip file with some metadata. Just like any other zip you can put whatever files or directories you want into …

Member Avatar for ~s.o.s~
0
296
Member Avatar for JakeStanely

That looks like a mistake - the Rentals (Java classes conventionally begin with an upper case letter) class should have an instance of Client, not just a clientID (ie like the 3 DVD members).

Member Avatar for JakeStanely
0
308
Member Avatar for mangopearapples

So put some System.out.println statements into the relevant parts of the code to see which code is being executed and whether the variables have the values you expect. (It's called "debugging").

Member Avatar for roxin_phoenix
0
186
Member Avatar for seun101

Account newAcc is defined inside buttonCreateActionPerformed so it can't be accessed from outside that method. You haven't explained the overall logic of your app, so I can't suggest the best way to fix this. But deposit is an instance method of Account, so you should just be able to call …

Member Avatar for JamesCherrill
0
99
Member Avatar for peter_budo

I can't understand what you are trying to do with all the Reflection methods here! What do you need to do that is different from the standard pattern: [CODE]ArrayList<CountListener> listeners = new ... ... void fireCountEvent(int count) { for (CountListener cl : listeners) { cl . countEvent(count); } } ... …

Member Avatar for svedrenne
0
3K
Member Avatar for gedas

I don't have experience with your particular problem area, but I just want to assure you that there are quite a number of people around here who would help if they could. Also, you've chosen a bad week to get help - many people have not been at their desks. …

Member Avatar for gedas
0
126
Member Avatar for daudiam

A blank final var must be initialised in all constructors - ie it must have a value by the time the containing instance has been initialised.

Member Avatar for daudiam
0
162
Member Avatar for softswing
Member Avatar for blur0224

Don't worry blur, I got it, and I laughed. Thanks for the giggle. Merry Xmas

Member Avatar for JamesCherrill
0
97
Member Avatar for Tango2010
Member Avatar for blur0224

Is the content length being returned as zero? Does the if on line 61 evaluate to false? Is stream.available on line 70 zero? Just a gut feel - but the whole loop starting line 74 seems insanely complex - why not just create buf of the right length and read …

Member Avatar for blur0224
1
310
Member Avatar for churva_churva
Member Avatar for daudiam

That's [I][B]really [/B][/I]interesting. I too can assign a String too what should be an Integer and it works. The real answer is to declare nn1 fully, as in R2<Integer> nn1 = new R2<Integer>(); ij which case the compiler correctly rejects (1)

Member Avatar for daudiam
0
205
Member Avatar for gedas

I'm not familiar with WS, but what's the connection between displayNames() that you call on the client and openFile that you define on the server?

Member Avatar for gedas
0
127
Member Avatar for misszeze

"move data with large size from one object to another"? Move or just get access to? How large? Objects in the same JVM? Different JVMs on the same machine? Two machines in the same network? In general trying to optimise code before its working ("premature optimisation") is a waste of …

Member Avatar for JamesCherrill
0
90
Member Avatar for Akill10

IF your class extends Thread the it inherits the start() method, and you can start it. Otherwize you need a new Thread(yourRunnableInstance) and start that.

Member Avatar for Akill10
0
170
Member Avatar for Ralphael

Without a server you may have a problem getting the IP addresses of the two machines that need to communicate. JmDNS [url]http://sourceforge.net/projects/jmdns/[/url] can be useful in that case.

Member Avatar for JamesCherrill
0
144
Member Avatar for hashim11

implements ... need an interface name here. ps post iin code tags and indent code properly

Member Avatar for quuba
0
146
Member Avatar for eman 22

Serializable [QUOTE]The serialization interface has no methods or fields and serves only to identify the semantics of being serializable. [/QUOTE]

Member Avatar for JamesCherrill
0
94
Member Avatar for Akill10
Member Avatar for Akill10
0
285
Member Avatar for jonicse037

Like it says at the top of ther Java forum main page...[QUOTE]to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.[/QUOTE]

Member Avatar for pbl
0
50
Member Avatar for I<LateNupurGuha

Did you notice this at the top of the Java forum listing? [QUOTE]don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well[/QUOTE]

Member Avatar for JamesCherrill
0
106
Member Avatar for Iamthecheese

java.io.IOException; must be caught or declared to be thrown Means what it says. All the statements relating to the IO must be in a try block with a catch that catches IOException Unreachable while statement Means what it says. The previous statement is a return, so there's no way for …

Member Avatar for JamesCherrill
0
230
Member Avatar for LianaN

I see you are using ImageIcons in JLabels to show the images. Here's how I would think of this: I'd create a subclass of JLabel that has an Image and a zoom ratio as instance variables. I'd use getScaledInstance to scale the Image according to the zoom ratio in a …

Member Avatar for LianaN
0
216
Member Avatar for mangopearapples

It's not easy. To move the ball you just lock the main method into a one-line while loop. All that will do is burn CPU cycles. You need to start a javax.swing.Timer to trigger regularly (a few times a second)to update the position and re-draw the screen. s.RestoreScreen() s is …

Member Avatar for mangopearapples
0
468
Member Avatar for Akill10

I don't see why this is a problem! You fire the bullet. It has an initial position and velocity that depends on the position and velocity of the ship at that time. The bullet's position and veocity should have no connection with the ship once they are initialised - after …

Member Avatar for JamesCherrill
0
346
Member Avatar for masamune

You may have a problem because all these methods read the input file, so after the first method has read it all the subsequent methods will just see end-of-file. May be better to have a method that reads the file just once into an array then pass that array to …

Member Avatar for JamesCherrill
0
230
Member Avatar for ajst
Member Avatar for Random_Integer

To execute custom code of your own on JFrame closing use a WindowListener. [url]http://download.oracle.com/javase/tutorial/uiswing/events/windowlistener.html[/url]

Member Avatar for Random_Integer
0
122
Member Avatar for jwmollman

The usual form of that expression is Sum(n) = n(n+1)/2 but that's not a loop. How about recursion: [CODE]int sum(int n) { return (n==1)?1:n+sum(n-1); }[/CODE] Does that count as a loop?

Member Avatar for kikovi
0
185
Member Avatar for ticktock

The idea is that if your method may have errors it can't deal with it should throw some kind of Exception. There's nothing to stop you throwing one of the Exceptions that are defined in the Java API, but it's far more helpful to define a new Exception type of …

Member Avatar for ticktock
0
200
Member Avatar for NightFire91

Exactly what problems are you having in running this? All you need is a one-line main method. What did you try? ps 2147483647 is the largest valid value for an int.

Member Avatar for NightFire91
0
88

The End.