Search:

Type: Posts; User: Inked.

Search: Search took 0.33 seconds.

  1. Replies
    6
    Views
    84

    [SOLVED] Re: Errors when compiling with an object

    Ahh. I see. Thanks for the information. It looks like I've got everything.
  2. Replies
    6
    Views
    84

    [SOLVED] Re: Errors when compiling with an object

    Duh. Right, I had to modify the class name's mid-progress. I guess I wasn't very thorough with it and didn't change that aswell. Found a few more instances of that problem and fixed them.

    But now...
  3. Replies
    6
    Views
    84

    [SOLVED] Re: Errors when compiling with an object

    Ohhh. Right. That makes sense. That reduced my compiling errors by quite a bit.


    WorkerDemoWilson.java:79: error: cannot find symbol
    ProductionWorkerWilson pw = new...
  4. Replies
    6
    Views
    84

    [SOLVED] Errors when compiling with an object

    Alright, I'm sure the problem I'm having is an oversight on my part but I'm not seeing my mistake.


    WorkerDemoWilson.java:13: error: cannot find symbol
    ProductionWorkerWilson pw1 = new...
  5. Replies
    15
    Views
    28

    [SOLVED] Re: Enforcing a format on a string?

    Great, I got it. Thank you.
  6. Replies
    15
    Views
    28

    [SOLVED] Re: Enforcing a format on a string?

    The errors are:


    Employee.java:105: error: ')' expected
    if(num.charAt(0.isDigit()) && num.charAt(1.isDigit()) && num.charAt(2).isDigit()) && num.charAt(3) = "-")
    ^...
  7. Replies
    15
    Views
    28

    [SOLVED] Re: Enforcing a format on a string?

    Right.

    Here's what I have so far


    if(num.charAt(0.isDigit()) && num.charAt(1.isDigit()) && num.charAt(2).isDigit()) && num.charAt(3) = "-")
    {
    status = false;
    }
    ...
  8. Replies
    15
    Views
    28

    [SOLVED] Re: Enforcing a format on a string?

    It is enough to say that there is an error in the string. It shall throw an exception if there is that explains to the user the correct format that needs to be entered if they enter it wrongly...
  9. Replies
    15
    Views
    28

    [SOLVED] Re: Enforcing a format on a string?

    So should I have 3 separate if statements? One for each of the things I'm checking? How could I go about doing this? (I haven't had much experience with this kind of issue until recently).
  10. Replies
    15
    Views
    28

    [SOLVED] Re: Enforcing a format on a string?

    I can code a loop/if to do the validation, mostly. I just worry with that because, if I were to do Character.isDigit at the index, wouldn't it throw my exception once it got to the - or the B,...
  11. Replies
    15
    Views
    28

    [SOLVED] Re: Enforcing a format on a string?

    The string will be created based on user input, I'll ask them for them to enter it with a reminder of the format. However; as much as I can tell the user it has to be in that format, I need to create...
  12. Replies
    15
    Views
    28

    [SOLVED] Enforcing a format on a string?

    Alright, so let's say I have this string. I want to make it so that the string for this variable has to follow a certain format.

    For example, "AAA-B", where the A's are a digit 0-9, the - is...
  13. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    That works, but it's weird because I thought I had to have the

    JPanel centerPanel = new JPanel();

    For all of them? Because the top and bottom panels are like that and they work aswell. Like,...
  14. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Negative. It's defined, then it creates the panel and sets it center. It adds a label message and then later it's used in a control structure to set the background color depending on what button the...
  15. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    I'm definitely looking at the correct line.

    My print statement is up at line 62, right after the panel is created.

    Edit: Inside my control strucutre right before line 155, it prints null. But...
  16. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Well centerPanel is the only variable on the line. The code I posted was the line in full.

    The only variable on that line is centerPanel, and when printed I get:

    ...
  17. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Line 155 is:


    centerPanel.setBackground(Color.ORANGE);

    centerPanel is definitely created before it's used. The only time it's even mentioned before creation is up in the definitions. With a...
  18. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at ColorFactory$ButtonListener.actionPerformed(ColorFactory.java:155)
    at...
  19. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Right. I had realized it was trying to use the labelMessage before I had it created.

    That wasn't the case for the centerPanel one. But once I changed the labelMessage, it still ran without...
  20. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Haha. Thought I did. Woops.

    They both print null. Both centerPanel and labelMessage.
  21. [SOLVED] Re: Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Edit: I realized that for whatever reason, it was showing the wrong line as line 62.

    My real line 62 is:


    centerPanel.add(labelMessage);

    Going to check for the null now..

    Update: I get...
  22. [SOLVED] Exception in thread "main" java.lang.NullPointerException || Cannot find the problem?

    Alright, so I'm getting this exception when running my program (it compiles fine).


    Exception in thread "main" java.lang.NullPointerException
    at java.awt.Container.addImpl(Container.java:1086)...
Results 1 to 22 of 22