• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot find symbol - method

    Let's take this one step at a time: Exactly which line of code does the error message refer to? (Post the whole error message - don't edit or summarise it)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hpw to stop the Below Access Denied Error

    Is that access allowed by your security policy?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Minesweeper GUI need help!

    For the flag - set the flag icon for the button in the actionPerformed (like slavi said). Ie when the user clicks a button, set that button;s icon to the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot find symbol - method

    That message was generated by some other piece of code - if you don't post that then nobody can help. ps Your sumArgs method makes absolutely no sense whatsoever.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Slavi in Minesweeper GUI need help!

    What James said but I think you need to do it inside actionPerformed, so that is actually happening when a button is pressed not as a default image
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Minesweeper GUI need help!

    It looks like your grid is displayed as a grid of JButtons, so do as Phaelax says and set the appropriate icons for each button ... `button.setIcon(icon)`
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need an idea as to how to get the row if a specific position is given

    If there are always 8 items/row then simply divide the item number by 8 to get the row number. Then use modulo 8 to get the position in the row, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Investment Calculator

    Thanks for that contribution brycematheson. Just two quick comments on the code: Your naming convention is perfectly valid, but not one you will often find in Java - the source …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in console input

    30 seconds with the API doc will tell you that the Console class does not have any public constructors. You will also find the following helpful comment: "If this virtual …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    Yes, here's the code I used to confirm the problem... String s = "1.2 3.4"; Scanner input = new Scanner(s); // my default Locale is UK System.out.println(input.locale() + " " …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    I suspect the Swedish locale uses the comma as the decimal separator. Your file has . as the decimal separator, so that may be causing a problem in reading floats …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Generics

    The type E could be anything, String, URL, JButton... so there's no version of the + operator that can be used with all of those. What did you want it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in cannot find symbol?

    the ViewManager variable is defined on line 45, inide the do block that starts at line 41, so it goes out of scope when that do block is closed, and …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    / and // worked no problem Hmmm... I tried creating a File with // in the path, then printing its canonicalPath, and found the // to have been replaced by …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    That's interesting. I wouldn't expect that to work! Can you try it with single slashes?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    The latest version is worse! You now have an empty catch block, so you will never know if the file was found or not. Alwyas use an `e.printStackTrace();` until/unless you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    Why are you printing the contents of `weight` only if the file is not found? If you can't find the file then `weight` will be empty! Hint: Indenting your code …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    Yes, that looks like an empty array - which would explain the 0/0 == NaN
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in change jframe style

    Yes, does look like Nimbus. thanks. (I never used it becuase I always go for the native system L&F to avoid confusing the users.)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to insert an image from the web, and text in JLabel to be inserted in J

    What code are you using to "use this JLabel in a JTextPane"?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Analyze the following code. and choose the right answer

    ... and why do you think d is always less than 10?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in change jframe style

    Nice scroll bars! What OS is that? Anyway for info on how to set the look and feel start [here](https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in NaN (Not a number) error!

    NaN is most commony seen when you try to divide by zero, as may happen if the loop on line 8 above executes zero times, so line 12 is trying …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in game round

    Just display a message and read the reply - it's no different from any other interaction with the user.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in game round

    Why not just a simple `int roundNumber = 0;` then increment it as each round is completed: `roundNumber++;`
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in game round

    There's nowhere near enough context there to answer the question. What are `round()` and `round` for example?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java 2 SE programs not run with servlets

    I did understood that perfectly. If you didn't have an explicit classpath then you had the default, which is the current working directory. Your new classpath does not include that …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java 2 SE programs not run with servlets

    You just need to ADD servkey-api to your classpath, keeping all the existing entries as well.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java 2 SE programs not run with servlets

    Did you **set** CLASSPATH variable `servlet-api`, or did you **add** `servlet-api` to you classpath? Maybe the problem is that you lost your previous classpath values?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jbotton

    Use the client property (see mKorbel's code for an example) to store the $23 or whatever in each button. Then in your action listener you can retrieve that (see mKorbel's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to fix my code it does not play the other player after player 2 wins

    I don't understand your question! What do you mean "play the other player"? Do you want to start a new game? If so, you need a second loop, like this …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Analyze the following code. and choose the right answer

    Repeating the question just wastes everyone's time. Read stultusk's answer, then simply try the code on your nearest computer. When you have done that, if you don't understand what happened, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jbotton

    Yes, I also would use client properties to identify the button that was clicked, or maybe an action listener that takes a button number in its constructor. The array suggestion …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Loop through binary search tree

    I think that algorithm will fail if there are both left and right nodes - it will just traverse the left-most children. I think you do need recursion (or something …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jbotton

    You could store your button references in a 10x10 array (or a 100 element array) as you create them.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how do I convert hext to binary

    OK. Maybe you can give an small example of some input, and the output that you want? You will need to explain whether the output is just a Sring, or …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Renuka_1 in I want core java code for following program:

    We are hosting the Olympic games. Write a program that will track all the details of this hosting. 1. The program should track the countries and their players along with …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in I want core java code for following 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 Capturing Image from WebCam - JMF and JSP

    Nice try at some free publicity for your product! I'm sure there's a reason why you didn't mention that it costs between 8 and 12 THOUSAND dollars. Caveat emptor.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in For Loop

    Yes - Sorry, I posted that from my iPad and wasn't thinking properly. It's chars that are unsigned, not bytes. Thanks for correcting that info.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to janissantony in For Loop

    I thought bytes are -128 to 127
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how do I convert hext to binary

    Here's the simple test case I used: String in = "1020fffe0100"; BigInteger bi = new BigInteger(in, 16); byte[] bytes = bi.toByteArray(); System.out.println(Arrays.toString(bytes) and the output was [16, 32, -1, -2, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in add new row to Jtable at run time and save records

    There are lots of examples on the web that yu can find with your favourite search engine. There's no need for anyone here to write another one. Anyway - are …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in For Loop

    Java bytes are unsigned 8 bit integers in the range 0-255 You can't use negative numbers with byte values.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Avinash_4 in If Statement

    Check if statment. For more click link [Types of Java Statement](http://thatsjavainfo.com/java/java-statement/)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Avinash_4 in Easiest way to implement this in Java

    this is a keyword in Java. Which can be used inside method or constructor of class. It(this) works as a reference to current object whose method or constructor is being …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java help -stuck on level 2

    Don't think about code until you have worked out what logic you need. Just get a pen and paper and work through some examples. Keep doing that until you understand …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how do I convert hext to binary

    If you want to print it use the milil's code. If you want binary array use mine.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how do I convert hext to binary

    Obviously if you change the code to give you a byte[] then you have to change the return type of the method to match.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how do I convert hext to binary

    Do you mean a string like "100110001010100..." or an internal binary format such as a array of bytes? If it's a byte[] then you can use a variant of the …

The End.