• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Programming

    Prabhet: I'm sure you intended to help, but here we try to teach people the knowledge and skills they need. We don't just do their homework for them. If you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how can i search the first token in my array list

    if(program.get(i).contains(remp)) the `contains` method looks for remp anywhere in the line. if(program.get(i).startsWith(remp)) the `startsWith` method checks if the line starts with remp. Is that what you wanted? (NB the parameter …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how can i search the first token in my array list

    I don't understand that question. You asked for the first matching token, and if you present the data in a different order, a different one will be the first. So …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in convert pdf to jpg java code examples to follow

    Aspose.Pdf may be a good solution, but the starting price of $799 may be a barrier to its use in this case! http://www.aspose.com/java/pdf-component/pricing.aspx There are open source pdf libraries available …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in convert pdf to jpg java code examples to follow

    OK, cool it down folks. stultuske is well known for saying what he thinks. If anyone doesn't like his posts then just ignore them. Please don't get into a place …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how can i search the first token in my array list

    You can break out of the loop as soon as you have found a match, ie: for (int i ...) { if (prog....) { display token break; }
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Lists and ArrayLists

    ^ again, yes. Or Set<Y extends X> where X is an interface. Lists implies order which may not be relevant or defined, so, for example, if you switch the implementation …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Lists and ArrayLists

    ^ yes. ps: Exactly the same logic applies to defining the return type for a method. If your method returns a collection of <X> in a particular order, just declare …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Lists and ArrayLists

    Unless there's some reason why to *has* to be an ArrayList, by declaring the variable as a List you allow the possibility of (eg) changing the implementation to a LinkedList …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Nested Classes

    Most situations call for an ordinary class. Nested classes are good for event listeners, and for little data structures used inside a class, eg Linked List classes may have an …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Nested Classes

    An nested class has access to the variables and methods of its enclosing class, and it can be private to the enclosing class. That's a completely different kind of sharing …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in problem switching direction when I create mult enemies in libgdx(box2d)

    It's hard to see what's going on from those fragments, especially because you seem to have reversed the Java conventions for capitalising names. So in line 6 Enemy.wallSwitch = true; …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Using scanner and JoptionPane

    > You need to add a JFrame. Sorry, but that is completely wrong. You do not need a JFrame to use JOptionPane.showMessageDialog. Just use null as the first parameter.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Using scanner and JoptionPane

    > You have to add System.exit(0); at the end of your code, otherwise javac won't work properly. Sorry, but that is completely wrong. System.exit is always optional, and is mostly …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JFrame Disappears when Textfield added!

    That code is completely unreadable - blocks that go on forever, no comments, no indentation... But as far as I can see the order of creating the frame is maybe …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Write a program

    You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in problem switching direction when I create mult enemies in libgdx(box2d)

    Maybe `wallSwitch` needs to be an attribute (instance variable) of the Enemy class, so each Enemy has it's own value for that variable?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in displaying images stored in mySql database as a grid

    It looks like that's another of nidheeshkumar.r's classes that goes alongside ImageShow and handles getting the image ResultSet from the database.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Reading text file to draw rectangles

    The variable sizes are handled by the x,y,w,h variables. The variable number of rectangles is a good reason to use a List rather than an array to hold them. If …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Experimenting with GridBagLayout

    Hi, welcome back! The CENTER spec you are using centers the buttons vertically. NORTH or SOUTH should move them up/down, but note this: "Unless you specify at least one non-zero …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Reading text file to draw rectangles

    Arrays and a loop are a sensible way to do this. Don't give up so quickly!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in RMI ClassNotFoundException

    Forget rmic and stubs. They have been obsolete for years. For current tutorial info and a working sample [this](http://docs.oracle.com/javase/tutorial/rmi/index.html) is a good source of info.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Reading text file to draw rectangles

    To hold the info for multiple rectangles you need multiple sets of coordinates (x1, y1, length, depth). You could use arrays to hold them, or some kind of List or …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in making a ball to move

    That's a pathetic post. If you want some help you'll have to provide a LOT more info than that. Do you think we are all mind readers?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in CharToString

    There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Unable to catch input from for loop

    It's a real problem with Scanner's design - so many people fall into this trap. You have some input with an int followed by some text, eg 101 John Doe …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inheriting vs Instantiating

    I read it as: A blueprint is like a class definition. Creating a new blueprint by taking an existing one and modifying it is like creating a new class definition …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited java condition statement?

    You have been hired by an amusement park company to write a JAVA program that prompts a person to enter their age and height and to find out if they …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java condition statement?

    "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Thread closed. JC
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Multiple inheritance?

    Critically analyze the following statement "Multiple inheritance can be achieved without interface"?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Multiple inheritance?

    "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Thread closed JC
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inheriting vs Instantiating

    I beg to differ. I think that's a really good analogy. I'll use it myself in future.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Consecutive Rolling

    Looks like a problem in the roll() method - did you change that to use a local array?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Consecutive Rolling

    In `rollConsec()` you can change the` while (true)` to a `do` loop with a limited (eg 20) number of iterations
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Consecutive Rolling

    Can't see anything wrong there. Try printing the tempRolls array as well as the highestRolls, and look at the FIRST few lines of output. YOu should be able to see …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in problem with jtable reading data from text file

    You read the first line (17) then use its tokens to add columns (20). You then read the rest of the lines (22) and use those to add rows (25). …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Consecutive Rolling

    > In this case, you you add one to both? Or ignore it and not add anything? That's up the programs eventual user! Personally I think adding 1 to both …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Marked Solved Status for Inventory Program Part 3

    I have an assignment that is due tonight and I ran into a few errors. The first two parts compiled successfully just the third one ran into errors. I don't …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Consecutive Rolling

    A couple of problems: you don't re-initialise rolls on each call of roll(). It really should be a local variable in the method. for(int i = 1; i < 6; …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Monopoly Program Run Error

    mukind: Answer is NO. Do your own homework. People here will help if you show some effort first.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Consecutive Rolling

    31: rolls[diceValue - 1] = rolls[diceValue - 1] += 1; That is positively *wierd*. Two assignments for the same variable like that - I'd have to read the JLS to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java lamda expression

    I like lambdas, but I have no idea what your code is supposed to do, therefore have no idea how to refactor it. Do you really intend to repeatedly overwite …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inventory Program Part 3

    Most of the symbols it can't find are the names of standard API classes, so it looks like you forgot (some of) the `import` statements at the start of your …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in fix for “ArrayIndexOutOfBoundsException”

    Those 2 code fragments don't quite add up, but... you have a 2D array 4x3, so the array's length is 4 in your loops you use the length to control …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inheriting vs Instantiating

    You inherit from a superclass when defining a subclass with the `extends` keyword. You instantiate an *instance of* a class at runtime when you use the `new` operator.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java lamda expression

    There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in My Jar File aint running

    at PPMSPrototype.initComponents(PPMSPrototype.java:841) That's the line in your code where you try to use a null reference. Looks like that's trying to create or use an ImageIcon? 10 will get you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Many classes calculate a final grade by using a weighted scoring system.

    <Simple copy of teacher's homwork specification deleted by Forum Moderator>
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited Join two 2d arrays in one 3d array Javascript

    I wanna create a new 3d array levelxyz from the two bellow 2d arrays. var levelxy = [ ["-", "-", "*", "-", "-", "*", "-", "-", "*", "-"], ["-", "-", …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in import desktop app into another desktop app

    You want to run an app in another jar when a button is clicked? The easiest way is to use the Desktop class which can open a file in its …

The End.