7,116 Posted Topics

Member Avatar for loveu

The person who created the jar had the choice of what files (in addition to the class files) he included. Mostly people don't include the source, but some do. A jar file is really just a .zip file, so use any zip program to see what's in it. Although you …

Member Avatar for JamesCherrill
0
91
Member Avatar for cretaros

You call dispose() without an object, so that's equivalent to this.dispose(); You didn't show enough code for us to see what kind of Object "this" is, but maybe it's something that doesn't have a dispose() method?

Member Avatar for JamesCherrill
0
107
Member Avatar for gheorghe gardu

First sort out the references to the ArrayList containing Strings - it doesn't - it contains Students. Then, this is the plan: Read each line from the file. Split each line into its individual fields. Check which fields are N/A so you know what kind of Person this is. Create …

Member Avatar for JamesCherrill
0
104
Member Avatar for Ray007

That's a really detailed spec. Just start at the beginning and do exactly what it says.

Member Avatar for Ray007
0
110
Member Avatar for kezkez

Line 101 you compare the names with == That tests for being the same object. To test if two different string objects contain the same text, use string1.equals(string2)

Member Avatar for vaibhav1983
0
1K
Member Avatar for hany-h

Here's what I think your code should be doing: You have an array shapes[], and an int shapeCount that holds the number of shapes you currently have stored in shapes[]. OK. To ADD a shape in the mouse drag handler, you create a shape of the appropriate kind, and add …

Member Avatar for NormR1
0
279
Member Avatar for bops

For keyTyped events use getKeyChar(), not getKeyCode() (For KEY_TYPED events, the keyCode is VK_UNDEFINED.)

Member Avatar for bops
0
987
Member Avatar for alleybye

The Character class has methods for testing isLetter etc. You'll find the doc in the usual place.

Member Avatar for stultuske
0
95
Member Avatar for glenak

"The Java EE platform is built on top of the Java SE platform. The Java EE platform provides an API and runtime environment for developing and running large-scale, multi-tiered, scalable, reliable, and secure network applications." EE is used for developing large corporate-type apps in environments with big web servers and …

Member Avatar for Dean_Grobler
0
150
Member Avatar for ankilosado

Here's a strategy that may work for you - it's kinda like a recursive strategy, except that the levels are pre-defined. Pseudo code fragments follow: [CODE]new Document(Scanner input) { create empty ArrayList of Pages while (not input.EOF) add new Page(input) to ArrayList } new Page(Scanner input) { create empty ArrayList …

Member Avatar for ankilosado
0
480
Member Avatar for blknmld69

[QUOTE]class GradeCalculator3 is public, should be declared in a file named GradeCalculator3.java[/QUOTE] What exactly about that do you not understand?

Member Avatar for blknmld69
0
407
Member Avatar for LianaN

Have a look at Apache "Tika" [url]http://tika.apache.org/[/url] It may be a bit over the top for what you need now, but it's probably the comprehensive file metadata utility you will find in Java.

Member Avatar for JamesCherrill
0
95
Member Avatar for daudiam
Member Avatar for daudiam
0
227
Member Avatar for shruti1210

It is valid code. Class B will inherit v and String sayHello(), but nothing in the code makes use of that.

Member Avatar for JamesCherrill
0
80
Member Avatar for Simplelyn
Member Avatar for boiishuvo
Member Avatar for gunjannigam

Just for interest, why do you want to do that? The implementation automatically uses a separator that is appropriate for the system upon which it's running. [QUOTE]The conversion of a pathname string to or from an abstract pathname is inherently system-dependent. When an abstract pathname is converted into a pathname …

Member Avatar for JamesCherrill
0
185
Member Avatar for NewOrder

Hi NewOrder. You seem very close to losing the last person who is really trying to help - being rude to Norm is very short-sighted. Consider a few points from your last post: [QUOTE]i need someone to look at the syntax. cause it is causing the problem.[/QUOTE] No it isn't. …

Member Avatar for JamesCherrill
0
163
Member Avatar for haranaboy

Given a Person object you can get its values by using its accessor methods getName() and getTime() - although the second still needs to be written. You will also probably find the for/each loop format easier to work with: eg [CODE]int time = 0; for (Person p : q) { …

Member Avatar for JamesCherrill
0
89
Member Avatar for vinay1424

You have defined LessNoise inside the class Noise, so you need to refer to it via the Noise class. I guess this is an error in your bracketing, if so, just move the definition of LessNoise outside the Noise class and that should be OK. Indenting your code properly will …

Member Avatar for JamesCherrill
0
153
Member Avatar for kennski23

I guess you missed this at the top of the main forum page? [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 peter_budo
0
328
Member Avatar for lse123
Member Avatar for pnelsonsr

Package names are interpreted starting from all the places in the classpath. Eg classpath begins with . (current dir), package is com.xxx.yyy - java looks for a dir com/xxx/yyy in the current dir. If it doesn't find that it does the same thing starting at the next location in the …

Member Avatar for JamesCherrill
0
104
Member Avatar for javadumbass

Start with some kind of frame (eg JFrame), add a MouseListener, try something simple (eg draw a small rectangle wherever the mouse was clicked - you will need to override paintComponent(...) ) and work up from there. As you go you will (a) learn a lot and (b) discover exactly …

Member Avatar for javadumbass
0
1K
Member Avatar for NewOrder

Lines 14 and 16 guarantee that the deltas will both be >= 0, so if(deltaX<0 && deltaY<0) will always be false

Member Avatar for NewOrder
0
107
Member Avatar for Premsathishbe

Obviously your Google is broken (because nobody would post a question like this without first doing a little research of their own), so I searched for you and found this Wikipedia article as the first hit. [url]http://en.wikipedia.org/wiki/Plain_Old_Java_Object[/url]

Member Avatar for NormR1
0
84
Member Avatar for TahoeSands

I used to use that approach, but JDK 1.6u10 (or thereabouts) has REAL transparent windows. It's buries in awtutilities for now, will be fully exposed in Java 1.7 Here's a demo I wrote: [CODE]import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Shape; import java.awt.Toolkit; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import …

Member Avatar for TahoeSands
0
170
Member Avatar for robertmacedonia

Unless there are privacy issues, maybe its a good idea to keep all the data instead of a summary, ie for each vote cast add a record to the list showing who voted/when voted/what voted for. That way each record is unique and never updated. Then derive the summary statistics …

Member Avatar for robertmacedonia
0
154
Member Avatar for NewOrder

[CODE]for (a = 0; a <9; a++) { for (b = 0; b < 9; b++){[/CODE] Am I the only one who plays chess on an 8x8 board?

Member Avatar for NewOrder
0
265
Member Avatar for LianaN
Member Avatar for TahoeSands

You could solve this in a generic sort of way by also having a "mask" image - same size as the card images, with each pixel either black or white depending on whether or not you want to compare the corresponding pixels in the two card images. That way, if …

Member Avatar for TahoeSands
0
90
Member Avatar for TahoeSands

[URL="http://sourceforge.net/projects/jwinapi/"]This[/URL] should do it. includes a sample prog that does exactly that.

Member Avatar for TahoeSands
0
540
Member Avatar for titan5

SimpleDateFormat. (It's in the API reference) Create a format to match your data, then use the parse(...)method to convert to a Date

Member Avatar for titan5
0
147
Member Avatar for extemer

The code you show does not produce the output you show. Show us matching code and output. Post code, properly indented, in code tags.

Member Avatar for NormR1
0
106
Member Avatar for first7movie

You may find that the size isn't set until the button is added to a container (JFrame or whatever) and that container is layed out (eg via pack()). The size definitely should work any time the button is visible on the screen. weiphos2012 - we try to be helpful and …

Member Avatar for JamesCherrill
0
36
Member Avatar for NewOrder
Member Avatar for robertmacedonia

Yes, open an output file and it overwrites the previous. Try opening the fileoutput stream in append mode, eg new FileOutputStream(fileName, true)

Member Avatar for robertmacedonia
0
2K
Member Avatar for brandongood

If you post with code=java tags we may be able to see which line is line 180 where the problem happens (or maybe you can just tell us which line it is). Anyway, on the line you have either an uninitialised variable or a variable that has been set to …

Member Avatar for Ezzaral
0
120
Member Avatar for daudiam

Yes, it's a cast/box too many in one step. [CODE]Float a = 3f; Float a = (float) 3; Float a = new Float(3);[/CODE] all work ps Khalid Mogul may be a great guy, but I would always prefer to find an authoritative source in the official Sum/Oracle documentation

Member Avatar for daudiam
0
129
Member Avatar for LianaN
Member Avatar for extemer

This code (assuming the class end brace was there somewhere later, and ignoring the non-issue of putting braces round a single-statement if) runs perfectly for me. Maybe the problem's somewhere else in the rest of the code or the system config, not in this code. Do other programs run ok?

Member Avatar for jon.kiparsky
0
130
Member Avatar for NewOrder

[QUOTE]i interlocked my whole pieces[][] array into conditions and methods, now i cant get them out and manipulate them[/QUOTE] Yes! Seeing that is the first step to fixing it. Time to step back and do a little design before doing any more coding. Get that array out, clean up its …

Member Avatar for NormR1
0
232
Member Avatar for daudiam

Interesting question! My take is: new B[]; populates the array with two <references to type B>, so the second statement fails because a new A is not a B. ie: A is a reference to an array that can hold references to type A, but a[0] and A[1] (perfectly validly) …

Member Avatar for daudiam
0
57
Member Avatar for robertmacedonia

If you get all your results into some object (eg an ArrayList<Result>) then it's very easy to write/read the whole object to/from a file in a single staement using ObjectOutputStream/ObjectInputStream. That's probably the easiest way if you don't need to do record-based I/O

Member Avatar for JamesCherrill
0
120
Member Avatar for TahoeSands

I've followed this with some bemusement. You say "This means I need to impose some artificial constraints on the range of values we allow.". So what exactly is wrong with this: [CODE]do { sdX = (int)Math.round(r.nextGaussian() * xCenter + xCenter); } while (sdX < 0 || sdX >=w);[/CODE]

Member Avatar for Ezzaral
0
125
Member Avatar for TahoeSands

Since Java 1.6.(something) there has been an implementation of transparent windows, which lets you display window content (eg text or shapes such as elipses) without the window itself being visible. It's going to be a full feature in Java 1.7, but right now you have to know where to look …

Member Avatar for TahoeSands
0
139
Member Avatar for c++noobie

Casting to a subclass of the objects actual type doesn't work. The subclass may contain variables and constructor code that the superclass does not have, so simply pretending its a subclass instance isn't going to work. You can create a kind of copy constructor like this: [CODE] public DateTime(Date d) …

Member Avatar for JamesCherrill
0
85
Member Avatar for Premsathishbe

OO - yes; pure OO - no. Java is mostly OO, but incorporates non-OO "primitive" types such as int, boolean etc which are not Objects. For "pure" OO you need to go to something like Smalltalk, where everything is an object.

Member Avatar for Premsathishbe
-1
70
Member Avatar for churva_churva

You need to loop through the array of valid names testing each one against the entered name. If you find a match you can stop searching. If you reach the end of the loop and you haven't found a match then the name is invalid. Compare Strings by using the …

Member Avatar for Akill10
0
165
Member Avatar for churva_churva

Look closely at the difference between line 48 (wrong) and line 41 (better). The problem's near the beginning of the line.

Member Avatar for peter_budo
0
221

The End.