• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problems with public static void main

    The default access is not public, and public/private are not the only alternatives. See http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Creating/aligning the ascii table in a text file

    Hve a look at System.out.printf - allows you to specify the format for what you print.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in problem in showing balls

    No, I was referring to the post immediately before mine, specifically to `super.getGraphics()` etc. The code you just quoted is 100% OK as it is. The overall structure of your …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    Using Java 8, or an inferior older version of Java?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Find the most frequently used words across multiple files

    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 Adding Controls to a background label, and structuring the source code

    ... in which case I'd ignore JavaFX for now. J
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    ... and (another) final observation... You are using Swing - the current standard for cross-platform Java GUIs, but as of Java 8 Oracle are starting to push JavaFX as a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JavaFX multiple errors

    > Caused by: java.lang.IllegalStateException: Location is not set. > at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) > at javafx.fxml.FXMLLoader.load(Unknown Source) ... seems to suggest there's something missing in your scenebuilder FXML file? Update: It …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    Excellent! Glad to help. One tiny bit of feedback - you explicity but unneccessarily set a few things that are the default values or inappropriate anyway: layered panes have a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in problem in showing balls

    No no no! Only ever draw on a Swing Graphics when you override `paintComponent(Graphics g)` (or, sometimes, `paint(Graphics g)`) Swing has all kinds of internal optimisation, including double-buffering that you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java projects for learners

    This thread is for people to suggest project ideas, not to post actual projects or solutions. If you want to discuss how to implement one of these, or discuss actual …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    IDE screen designers are fine for data entry forms and the like, but hopeless for artistic or visually-excting games. You'll also see alot of advice here saying that it's better …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    Right, your plea has melted my heart. Here's the simplest eg I can come up with. It adds a background label (z coordinate 0) (just solid yellow, but could be …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Server split message and save data on a text file

    Sorry, no time to digest all that today, but in general... Your "server" is just a place to accept connections and start a client handler thread for each connection. That's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    OK You have to master all the material in that tutorial if you want to work with overlapping ojects. I know it's not easy, but programming isn't easy. Just sit …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    That's got too complicated - you seem to have kept code from each approach you have tried, and it's all in there muddled together. It's definitely time to start again …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Basic ideas cannot understand?

    No problem. Any time you get stuck, we'll be here.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Basic ideas cannot understand?

    > Could someone explain this could with deep detail? line by line? I doubt anyone has the time or motivation to do that. Look at some beginner's tutorials, and come …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java snacktime bot

    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 place button on upper left corner of JFrame with GridBagLayout

    Read the Oracle tutorial http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html in particular, see the comment under `weightx, weighty` about half way down.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in eclipse vs vim

    Programming is 90+% thinking and 10-% typing, at best. I'm the world's worst typist, but it doesn't matter because I use NetBeans that does much of the typing for me, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JDBC

    Do you really think you have given enough information for anyone to know what you have done wrong?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in SQL Execption cannot find database Driver

    This answwer is a bit late for a 3 year old question
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help with 'super' constructors..

    OK, that fits the second solution in my previous post. Initialise hoursWorked to zero by passing zero to the superclass constructor ps `System.out.println(e.toString());` the `toString` is superfluous in println because …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help with 'super' constructors..

    Sounds like you need to supply a value for hoursWorked in the parameters for the constructors for Janitor and Lawyer, then you can pass those values up to the superclass …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Need help with 'super' constructors..

    hoursWorked is defined and initialised in HourlyEmployee. In class Janitor's constructor you have super(name, hoursWorked); now the parameters of a method (or constructor) are evaluated before the method is called, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    With overlapping controls JLayeredPane is the way to go. You use just ONE layered pane, put enerything in that and use the `depth` variables to define which things overlap in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java nullpointer exception from mouse pointer

    So `GameKeys.mouse[0]` is null, meaning you ctreated the array but you didn't initialise its elements. Maybe you just forgot to do that, or maybe one of your events is being …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java swing JButton Problem

    Add ActionListeners to the buttons of the second window.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Adding Controls to a background label, and structuring the source code

    Simply placing components on top of each other in an ordinary JFrame doesn't work. There are (at least) two ways to put controls over a background image: 1. Subclass JPanel …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JoptionPane check conditions

    If you do anything except press OK then the dialog returns a null instead of a String. So you need to assign the returned value to a String and test …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JoptionPane check conditions

    There are lots of ways to do this, here's one that is easy to read... have an `isNumeric` boolean. Start with it true, then set it false in the catch …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Server split message and save data on a text file

    Use a multi-thread client handler as per the Oracle tutorial! Then the client can do wahtever it likes without upsetting the thread where the server socket is listening. Maybe this …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java snacktime bot

    This sounds like a cunning re-phrasing of the classic "Travelling Salesman Problem" with its O(n!) time for a brute force solution. There's a vast amount of info on the TSP, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to implement AVL tree to store words read from input file

    Sounds like either: there's some odd formatting in some of the files that's messing up your parsing or: it's to do with the sort order in which the words appear …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to implement AVL tree to store words read from input file

    There's nothing in that code I can see that would just print "java.lang.NullPointerException". That suggests it's in one of your other methods
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to implement AVL tree to store words read from input file

    That's surprising. Maybe you can re-post the latest code?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to implement AVL tree to store words read from input file

    That's because you carefully told Java not to tell you the line. In your catch block replace System.out.println(e); // just prints the type of error with e.printStackTrace();; // prints everything …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to implement AVL tree to store words read from input file

    NPE mans you have an unitialised variable (it's still null). Catching it doesn't help, you have to find why it's happening and fix it. The exception message tells you the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to implement AVL tree to store words read from input file

    Line 22 you create a brand new new tree for every single word you read.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Array throwing NPE

    I didn't see why that would fail, but have you tried printing `ability` at each of those stages to see where the null creeps in?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in whats wrong with this code

    If you hover on the red flags you should see a proper error message. Please post the complete exact text of the error messages.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Loan Repayments Calculator by Java

    Yes, people here will help - but do read the DaniWeb rules first, especially "Do provide evidence of having done some work yourself if posting questions from school or work …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in value not incrementing in Timer class

    (I just ran your code) - as well as the countdown variable, you also have a problem with `clicked`. You start the "even" timer when clicked == 2, but that …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in value not incrementing in Timer class

    After printing "even" are you clicking twice more to get to the "odd" case? (I notice you don't mention that in your descritpion of the desired functionality)
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in value not incrementing in Timer class

    No. The Timer looks OK. It's the `countdown` variable that looks wrong. Trying printing it inside the Timer's actionPerformed and you'll see what I mean.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in value not incrementing in Timer class

    Countdown starts at 1 and decrements in the timer, but seems never to be reset, so it hits zero exactly once, then continues -1, -2, -3 etc. Keep going 2^32 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in value not incrementing in Timer class

    Is that the desired or the actual behaviour? What's wrong with it?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to create automated code reviewer using java

    Time consuming to program? Yes, very. You'll probably end up with a complete java source code parser plus a raft of individual rule checks - all of which is perfectly …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in value not incrementing in Timer class

    Please give a proper description of what should happen ve what actually happens.

The End.