7,116 Posted Topics

Member Avatar for vuchko

Maybe its smart enough to realise that repainting an uninitialised unpopulated invisible panel is unnecessary? ps: What's the point of answer = new JPanel... don't you want an instance of PanelAnswer?

Member Avatar for vuchko
0
694
Member Avatar for akulkarni

[QUOTE=tux4life;914903]Well, I know an algorithm: ... :)[/QUOTE] Is there a version that scales for arbitrary length, or is it just a special case for length = 3?

Member Avatar for JamesCherrill
0
114
Member Avatar for lakshay

010 (decimal) is 1010 binary, 4 is 0100, or them together you get 1110 which is 14. Now I'm puzzled as well. Perhaps I need a cup of coffee.

Member Avatar for llemes4011
0
111
Member Avatar for George2

I guess your Google must be broken, because I found tons of info on this by searching on [I]java obfuscator[/I]

Member Avatar for masijade
0
145
Member Avatar for llemes4011

Here's a really easy solution (although it's probably not what are hoping for!) [CODE]public void rotateCCW() { rotateCW(); rotateCW(); rotateCW(); }[/CODE] :-)

Member Avatar for llemes4011
0
302
Member Avatar for akulkarni

In this case you are relying on the JVM to catch the exception when your main(..) method throws it, presumably because the JVM's default processing (print out the details of the Exception to System.err and terminate the program) is good enough. In general you would put the IO method calls …

Member Avatar for akulkarni
0
110
Member Avatar for jooa

I don't know if there is a special reason to use a 2d array here, but, if not, you would probably be a lot better off with a simpler approach. For example - create a simple ArrayList of Points - you can add to it, retrieve from it, loop thru …

Member Avatar for jooa
0
4K
Member Avatar for Talguy
Member Avatar for Talguy
0
174
Member Avatar for ragnarok511
Member Avatar for VernonDozier

Serialization stores everything about your class instances, so if you don't want all that you have the override the appropriate methods. The portability issue is that Sun warn you that the details of how these things are serialised may change in future releases, so you cannot assume that an object …

Member Avatar for VernonDozier
0
1K
Member Avatar for davidnorth

Don't know if you are looking at this for itself, or as an instance of something more general, but JLabel setText(...), unlike most Swing code, is threadsafe, so you don't need the worker thread in this specific example. You do, however, have exactly the right code structure for the general …

Member Avatar for davidnorth
0
565
Member Avatar for anusha88
Member Avatar for kvprajapati
0
318
Member Avatar for NewToThis

Because x is assigned from an input.nextInt(), I assume it's declared as int, so: %f requires a floating point value, but 2*x is an integer value. Change the format to %d when you print the diameter, OR change the calculation to 2.0*x so the result is floating point.

Member Avatar for NewToThis
0
102
Member Avatar for JChakra
Member Avatar for JChakra
0
201
Member Avatar for vamsi.ac

If all you have is .class files (compiled code) this is going to well beyond the capabilities of a Java beginner. See if you can find .java files (source code).

Member Avatar for JamesCherrill
0
89
Member Avatar for Web_Sailor

Best not to do stuff like writing files on the Swing event thread because it interferes with the UI. When you get this working, wrap the code in a SwingWorker.

Member Avatar for JamesCherrill
0
104
Member Avatar for akulkarni

n[] is new array, has nothing in it. So n[i] has nothing in it for all values of i, so n[i].someFunction tries to call someFunction on a null value -> Exception. Maybe initialise n[i] to new Student1() before using it?

Member Avatar for JamesCherrill
0
232
Member Avatar for GDICommander

You can use the File class wherever the "real" files are, but as soon as you have a File object for a directory that provides the list of files you can use your existing sockets to write/read the object via the socket stream. Once you have a copy of it …

Member Avatar for ~s.o.s~
0
209
Member Avatar for purijatin

The reference variable ob is a ref to type A, which means it can refer to any object of type A or of any sub-type of A. However, because it is declared as A it can only be used to access members that are defined in A, and there is …

Member Avatar for purijatin
0
117
Member Avatar for kssi89

Your ternary expr is almost there, just needs (1) brackets to get the order of evaluation right and (2) it has to be used in an assignment kind of way for (j = y1 ; j != y2; j = j + ((y1 < y2) ? 1 : -1))

Member Avatar for JamesCherrill
0
141
Member Avatar for einhachi

[QUOTE=BestJewSinceJC;904616]...And I think it's safe to ignore the warning about Serializable unless your class implements Serializable, which it does not.[/QUOTE] Your class inherits from Frame or JFrame, both of which are declared as "implements Serializable", so that's why your class is seen by the compiler as implementing serializable as well. …

Member Avatar for painless
0
184
Member Avatar for sharao

URLs are case-sensitive, so do you want to change [url]http://localhost/PROJECT[/url] into [url]http://localhost/project[/url] ? If so, the toLowerCase method in the String class will do it: "http://localhost/PROJECT".toLowerCase();

Member Avatar for sharao
0
119
Member Avatar for nam5a

The Exception tells you the method & line number where it was thrown. Perhaps you could share that info with us?

Member Avatar for nam5a
0
149
Member Avatar for painless

Sometimes you need an instance of a class - eg as a Listener for a Swing Event,, or a Runnable for a Thread - and these are most conveniently and compactly created locally as inner classes, often anonymous inner classes.

Member Avatar for BestJewSinceJC
0
100
Member Avatar for karamjeet2004

Satisfied or not, he's right. Everything except variable declarations have to be inside a method. Post your latest code, with code=java tags.

Member Avatar for karamjeet2004
0
186
Member Avatar for akulkarni

Not sure why this is "solved". Code will not compile, and does not illustrate the correct use of an interface even if it did.

Member Avatar for JamesCherrill
0
91
Member Avatar for painless

It will look for your file in the default location - probably C:\Users\vivek, it's not smart enough to guess that you want the Pictures sub-dir. The only way to be sure is to specify the full absolute path when referring to a file

Member Avatar for painless
0
133
Member Avatar for Nitz

You need to print the vertical axis and the rectangle at the same time - you can't go back up the page. So as you do the vertical axis, when you get to the line where the rectangle should start, start printing asterisks as well. You can get the horizontal …

Member Avatar for ~s.o.s~
0
217
Member Avatar for cyrogathoni

There's loads of stuff on the web. Sun's own Java tutorials are very good and go all the way from beginner to expert, but are not exactly easy. [url]http://java.sun.com/docs/books/tutorial/getStarted/index.html4[/url]

Member Avatar for kvprajapati
0
43
Member Avatar for r0n

How are the tw files to be combined? One after the other, alternating lines from each file, append each line from one file to the end of each line from the other, or what?

Member Avatar for r0n
0
4K
Member Avatar for JohnPhilipps
Member Avatar for kuay
Member Avatar for JamesCherrill
0
112
Member Avatar for MasterGoGo
Member Avatar for JamesCherrill
0
491
Member Avatar for Acegikmo
Member Avatar for cutedipti

OP: I have no idea what you mean by "final" - it doesn't seem to mean what "final" means in Java! As for the boundary class: none of the above. Your objects are all "business" objects, none of these looks like a user interface class to me. I'd expect to …

Member Avatar for JamesCherrill
0
112
Member Avatar for MxDev

Your code is executing on the Swing (event dispatch) thread, so all screen updates are held up until your method returns. That's why there's no screen update when you sleep. It's only after that method completes that the screen is updated. Solution is to use a Swing Timer [url]http://www.j2ee.me/docs/books/tutorial/uiswing/misc/timer.html[/url] In …

Member Avatar for MxDev
0
123
Member Avatar for KirkPatrick

Create a FileOutputStream in append mode, then create your csvwriter using that output stream

Member Avatar for KirkPatrick
0
3K
Member Avatar for gitech

In the "other" jar, provide a public class with public methods to access the data. As long as that jar is in the classpath you will be able to access the class and call the public methods from your first jar and thus access the data in a well-managed way.

Member Avatar for gitech
0
151
Member Avatar for multicoder

How about some diagnosis, as opposed to scratching head & trying things at random. The subtle << in the error message implies that no exception was thrown (except by you), and that the (htmlFile.exists() && htmlFile.canRead()) is false. So, which is it? Display each of these separately so you know …

Member Avatar for multicoder
0
435
Member Avatar for johndb
Member Avatar for johndb
0
4K
Member Avatar for KirkPatrick

Can't see the bolding. But a guess: are you trying to read as many lines from the file as there are in the bean?

Member Avatar for KirkPatrick
0
132
Member Avatar for emporio

It will call the function (method) in C. You can cast to type B to call B's implementation.

Member Avatar for JamesCherrill
0
93
Member Avatar for joshmo

I've seen a web site that suggested dividing the image into a number of blocks (eg 4 x 6) and averaging the pixels in each block (thus giving, in tis case 24 numbers) that characterise the picture. More and smaller bocks = more selective. Maybe you can find that via …

Member Avatar for Ezzaral
0
232
Member Avatar for multicoder

Error: Failed to load parserConfigImpl [au.com.allhomes.listing.harvester.parse. Maybe the au. is significant?

Member Avatar for multicoder
0
1K
Member Avatar for ahroi84

Sorry, can't understand your code presented like that. If you re-post with code=java tags and proper indentation I'll try to help.

Member Avatar for ahroi84
0
180
Member Avatar for kuay

Why not? (Post code indented and with code=java tags and explain why the output is wrong - ie what did you expect?)

Member Avatar for yilmazhuseyin
0
110
Member Avatar for solris

You deliberately ignore any IOException, which is dumb, really dumb. Your file isn't getting written, and you chose not to display any error messages that Java may have about it? Get rid of the throws clause. Put your code in a try/catch block, and print out any exceptions that get …

Member Avatar for javaAddict
0
100
Member Avatar for henks

In what way doesn't it work, exactly? Maybe the panel doesn't have focus, so its not getting the key events - try adding the same listener to the jframe in Begh()

Member Avatar for henks
0
113
Member Avatar for Lotus_2011
Member Avatar for smoore

Like Vernon says, but also you can make a "bogus" value totally clear at zero overhead by declaring it as static final: public static final int BOGUS = -999999; then: var = BOGUS; if (var == BOGUS) { ... etc

Member Avatar for yilmazhuseyin
0
267

The End.