7,116 Posted Topics

Member Avatar for aarthi87
Re: java

Do you have any choice about doing this? Conmparing different images is horribly difficult (and slow) in any language. Is there any other project you can do?

Member Avatar for JamesCherrill
0
82
Member Avatar for jiraiya

Have a look at your jar using a standard zip file utility (whichever you prefer) and check the exact path and file names for the files you need. If you're using Windows, watch out for upper/lower case in the names - the Windows file system is not case sensitive, but …

Member Avatar for jiraiya
-1
70
Member Avatar for SashaC

Re all thise String arrays: Apart from the load method, they are used as temporary variables, so scope is OK. BUT they all seem to be redundant, eg String [] selection = interestRates; annualInterest = selection[1].getDouble(); why not just annualInterest = interestRates[1].getDouble();

Member Avatar for JamesCherrill
0
180
Member Avatar for nssltd

If you look back through this board you will find quite a number of people have been building Java apps to send receive and broadcast instant messages across TCP/IP or UDP sockets. (It looks like this must be a standard project on some programming courses.) Their posts contain lots of …

Member Avatar for nssltd
0
173
Member Avatar for jefferlyn92

Apart from violating the "we don't do people's homework for them" rule, the above code does not work as required, so it's doubly unhelpful. Remember: char is a numeric type.

Member Avatar for ANDIEniable
0
648
Member Avatar for khunmato

You can display a graphic in a JLabel using the setImageIcon method - v easy and works v well. Research layout managers to see how they allow you to lay out the labels in a window. a grid layout may be good for you.

Member Avatar for JamesCherrill
0
2K
Member Avatar for Guest51

You have a class called DVDCollection but each instance actually represents a single DVD. This sounds a suble difference but it's very inportant. When you say new DVDCollection =(...) you are NOT creating a new collection of DVDs, you are creating a single DVD. That's the right thing to do, …

Member Avatar for JamesCherrill
0
207
Member Avatar for RaniThomas

A class without a suitable public main(...) method can only be called from another class. If you want to run a class from the java or javaw command it must have the method.

Member Avatar for Taywin
0
158
Member Avatar for chinee

Looks like you create the window, increment the bar as fast as the CPU can go, then exit the app. You're lucky to see even a flash! And "there are errors" isn't enough info. Exactly what error message on exactly what line?

Member Avatar for NormR1
0
248
Member Avatar for Derrin

Check the API for the JTextArea append method. It takes exactly one parameter, a String. You are calling it with multiple arguments, just like the errors say. If you want to append some complex formatted text you must build this up in a String first, then append that String. (ps …

Member Avatar for JamesCherrill
0
177
Member Avatar for Agent Cosmic

Previous answer is 90% right, but, as defined in the Java language definition, the JVM has no problem deciding which variable to use. Declaring x as a parameter "masks" or "hides" the declaration of the instance variable x, so an unqualified use of x in that method is a use …

Member Avatar for JamesCherrill
0
101
Member Avatar for RaniThomas

The JVM has nothing to do with compiling a Java class. The compiler takes your source code (xxx.java) and converts it into a coded form (xxx.class) that contains a detailed low-level step-by-step set of instructions corresponding to your program. The JVM then takes that .class file and executes the instructions …

Member Avatar for RaniThomas
0
92
Member Avatar for yasin.mr

[url]http://download.oracle.com/docs/cd/E17409_01/javase/tutorial/uiswing/components/combobox.html#listeners[/url]

Member Avatar for JamesCherrill
0
99
Member Avatar for intes77

Anything the user types is a String You can then try to convert the String to integer (etc) by using API methods such as public Integer(String s) throws NumberFormatException which will give the the Integer if possible, and throw a NumberFormatException if it cannot be parsed as an Integer.

Member Avatar for JamesCherrill
0
171
Member Avatar for seanvitalaim
Member Avatar for JamesCherrill
0
221
Member Avatar for jemz

Have a look at the contains(...) method in the String class (ps: in case you are worried, CharSequence is just an Interface implemented by all Strings)

Member Avatar for jemz
0
90
Member Avatar for fsl4faisal

When you extend a class or interface, any members that you re-define in the subclass/interface override the definition in the superclass/interface. So there is no ambiguity. If you have an instance of B then the definition in B applies (if it is not defined in B, then it inherits the …

Member Avatar for JamesCherrill
-2
110
Member Avatar for daudiam

If I understand the question, then the answer is "yes", but why do you ask, and what do you want to infer from the answer?

Member Avatar for daudiam
0
4K
Member Avatar for gretty

I seee nothing wrong in a static method provided that it gets all its data from the parameters (or embedded constants). There are many examples of this in the Java API - which I would use as the definitive guide to "normal" practice. Re line 76: use the printf method …

Member Avatar for Cort3z
0
132
Member Avatar for makan007
Member Avatar for hermann87
0
70
Member Avatar for daudiam

Methods, both static and instance, are loaded into the VM when the class is loaded. Only one copy of each method is loaded and held in memory.

Member Avatar for JamesCherrill
0
138
Member Avatar for jammy4java

for i = 0 to (length of string+!)/2 print string with first and last i characters replaced with blanks. repeat loop with starting and ending values of i swapped.

Member Avatar for rkj2ban
0
1K
Member Avatar for daudiam

ob is a reference to an object of class A. It can also hold a reference to an object of any sub-class of A, because any such object is, by definition, a kind of A. new X() creates an object of class X and returns a reference to that object. …

Member Avatar for JamesCherrill
0
94
Member Avatar for aladar04

How much spare time do you think we have? Make the effort to read some of the stuff that's already available to you on the web, then come back here if you have specific problems.

Member Avatar for JamesCherrill
-1
72
Member Avatar for Alex_

You may find that this is a problem with keyboard focus - are you sure the focus is on your JLabel? Try clicking it once then pressing a key.

Member Avatar for Alex_
0
163
Member Avatar for dylgod

Divide by zero means exactly what it says. You have c/d and also %f so it seems that either d or f must be zero. Print out all the variables immediately before the line where the problem occurs and see which one(s) are zero. When you know which is zero, …

Member Avatar for Taywin
0
167
Member Avatar for Krefie

I would use a common method rather than duplicate 3/4 lines of code (assuming they are non-trivial). Main reason? Maintenance. What happens when you discover that that piece of code needs to be improved or fixed in some way? Now multiply this across a full-sized commercial project.

Member Avatar for Krefie
0
259
Member Avatar for Unbidden Ghost

It would be informative to do a quick scan of programming vacancies in the area that interests you and see what skills they are asking for.

Member Avatar for Stefano Mtangoo
0
346
Member Avatar for tajtosh

Do you mean that it should not have any visible windows? In that case, just don't create any. Any Java app will run in Windows and in Linux unless you go outside strict Java and access an OS-dependent library directly.

Member Avatar for sivasrinu
0
638
Member Avatar for pinsickle

"Global" data structures updated at random by multiple processes is generally a formula for disaster. Much better to create a proper class for data persistence with public methods that the GUI can call to submit data. Define the signatures of those public methods very carefully, then look at how best …

Member Avatar for JamesCherrill
0
128
Member Avatar for TheWhite

Did you look at using a styled document in a text pane? [url]http://java.sun.com/javase/7/docs/api/javax/swing/text/DefaultStyledDocument.html[/url]

Member Avatar for JamesCherrill
0
95
Member Avatar for jakx12

Java does support mp3 [url]http://java.sun.com/javase/technologies/desktop/media/jmf/mp3/download.html[/url] For info on how to get the individual samples and do a FFT see [url]http://jvalentino2.tripod.com/dft/index.html[/url] unbump.. Am I really the only person on this forum who knows how to use Google?

Member Avatar for jakx12
0
2K
Member Avatar for Stefano Mtangoo

Short version: It's testing individual pieces of a (large) system one at a time to get them working as specified before putting them all together to test the complete system. Building and testing a complete sytem is a horribly inefficient way of finding a bug in one small component.

Member Avatar for ~s.o.s~
0
90
Member Avatar for anjkris07

Just a small hint here: think about a Card class with instance variables for suit and rank (which ideally would be enums). A deck is then a simple array or Collection of Cards.

Member Avatar for anjkris07
0
210
Member Avatar for bhavna13

[QUOTE]its not working.[/QUOTE] Do [B][I]you [/I][/B]think this is enough info to allow someone to help you?

Member Avatar for bhavna13
0
193
Member Avatar for rojo821

Cut your program down to the smallest/simplest version that shows this problem and post your code here (don't forgte the CODE tags) - 1.6u20 definitely does display windows correctly with Win 7, so there's probably something wrong with your code.

Member Avatar for stultuske
0
186
Member Avatar for jonoj

Your enums are members of the Player class with default access, so you can't refer to them from just anywhere. Making them public will help, as will using their fully-qualified names (like line 12). ps: The members of the enums are locations and items, so adding "ID" to their names …

Member Avatar for JamesCherrill
0
157
Member Avatar for MrBlack

On which line? Or shall I guess? ... I see a line number with two digits ... the first looks like a one, the second is .... wait for it ... a nine?

Member Avatar for MrBlack
0
4K
Member Avatar for bymak87

What do the methods like x.Brand(); do? BMW@a62fc3 is what the public String toString() method produces when it's inherited from Object. Many Java API methods call toString() when they need a textual representation of an object (eg System.out.print(...)). It's normal practice to override toString() in any new class you define. …

Member Avatar for JamesCherrill
0
231
Member Avatar for daudiam

Yes, import does nothing that you can't do by always using the fully qualified names for all the classes you use. This saves a LOT of typing

Member Avatar for JamesCherrill
0
131
Member Avatar for adaku

The Date and Calendar classes will do the parsing and give you access to the value as a nunber of milliseconds since <some date/time that I can't remember now> in a long integer, which is exactly what you need for calculating intervals etc.

Member Avatar for JamesCherrill
0
87
Member Avatar for puppykillaz

You need to look again at the algorithm for bubble sorting - it needs two nested loops and you've only got one. Also arr[x+1] is going to fall off the end of the array with your current loop. ps: "I know the brackets are off a bit" - that's inexcusable. …

Member Avatar for JamesCherrill
0
3K
Member Avatar for runningkuma

Read up on Swing Threads - your wait is causing the whole of Swing to wait - hence no screen updates

Member Avatar for NormR1
0
124
Member Avatar for leiger

Java has a Preferences class that's ideal for what you need. It's as easy as [CODE]Preferences prefs = Preferences.userRoot().node("myEditor"); prefs.putBoolean("lineWrap", true); ... if (prefs.getBoolean("lineWrap", false)) ...[/CODE] UI should be a dialog, and keeping it modal makes coding, and using, it easier.

Member Avatar for leiger
0
201
Member Avatar for rmsagar

[QUOTE]Does the command line execution needs main() ? Is there a way to execute without the main() from the command prompt.[/QUOTE] Yes. No.

Member Avatar for JamesCherrill
0
217
Member Avatar for stevebush

If ExtendedMovie extends Movie then you can access the name via the inherited accessor methods of the Movie class

Member Avatar for JamesCherrill
0
106
Member Avatar for NPOT

You are using the length() method for a File object that is a directory. The [B]API reference[/B] says: [B]The return value is unspecified if this pathname denotes a directory. [/B] so that's why you get 0. You will have to sum the sizes of the individual files in the directory …

Member Avatar for masijade
0
131
Member Avatar for Raakesh399

You can use DeadSoul's code, but instead of the SQL query from line 8 onwards, remove the object from your array. I strongly recommend that you replace the array with an ArrayList which will greatly simplify your code for adding and removing records (use its add(...) and remove(...) methods) as …

Member Avatar for jwenting
0
92
Member Avatar for puppykillaz

Nobody is going to try to check this code until you indent it properly - it's just too hard to match up the {}. And please tell us what the exact error message is, this isn't a quiz. And class Items should be called Item - each instance represents exactlyy …

Member Avatar for puppykillaz
0
315
Member Avatar for chrisMed7

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

Member Avatar for JamesCherrill
0
100

The End.