• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Beginner sand timer help

    You have a variable that holds the amount of sand in the bottom half. I guess that would be measured in grains? What happens to that variable when 1 grain …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Beginner sand timer help

    You use a loop when you want to do something a number of times. You use an `if` if you want to do something only under some circumstances. Reading the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question

    The idea would be to print `permissions` and `operation` just BEFORE the exception, so you can see their values. But the message implies that `operation == 4` and `permissions.length <= …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to search existing object in an arrayList

    actionPerformed is called on the Swing thread, so the appends should be OK as they are.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question

    Time for a bit more debugging! Try printing the important values (eg. the contents of `permissions`, the value of `operation`) and see what tells us. ps: why not simply store …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to search existing object in an arrayList

    Your method should add one line to the text area for each bidder in the array list, so you need to debug the actionPerformed by adding a number of simple …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to use an existing android application's code for web application

    ... and your question is...?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to search existing object in an arrayList

    That code looks OK. What help do you need?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question

    This is nothing to do with the compiler. The compiler has no way to know whether the array reference will be valid at run time. It's the Java runtime that …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in exception handling

    You will need to test for incorrect input and throw an Exception if it's incorrect. If one of the existing Exceptions in the Java API correctly describes your situation (maybe …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to milil in help with this code, is it wrong or right

    You don't need a scaner because he read an input from user. So you need to make a program that writes from 1 to 15 odd numbers. So you have …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java

    Look at ArrayList's `stream()` method and `Collectors.joining`
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    The ServerSocket listens on a given port/IP address. When it receives a connection request it creates a new Socket that you can use to communicate to/from the client. This is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    If you don't want to use a server then yes. *Somebody* has to be listening for any connection to be made!
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    The target "client" has to be listening on ServerSocket for the other client to connect, but that's the same as the code in our existing server. The problem is usually …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need Help figuring java ascii art pattern

    Start by indenting your code properly and fixing the compile errors.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in help with this code, is it wrong or right

    Your code is the solution to a different problem (count the number of odd numbers in an arbitrary list of numbers entered b the user). Looks like you copied from …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inventory program GUI

    Being in one file, vs one file per class, doesn't make a lot of difference IMHO. Personally I wouldn't worry. Things like having multiple variables with the same name however …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to pass the combobox from a class to another class

    Put that code in a public method and call that method from your main class
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Monthly paycheck confusion

    Line 6 of the error message tells you that it was trying to parse the user input on line 47, and failed to parse it as an int. Did the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Binary tree GUI

    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 Getting an Object based on string

    The map entries are just a pair of references (pointers), so the map will be a lot smaller than the existing data. Depending on how your ArrayList is updated maybe …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inventory program GUI

    OK stultuske has given you excellent advice, but all you need to do now is to use tha `append` method instead of the `setText` method so that your strings are …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in deprecation error

    (Previous post deleted) The code posted by OP and described as "my game code" was in fact stolen from somewone called Melinda Green (in turn based on Guido Pellegrini's Summer …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in pdf cells issues

    I don't know anything about PdfPCell, but it looks odd that you create new instance of it on line 7, but you don't do anything with it. Similarly you add …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Screen resolution - need your help!

    Thanks stultuske and Search_not One more point... please post the reported resolution as well Thanks J
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in deprecation error

    No, it's not Vector. Vector has *not* been formally deprecated (just look at the current API doc). The nearest it gets is the following quote from nthe Java 8 API …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited javascript and html

    Hello my friend out there i realy need help .i'm working on one of my class labs but things is not that write to me...could one out there assist me …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in HTML5 cabability in browser?

    I doubt very much that the HTML support in Swing will ever be updated for HTML 5. The future of rich graphical GUIs in Java is JavaFX, so maybe you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to snowtiger37 in calculate the grades for a student using if..else statements.

    Construct the algorithm for a program that will prompt an instructor to enter the letter grade ('A', 'B', 'C', 'D', or 'F') earned by each of his students (we don’t …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Created Screen resolution - need your help!

    Although layout managers usually scale text properly, with the spread of "retina" Macs with screen resolutions over 200 d.p.i. we can't just keep ignoring pixel size for grahics or animation. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in ideas to build a game in java

    See the very first topic at the start of the Java forum main page https://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Getting an Object based on string

    I simplu doesn't work like that. If you want a reference to an object, use a reference variable of the right kind. Java references are "opaque" - you can use …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about Timers/Block Movement

    You are stopping and starting to switch between two timers, so the timing keeps changing. One solution: Have 1 Timer that just moves block 1. Start this and leave it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JPA/Hibernate Objects not the same when they should be.

    Do you override equals for your User class and use that for all "equals" tests? That woud be the normal approach, == is never going to work all the time …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in itextsharp error

    First pass through the loop you `add` and `close`, so on the secand pass through the loop the document is already closed, so the `add` fails
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Using MySQL Database

    The JDK comes with [JavaDB](http://www.oracle.com/technetwork/java/javadb/overview/index.html) (a fully Oracle-supported version of Apache Derby) as standard. If you use that in embedded mode you just need to add one 2.6 MB jar …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Update objects on the "Client side" from the "Server"

    That is way far too much code for you to debug your first attempt at client/server object passing. I suggest you park it, and write a tiny proof of concept …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in need to add student keep printing out student 0

    the array student is created on line 8 but you have no code to inialise it, so it is just full of zeros. So on line 20 when you print …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in coding string on coding bat

    Apart from small errors like the duplicate declaration, that approach can work, but it's horribly complicated and (if anyone cares) horribly inefficient. Convert to a char array and swap elements …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Exchanging Event Data Between Two JPanels

    Why the duplicated code in the two BattleShipX classes? At a quick look it looks like you should have an abstract superclass with all the common code, and have those …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in InputMismatchException not working

    Your catches will catch exceptions thrown inside the corresponding try block (lines 35-47). The nextInt method (line 32) can throw the IMM exception, but that's outside your try.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in coding string on coding bat

    Nobody is going to give you the answer. That destroys the whole point of giving you this to do as part of your education. Here's some info that may help …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Rewrite the program from 2-3-4 tree to 2-3 tree.

    Assuming this is homework, check the DaniWeb Member Rules. Nobody will do this for you; but if you show effort we will help. Assuming, again, that this is hoewomrk, I …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in reading a txt file question

    If you don't put them in an array (or some other container eg ArrayList) then you would have to re-read the file for each user input, which would be a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Having trouble sorting my array in ABC order

    You have a toString() method in you Pizza class(es). Java will automatically use that when you try to print a Pizza - ie it will print the result of calling …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Update objects on the "Client side" from the "Server"

    1. No. Each client creates its own GUI. All it neeeds from the server is the current model data. (Different clients mayhave completely different GUIs, eg PC vs smartPhone) 3. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Having trouble sorting my array in ABC order

    Not quite gone yet... yes, thebname variable is private (that's good), but you have a public getName() method to access it (also good). Use the public method. In your compare …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Having trouble sorting my array in ABC order

    Never just say "I get an error". Help us to help you by copy/pasting the complete error message! Anyway, without knowing what code you tried to put where nobody can …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Having trouble sorting my array in ABC order

    It doesn't really matter, as long as its somewhere where you can access the array. Inside the Inventory class would be an obvious choice.

The End.