• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JScrollpane not working properly

    Yet another good example of why not to use a null layout manager! Swing doesn't know how big the panel is because there's no layout manager to set it. If …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in remove in arraylist

    OK. In that case why not go back to solution 1, that doesn't involve any new classes or concepts.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in remove in arraylist

    I guess you didn't look at athe API doc? http://docs.oracle.com/javase/8/docs/api/java/util/ListIterator.html
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in remove in arraylist

    1. You can use `b.remove(i)` to remove entries. Loop down from the end of the list to the beginning to avoid confusing your loop's indexing when you delete an entry …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in I NEED HELP WRITING CODE

    MSDN isn't helpful for Java. MS doesn't support Java.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Why is processing a sorted array faster than an unsorted array?

    I can't see anything in the bytecode that would explain a speed difference, and caching at the RAM level isn't going to be relevant, so maybe this is a low-level …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Full Text Search in MongoDB

    That's far too vague. We need more information about what you have tried and exactly what problem(s) do you have.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Change two variables at once in java

    This depends on whether the value is a primitive (int etc) or an object. If it's an object then all your variables are pointers (references) anyway.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in change content pane colour program, first stab

    An inner class yes. But because you want to pass a Color to the constructor to make different instances for each button, it can't be anonymous.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in change content pane colour program, first stab

    This is a case where your first solution is good, and anonymous inner classes don't help. You could attach the color as an attribute of each radio button With Java …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in String input through constructor

    Obviously an error in your (undisclosed) code. There's nothing wrong with split. `"06/12/2011".split("/")` splits correctly - try executing System.out.println(Arrays.toString("06/12/2011".split("/")));
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in String input through constructor

    OK,I was confused when you said " a user-input date as a String in the format mmddyyyy" If the user input is mm/dd/yyyy then you can just use String's split …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in String input through constructor

    You can't tokenise an mmddyyyy string by using "/" as a delimiter, becuase the string doesn't contain any "/" characters! Because the format is fixed, you can simply use String's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Swing package in java

    It's available from amazon.com at about half price (USD20). Personally I would avoid books, which are always out of date, and go with online materials. Oracle's "official" Java tutorials are …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Difference between JAVA and C++

    C++ is a language with a standard librray that covers a decent range of common requirements. You are expected to use it with the native facilities of your OS and …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in No output from UI thread

    9: ... textField.toString() ... If textField is a JTextField or similar then this is a mistake. The toString() method gives you a String description of the text field object and …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Stopped Watching Do you feel old yet?

    I laughed :) [Kids react to old computers](https://bgr.com/2014/05/26/kids-react-to-old-computers-video/)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Control Objects

    This is a very specialist subject - it's possible nobodyhere has any experionce with jpos. The jpos web site links to a user group and a developer's forum - you'll …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in String input through constructor

    You declare the parameter(s) of a constructor just like an ordinary method eg public CheckDate(String mmddyyyyString) { ... then call them passing parameters also like an ordinary method, eg CheckDate …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in get next record from database

    Exactly what code do you execute in the actionPerformed for your "next" button?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Array Index Out of Bounds Exception:0

    Yes, that's what the API doc says... > A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in I NEED HELP WRITING CODE

    Yes, people here will help you. Explain what you have done so far and exactly what help you need. Remeber that nobody here will do the work for you, but …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help with objects and methods

    From the look of it that printSelf method belongs in the Person class, not the Driver, and it should be an instance method, not static. That's because it's obviously intended …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in jboss log manager error

    Any reason you have to be on obsolete Java 1.6? The final security update to 1.6 (the one you have) was over a year ago, and you are now missing …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with exception handling

    Your set method looks great. Because you have declared the constructor as "throws InvalidHoursWorkedException" you don't need to try/catch it in the constructor. Just call the set method and if …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with exception handling

    In your set you just need to check the hours and throw an exception if they are invalid. Your exception class has a constructor that includes the ssn, so just …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with exception handling

    Normally the `throws` and the `try/catch` are in different methods as in void method1() throws Exception { ... if (...) // there's a problem that I can't fix... throw new …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to assign the result of a query to a string

    A problem with the first code is that `result` and `to` are declared inside the try block, so those variables cease to exist as soon as the block is exited. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in housie game

    In Java we would probably use classes rather than 2D arrays here - eg a Ticket class and a Player class. Then you just need simple references or lists (1D …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in question

    Never do this when writing new code: } catch (Exception e) { } If/when there is an error you just told Java that you didn't want to know anything about …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Music Housie

    Maybe duringthe game you can check for winners and remember who was the first to win. Then after the 97 songs that person will be the final winner?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Music Housie

    It seems there's a problem with the rules of the game: "only one person can win full housie" and "there may be numbers of winner". That is not a Java …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Lucaci Andrew in Substring problems

    Have you looked at the specification from the website? [substring(click here)](http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#substring\(java.lang.String, int, int\)) What are the actual parameters that the function takes? > Parameters: str - the String to get …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Clear bugs

    It's saying you have not defined anything called Mailercm Probably you are missing that class's definition, or you are mis-spelling its name.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Substring problems

    Did you mean "the method *exits*"? If so there's a logic problem - you are assigning the substringed values to new variables in your method, which will cease to exist …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Substring problems

    That screenshot isn't a stacktrace, and doesn't help. You don't provide the source for your StringUtils class (t's not part of the standard Java API). That leaves us with more …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in String to Hex

    Ahhh - the old BigInteger trick. What you have found is an over-complicated version. The simplest form is just one short line... You can use the simpler version of getBytes …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Matrix multiplication problem

    on which line? What value of the index? Post the complete error message.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Remove or Delete a particular registry key

    If you were virus infested then it probably did a lot more than make just one registry entry. It's time to use a proper virus removal program (or programs) to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help me Subject java (Input month name output number of days)

    DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Remove or Delete a particular registry key

    Oh yeah, Dani's new thread editor tries to be smart about special characters. It makes sense to her, but drives me mad too. In that case just getting rid of …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Remove or Delete a particular registry key

    Java String literals treat a back-slash as an escape character. If you want a literal back-slash you need to code two, as in "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Test" plus "REG" is just the short …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Remove or Delete a particular registry key

    I have applications running every day that use it. What exactly did you try, and in what way did it fail exactly?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Making a hexagonal map in Java

    Please be much more specific about your question. We don't know whether you are struggling with how to start a Java program or struggling with some obscure side-effect of using …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Array Index Out of Bounds Exception:0

    Which line is the exception thrown from?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in card game. I tried but failed. please help

    ... and if the dealer gets to make the next bet...? one solution is to have a "next..." button that the user has to press each time before the system …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Remove or Delete a particular registry key

    Java has no direct support for the Windows registry, but it's easy enough to use `ProcessBuilder` to execute the Windows `reg.exe` command-line utility to perform registry queries or updates.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in card game. I tried but failed. please help

    What exactly do you want to happen in the user interface (as seen from the user's viewpoint). Eg in round 1 if the dealer makes a bet exactly what do …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Recursive method with static call

    Every case finishes with a return, so the extra return false will only be executed if none of the cases is true. Sometimes this happens with the Java compiler. You …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Recursive method with static call

    The code looks neat, but I don't know what it's supposed to do, so I can'y comment on its efficiency or correctness. If it gives the right answers then it's …

The End.