Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

omelette > breakfast
:P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a look at this section on using JList with a mutable model:
http://download.oracle.com/javase/tutorial/uiswing/components/list.html#mutable

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

soup > chicken

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Separate them based on what data is completely intrinsic to each. What information about the customer applies to them whether they are on or off of a plane? Similarly, what data about the flight would apply even if there were no passengers on it?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Another option would be to create a small ChipStack class that extends JComponent and overrides paintComponent() to render both the stack of chips and the text count as a single graphical unit. It would make positioning on your table a tad easier.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

breakfast > waffle

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

life > cereal

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

immortality > vampire

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

death > mortality

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

comedy > tragedy

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Not only a shame - it's a violation of the rules. Of course, so is begging for homework help without showing any effort.

I really don't see why anyone should help him find a program to copy and turn in as his own work.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, as pritaeas mentions, this is answered in your other posting: http://www.daniweb.com/forums/post1384110.html#post1384110

Please do not post the same question in multiple forums. Closing this one.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is not a homework completion service. Post the code that you have done so far and post specific questions or error messages that you are having trouble with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> Recently i offered them to send them a couple of notes, and they never got back to me

Well, there is your answer then. If they ask, just don't get back to them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The code you posted above is not the same as the code in the tutorial you linked.

Your connection string is still wrong. Why are you trying to specify a "mysql" connection with the SQL Server driver? You also dropped the Class.forName() call.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use an array and a loop.

Next time start a new thread if you have a question. Don't hijack someone else's.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would also note: you are using the worst possible driver to try to connect to it. Don't use the jdbc-odbc bridge when there is an actual jdbc driver available.

If you do have to use the jdbc-odbc bridge driver, don't use a MySql connection string. Look up the proper connection string for the ODBC source.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That's your own message. Print the stack trace instead.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

deception > politician

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The API says it all.

Good catch, James. I never saw that. I assumed it was a mutable model like the default combobox model.

It looks like you'll need to create your own model if you wish to add or remove items. You can read about that in the tutorial here.

It should be just a minor change to your existing code to use new JList(lmSeries); since you're creating that model anyway.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're parsing it as a double as soon as you read it. "Q" isn't a double.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It looks to me like your code should work just fine. Are you sure that you aren't resetting the model at some point after listSeries() has updated it? The add() method automatically fires an event that should keep your JList updated with the model.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think that is probably only a part of his statement, because without any context of the discussion that doesn't make any sense.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think many posts about that end up in Game Development as well.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

As you have been advised, you must demonstrate that you have made some effort if you want help with homework assignments.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your question isn't clear and is unrelated to this particular thread. Please create a new thread with a more specific question that describes what you are wanting to do.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Arrays do not have a "pop()" method - they are fixed storage. You can null out elements or shift them out of existence.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't see anywhere above where you actually initialize the display either.

Take a look at the LWJGL game window setup code in this tutorial and maybe it will provide the pieces you're missing. The complete source files are linked near the top of that page.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, from the API doc, it looks like you need to call Keyboard.create() after the display is initialized and before you poll any keyboard state.

I've never used that API though.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you designate a package, the file must appear in a directory of the same name. You are not required to use packages, but it does keep things more organized.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Remove it. If it's not used then you don't need to import it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

His comment was quite straightforward. Did you look up JLayer?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> Whenever I run this code, there's no input box for the user to input text.
It's a console application - you type in the console. Working as intended.

> If I change the "String text = console.nextLine();" to "String text = console.next();" then only the first word is taken into account.
Also working as intended. Those are two different methods which do two different things. You can read the description of each in the API doc for the Scanner class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You will probably need to split the first three lines to separate the tags from the numbers before you read them. "rows 7" is not an integer.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Start by adding a distanceFrom(int x, int y) method to your store class, which will return the distance from a point (x,y)

public float distanceFrom(int x, int y) {}

Your mouseClicked method can then loop all of the stores and check the distance to each store.

Between that and the pseudo-code I posted above, you should be able to get a start with it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Swap your package and import declarations. The package must be the first line in the file.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You didn't mention what the error was.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

1) You're only reading two ints before you start trying to read and parse strings - how does that match up with your input file?
2) After you've correctly parsed the passenger entry, you know which row and seat to put him in because it is stated as the first two pieces of data.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So in pseudo-code, each time you click you just need

for each store in stores{
  float distance = store.distanceFrom( mousePoint)
  if distance < minDistance {
    minDistance = distance
    nearestStore = store
  }
}

I don't see any reason why you would need or want to store the distance to the mouse in the object itself, since it's just a transient reference point. What you really are interested in is which store is closest. Determining that doesn't require putting the mouse coordinated into your store data class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have to recalculate those values each time the mouse reference position is moved, but there really isn't any reason to keep them after you have determined which store is nearest is there?

So when the mouse location changes, loop the stores to determine the distance to each (using the method I mentioned) and keep track of the closest as you loop. You can maintain a 'nearestStore' reference in your map test if you need to refer back to it for repaints or such.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There is no need to keep the "distance to" values in your "store" class. Those can be computed on the fly from your mouse locations.

You can create a separate method distanceFrom() that computes the distance from a point to a store. It could be on the store class as distanceFrom(int x, int y) or you could put it on the map class as distanceFrom(store s, int x, int y) You could also switch to using java.awt.Point class instead of the x,y pairs if you wish.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Here is the concurrency tutorial as a starting place: http://download.oracle.com/javase/tutorial/essential/concurrency/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So what is your question? The code you posted does work, it just isn't useful for anything. So what exactly are you trying to figure out?

There are a ton of references on basic thread usage. Perhaps you need to read them? Or ask a specific question that someone could actually help you out with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the exact error message it gives you and perhaps someone can point out the problem.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you have a question, post it along with the code. If you're wanting to pay someone to do it, create a thread over in the Looking To Hire section.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use it for what? It doesn't look useful for anything to me.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, so you didn't answer my question and ignored the part about using code tags when posting code.

The question that I asked previously is exactly the problem with your code. It's not in a method. It's just sitting there in the class body.

/**
 * Write a description of class ArrayAirline here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ArrayAirline
{
    // stores airline object
    private Airline[] array ;
    private int index;
    

    /**
     * Constructor for objects of class ArrayAirline
     */
    public ArrayAirline( int sizeIn)
    {
        // initialise array
        array = new Airline [ sizeIn];
    }

    /**
     * Add an item into the array
     */
    public void insertAirline ( Airline a)
    {
        // put your code here
        array[index] = a;
        index ++;
    }
    
Airline reference = search(choice, airlineObjects);
			if(!choice.equals("QUIT")) {
				if(reference == null) {
					System.out.println("wrong flight number enter another flight number");
				} else {
					System.out.println("your file detail is .....");
					System.out.println(reference.getFlightNumber() + " " + 
							reference.getDestination());
				}
			}
    
    public void printArray()
    {
        System.out.println ( "Airline List:" );
        System.out.println  ("Flight number / Destination" );
        System.out.println  ( "             ");
        for(Airline a : array)
        {
          System.out.println(a.getFlight() + "\t\t"   + a.getDestination());
        }
        
        
       
     }// end of method print Array
     
     // search for a flight number and return the 
       //airline object if found, return null if otherwise
     public static Airline search (String flightIn, Airline[] array)
     {
         for(Airline a: array)
         {
         if(a.getFlight().equals(flightIn))
            {
                return a;
            }
        }
             return null;    
      }
           
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Is that code inside a method? Post the entire code in [code]

[/code] tags.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This thread was put at the top of the forum for a reason:
http://www.daniweb.com/forums/thread99132.html