7,116 Posted Topics

Member Avatar for Lensva

Possibly it's a lock problem. This may be completely wrong, but... BannerP has a wait loop that's synched on "this". You try to exit the loop with a notify in Banner, but that's enclosed in a synch on the same object, so the notify will never be executed as long …

Member Avatar for JamesCherrill
0
133
Member Avatar for llemes4011

What an interesting idea! I haven't tried this, but some questions need answering: Ability is abstract, so you can't instantiate it. The inner classes are not static, so they need an instance of Ability. ? Since each of the inner classes extend Ability, they each inherit the inner classes, so …

Member Avatar for llemes4011
0
115
Member Avatar for iamwa
Member Avatar for emint

masijade is exactly right. You are looping and waiting in the Swing event thread, which blocks all GUI activity (including repainting the progress bar) until your method finishes. You'll find lots of info on this here at Daniweb, and via Google (search for Java event dispatch thread)

Member Avatar for JamesCherrill
0
114
Member Avatar for beatonl

You declare the method as returning a value of type ClassB public Class B getComputerPart() { ( I assume the blank between Class and B is a typo) The value you actually return is an Integer return Integer.parseInt(conString); So either return an instance of ClassB, or change the method declaration …

Member Avatar for beatonl
0
183
Member Avatar for NewToThis

[QUOTE=NewToThis;943334]sure, I am getting the error on this line code: while([] counter <= 10); [/QUOTE] What are you trying to achieve with the [] ?

Member Avatar for cgeier
0
124
Member Avatar for MoZo1

Static initialisers are run "when the class is initialised", which is (some time) before any reference to it is used, so the behaviour you observed is required by the language definition, and should be consistent in its results across all JREs. You may find that the first class to be …

Member Avatar for JamesCherrill
0
129
Member Avatar for rje7

You may find the following useful - in summary: when threads of equal priority are scheduled the order is arbitrary (although round-robin scheduling gives them all a chance). Time slicing and multiple CPUs make this a lot less deterministic. In summary summary - you can't assume anything about the order …

Member Avatar for JamesCherrill
0
1K
Member Avatar for fareast87

Shouldn't be too hard, and you don't need JAI if you don't want to go there. You can use the Image class to get the image, then the PixelGrabber class to get an array of all the pixel values. Once you've got that you can shuffle it using simple array …

Member Avatar for fareast87
0
184
Member Avatar for andrewjm
Member Avatar for BestJewSinceJC
0
112
Member Avatar for cperepelitsa

I pasted your 3 lines of code into a main(...) method in Eclipse. It required me to remove the "public modifiers, then compiled OK. Also runs without throwing any exceptions. Java 1.6.0.14 Looks like something in the context where your code is placed. "Public" is wrong in a method, "System.setOut" …

Member Avatar for cperepelitsa
0
360
Member Avatar for lightner

Use a sort(...) method from the Arrays class. You want the one that allows you to specify a Comparator - that's a little interface where you specify the exact comparison criteria to use in the sort. [url]http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html#sort%28T[/url][],%20java.util.Comparator%29

Member Avatar for Godstryke
0
140
Member Avatar for enyeahgo

Java is no harder than any other language of comparable power. What really affects understandability is how you code it; if all the class and member names are really descriptive and the comments are helpful, then the code will be a lot clearer.

Member Avatar for JamesCherrill
0
137
Member Avatar for KimJack

Scanner line = new Scanner(line); This looks wrong. There is no constructor for Scanner that takes a Scanner as a parameter.

Member Avatar for sneaker
0
3K
Member Avatar for solahere

You could try the clone() method that all Java objects have. BufferedImage img2 = img.clone(); This isn't always implemented for all classes, but if that's the case you'll get a CloneNotSupportedException thrown immediately, so at least you'll know!

Member Avatar for JamesCherrill
0
189
Member Avatar for gitech
Member Avatar for BestJewSinceJC

Sorry adatapost, but I have the jmf mp3 plugin installed and working on my Windows system. [url]http://java.sun.com/javase/technologies/desktop/media/jmf/mp3/download.html[/url] Jmf should be capable of doing all the stuff specified in the OP's first post, but I have found it to be erratic and unreliable. I have had really good solid results from …

Member Avatar for BestJewSinceJC
0
496
Member Avatar for Web_Sailor

This depends on what kind of Objects the Tree is composed of. If they're Strings this isn't too hard, but if they are some complex class that doesn't have a simple string representation... TreePath is Serializable (provided its constituent Objects are Serlializable), so you just want to do I/O on …

Member Avatar for JamesCherrill
0
95
Member Avatar for MonicaClare

I guess you wanted to name the class midquiz 2 You can't have a blank in a class name. ps By convention, class names begin with a capital letter

Member Avatar for puneet88
0
188
Member Avatar for buchanan23

You'll need to pass the item to delete as a parameter. Loop thru the array until you hit that item, then continue thru the rest of the array moving each item down by 1 position. But, as stephen84 says, there are classes in theAPI that already do all that stuff, …

Member Avatar for buchanan23
0
113
Member Avatar for beshoyatef

Your paint method needs to be in the GUI class MyMouse, not in the listener class MyMouseAdapter. It's the GUI that gets painted, not the listener.

Member Avatar for JamesCherrill
0
128
Member Avatar for ezkonekgal

[I]treeInsert(BinaryTree t, int newItem)[/I] is a method that requires two parameters [I]treeInsert(arrNum[i]);[/I] is a method call that has only one parameter. Error! Plus: this doesn't do anything [CODE]if ( t.root == 0 ) { // The tree is empty. Set root to point to a new node containing // the …

Member Avatar for JamesCherrill
0
226
Member Avatar for jooa
Member Avatar for NewToThis
Re: OOP

You should at least try to compile this coded and fix any compile errors.

Member Avatar for JamesCherrill
0
76
Member Avatar for auhuman
Member Avatar for smoore

Have a look at Java Object persistence.With a few tiny changes you can write your entire colleaction of "Storage" objects to a file (using ObjectOutputStream's writeObject method) in one simple call, and read it all back in just as easily. [url]http://www.javaworld.com/javaworld/jw-05-1997/jw-05-persistence.html?page=3[/url] Why re-invent the wheel?

Member Avatar for JamesCherrill
0
124
Member Avatar for Dragonfyre

your sort needs to return the whole sorted array, not just one element. (Remember the problem with the constructor earlier?)

Member Avatar for Dragonfyre
0
118
Member Avatar for mustafaneguib

When you say "crashes", what exactly happens - do you get an Exception thrown, does it just stop responding, does it disappear, does NetBeans stop responding or disappear, (etc)? Does it crash when you press the exit" button? If it's really an insufficient memory problem you should see a different …

Member Avatar for mustafaneguib
0
166
Member Avatar for loozax

What help do you need? If it's not working properly, tell us what's wrong with the output. If it gives an error message, tell us what it is.

Member Avatar for JamesCherrill
0
113
Member Avatar for yas218
Member Avatar for BestJewSinceJC

getResource searches (unless you are doing clever stuff with class loaders) your classpath, so I'd try putting the data file alongside the class file (or specify its location as a path starting from the folder where the class file is) (modified as necessary if you have specified a package name).

Member Avatar for ~s.o.s~
0
134
Member Avatar for KirkPatrick

com.csvreader.CsvWriter writer = new ... seems to be inside your innermost loop, so you re-open (and thus overwrite) the file contents every time you go thru the loop. I think you should open the stream just once, at the beginning.

Member Avatar for BestJewSinceJC
0
718
Member Avatar for Lensva

Are you comparing on the file size? If so, you convert it to String, and do a String compareTo so, for example "1000000"sorts lower than "2". ps Any special reason why you use a 2D array? Why not just keep the array of Files and use File's accessor methods when …

Member Avatar for Lensva
0
543
Member Avatar for buchanan23

TestBooks myFrame = new TestBooks(bookArray[numBooks]); So if numBooks is (say) 2, you populate elements [0] and [1] in the array, but you pass element [2] to the GUI

Member Avatar for buchanan23
0
174
Member Avatar for n3philim

board[row][col]=temp[row][col]; shouldn't this be in a row/col loop? and, FYI... if (expr == true) is just long way to say if (expr) and if (expr == false) is just long way to say if (!expr)

Member Avatar for n3philim
0
116
Member Avatar for mangalatth
Member Avatar for MoZo1
0
73
Member Avatar for anthutton

1. Is it exactly a NumberFormatException that still displays, or something similar? 2. When the Exception displays, is the line number within the try clause that you think it should be?

Member Avatar for anthutton
0
155
Member Avatar for bringoutthejams

Can't see any obvious error - what [I][B]exactly [/B][/I]goes wrong when you run it?

Member Avatar for JamesCherrill
0
126
Member Avatar for sridarravi

Maybe set a FileFilter that only accepts the file name you want. (ps Why do yiou want to use a filechooser and not allow the user to specify the file name???)

Member Avatar for JamesCherrill
0
102
Member Avatar for kakakon

As far as I can see you use a highly tortuous loop to inspect each value in the hashmap then, if it is null, you set the variable pNode (whatever that may be!) to null. It seems equivalent to: [code] for (TreeNode t : pHash.values()) { if (t == null) …

Member Avatar for JamesCherrill
0
2K
Member Avatar for akulkarni

Maybe I missed it, but there's no code to display the contents, just to read it and display any errors. edit: parallel post with previous - I was referring to code in post 4.

Member Avatar for akulkarni
0
264
Member Avatar for Demicks
Member Avatar for Web_Sailor

Don't know why it fails, but you catch IOException and just return null - so if there is an IO problem you will get no error messages or any other clues as to what happened. Put a e.printStackTrace(); in the catch and see if there's a problem there.

Member Avatar for JamesCherrill
0
148
Member Avatar for nittynotty

If you have a class X in a package y, the JRE will look for X.class in a directory called y. ie the class files must be in a directory structure that corresponds to your package structure. So try creating a sub-dir with the same name as the package, put …

Member Avatar for nittynotty
0
102
Member Avatar for purijatin

private static variable to hold the instance. public static method getInstance() that creates an instance if necessary, and returns the instance. Should be synchronized if it's a multi-threaded app. private constructor, so you can't call the constructor from outside. This is called the "singleton" pattern, you'll find lots of info …

Member Avatar for JamesCherrill
0
2K
Member Avatar for punnakl

JavaMail gives you a full email client in Java that you could use, or the Desktop class lets you control your usual email client to do the job. Either way you can use a Java prog to query the database at regular intervals and generate/send the email using either interface. …

Member Avatar for GökhanBarış
0
105
Member Avatar for Web_Sailor

Don't understand why you need to write something new. There are loads of excellent version control systems available, many free.

Member Avatar for JamesCherrill
0
89
Member Avatar for masterjiraya

At line 15, instead of converting the input to int, just leave it as a String. In lines 17, 26 etc just test if the String is equal to "M" or "m" etc. ps: You can't compare Strings with ==. You need the equals("M") method, or, even better, equalsIgnoreCase("M") which …

Member Avatar for dharmajava
0
307
Member Avatar for JohnPhilipps
Member Avatar for JohnPhilipps
0
545
Member Avatar for llemes4011

Min bitsizes: 0-5 : 4 bits 0.00 - 30.00 : 12 bits 0-100 : 7 bits so 20 isn't enough, theoretical min is 35 bits Sensible compromise may be to store the int values in byte variables, and the floats as short variables (held in units of 1/100 - eg …

Member Avatar for llemes4011
0
481

The End.