Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It is a valid system property that returns the appropriate system-specific line termination character. You still have to write it yourself though. And why can you not use BufferedWriter?

(Also, see the forum rules regarding "text-speak" and proper English)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Nope. We are not here to write code for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The switch should work just fine. Make sure that your game loop is checking it appropriately and that you haven't defined the RUNNING and PAUSED constants to be the same value (by copy-paste oversight or whatever).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For more information, also see the "Read Me" post at the top of the forum on getting started with Java:http://www.daniweb.com/forums/thread99132.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You cannot declare methods inside other methods like that. Move it out to the class level.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you use BufferedWriter, which can be wrapped around a FileWriter, you can use newLine(). If you need to write the OS-specific line separator yourself, use System.getProperty("line.separator").

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

baby on board

Does it feature an infant nailed/stapled/glued to a 2x6? Because that is always what I thought of when I saw those little signs...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>C# OTOH looks nice.
C# is closer to what I expected of Java.

That same sentiment was expressed by one of the designers of C# in some article I read. Basically saying the goal was to incorporate many things that Java got right and address some areas they felt were lacking. I've only had minimal exposure to it, since my job is 100% Java, but it seems like a decent language to me. I wouldn't have any qualms working in it if we had a need to.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you want to randomly present lines from the file, I would read all of the lines into an ArrayList first and then get() them with a random int of the range 0 to size()-1.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

readLine() just sequentially reads lines from the file. If you only care about certain lines, maintain a counter as the lines are read and print/store/whatever lines you need based upon that counter.

int lineNumber=0;
String line=null;
while ( (line = br.readLine()) != null){
  lineNumber++;
  if ( <some expression on lineNumber> ){
    // do something
  }
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The feeling is mutual Narue, we hate C++ :)

C# OTOH looks nice.

++

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use a BufferedReader with the readLine() method. You can either skip lines as you read them, or place each line into an ArrayList, and process them as needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you are asking someone to teach you how to do your project, which amounts to the exact same thing. Make some effort.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I believe you meant to say that it is physically addictive to the brain. The mind is not a physical structure, and therefore cannot become physically addicted to anything.

For practical purposes, yes, not getting into the whole brain/mind philosophical pondering.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I, for one, believe that smoking is not physically addicting. I think it is only a matter of the mind.

Right and wrong at the same time. It is physically addictive to the mind, altering the production and response to several neurotransmitters.
http://en.wikipedia.org/wiki/Nicotine#Dependence
http://www.nida.nih.gov/researchreports/nicotine/nicotine2.html#addictive
http://en.wikipedia.org/wiki/Tobacco_smoking#Somatic_and_psychological_effects

Withdrawal symptoms are relatively mild - mainly irritability, restlessness, anxiety, and difficulty concentrating - but they are very real and persistent for several days and up to weeks. Not surprising at all given that the brain is dealing with a substantial alteration in its normal (normal for a smoker that is) chemical balance.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

On a side note, never throw exceptions from main() - there is nothing above main in the call stack to handle them. Place try-catch blocks around the code inside main as needed and at the very least print a stack trace in the catch block.

public static void main(String args[]) {
        try {
            BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("Welcome. How many names do you wish to enter?");
            String input = stdin.readLine();
            int nameCount = Integer.parseInt(input);
            String[] names = new String[nameCount];
            for(int i = 0; i<nameCount; i++) {
                System.out.print("Enter name: ");

                //NEED HELP HERE
                names[i] = stdin.readLine();
            }
        } catch(IOException ioe) {
            ioe.printStackTrace();
        }
    }
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, for your purposes a simple array of String would be all that was needed.

import java.io.*; 
public class Problem2
{


  private static BufferedReader stdin =  new BufferedReader( new InputStreamReader( System.in ) );

  public static void main(String[] arguments) throws IOException
  {
    System.out.println("Welcome. How many names do you wish to enter?");
    String input = stdin.readLine();
    int nameCount = Integer.parseInt(input);
[B]    String[] names = new String[nameCount];[/B]
    for(int i = 0; i < nameCount; i++)
      {
	System.out.print("Enter name: ");

	//NEED HELP HERE
        [B]names[i] = stdin.readLine();[/B]
      }
  
  }
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hehe, yes I have botched initial calculations on such things before too and it can cause a bit of frustration if you don't immediately realize it. Even more so in the early stages of working with OpenGL when you aren't very familiar with any of what you are coding. It does start to snap into place if you keep after it though :)

(Watch things like polygon winding too, as that can bite you in some unexpected ways if you are not attentive to it)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What Would Cheezits Do?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You also need to address the other invalid declarations that VernonDozier mentioned.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Still will not compile. What is the type of the "yy" parameter?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

VernonDozier, that post was from 2004. Lordonin just drug it out of the dust bin to beg for code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For one thing, this

public class Point extends Pair
{
    super(xx,yy);

is not a valid constructor. Re-examine your class notes on basic class structure.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, your question is not clear at all. Please try to rephrase it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your best bet is to construct a GeneralPath with the points from the mouse listener and use the Graphics2D.draw(Shape) method to render it. You can append to the GeneralPath as new points are added, so you don't have to even maintain a point collection at all.

Examples of this can be found here: http://java.sun.com/docs/books/tutorial/2d/geometry/arbitrary.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Glad you found the issue.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Checking for the comma first could affect more than just where to split the string. For example "Joe Smith" indicates first name and then last name, whereas with the comma the last name appears first "Smith, Joe". So you have two different parsing operations to perform.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is the best succinct explanation that I could find

The JSR-231 APIs specify interfaces two low-level OpenGL abstractions: drawables and contexts. An OpenGL drawable is effectively a surface upon which OpenGL rendering will be performed. In order to perform rendering, an OpenGL rendering context is needed. Contexts and drawables typically go hand-in-hand. More than one context may be created for a particular drawable. In the JSR-231 abstractions, a context is always associated with exactly one drawable

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Look at the api doc for indexOf(). It returns -1 when the string is not found in the target string. You are searching for a comma in a name that does not contain a comma in your driver class. The test name in your class does have the comma so it works fine for that one.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hard to say really, especially not seeing your custom wrapper code. I have only used JOGL with Swing/AWT, so I'm not familiar with any of the issues related to its use with SWT, but since you say the code works fine without your abstractions I would look to those first and make sure you aren't losing the context or canvas somewhere in there.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

1.) using BigDecimal will still not give u the right answer it just gives you a longer floating point value plus this problem does not exist in c# so Sun should have done something about it regardless of floating point representation.

Well, sorry, I guess you are just going to have to stick to C# then if you want a 128-bit decimal floating point type. With Java you are stuck with float and double or you can use BigDecimal. The choice is yours, but complaining about it won't really get you anywhere.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you do not call the printCapitalized() method anywhere in your main method, so it's not going to do anything until you call it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you can establish a range of the expected variance, you should be able to vary the search parameters as needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a look at AForge.NET

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Read through the sticky thread at the top of this forum. There are a lot of references there. I've heard the "Head First Java" book is very good, as well as "Core Java 2 vol.1/2".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You would need to post the paintSprite() method code, as that is the one making the calls into the graphics methods that are overflowing the stack.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're also trying to declare your methods inside that incorrect constructor. You cannot declare methods within methods.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would think everyone would qualify as 'food-addicted'; I don't know many people who can go for very long without eating something.

Yes, the withdrawal symptoms are rather severe.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you know that the rank will be 1 or 2 characters. The suit will always be a single character at the end. Using the substring() and length() methods of String, you should be able to separate the string easily into the two portions that you need.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Reading the class notes would help as well, as instructors usually cover these concepts before making assignments on them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I was not referring to a specific method - only a general outline of the steps. Please post your code and specific questions if you need more help beyond general advice.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, that is another operation which you did not mention in your original post. A List is not the same thing as a text file. If you need to first place those entries in a List, then you will need to open a BufferedReader against the file, load each entry into a List (ArrayList most likely), and then use the Iterator to walk that list and append the items to the text area.

If the assignement is as you state, then surely you have some course notes covering some of these operations, which you can use as a starting point for your own code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think it makes the code much more interesting to read :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're definitely going to need to do more work on it then what you posted if you expect to receive any help at all.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Plus prayers...Together with your loved one...Try praying together with your girlfriend, it really makes you feel good after. It takes out your stress and strengthens your relationship.

So does sex :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That is a lot more code than is needed. The conversion only needs the evaluation of intVal!=0, so the function reduces to

boolean intToBool(int value){
  return (value != 0);
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You could add the file names to a HashSet as you download them. The add() method will return false if the set already contains the item, at which point you could alter the filename, add it to the set and then write it to the zip stream.