Noob needing help making first program a netbeans GUI
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Noob needing help making first program a netbeans GUI

  1. #1
    Join Date
    Jun 2017
    Posts
    4

    Noob needing help making first program a netbeans GUI

    Hi folks, Im using Netbeans IDE. Is that JavaEE?

    Not long started teaching myself Java you see.

    This is my first completely self made program.

    Code:
    Scanner scanner = new Scanner(System.in);
            int diff = 0;
            System.out.println("Please choose a difficulty:\nA 1-10 \nB 1-20 \nC 1-100");
            char ch = scanner.next().charAt(0);
            switch (ch) {
                case 'A':
                case 'a':
                    {
                         diff = 10;
                         System.out.println("Difficulty chosen: 1 -  " + diff);
                        break;
                    }  
                case 'B':
                case 'b':
                    {
                     diff = 20;
                        System.out.println("Difficulty chosen: 1 -  " + diff);
                        break;
                    }
                default:
                    {
                         diff = 100;
                        System.out.println("Difficulty chosen: 1 -  " + diff);
                        break;
                        
                    }
                    
            }
            
            System.out.println("Please think of a number.\nPress enter when ready.");
            scanner.nextLine();
             scanner.nextLine();
            Random generator = new Random();
            int y = generator.nextInt(diff)+1;
            System.out.println("\nPlease add " + y);
            scanner.nextLine();
            System.out.println("Please double the number you now have");
            scanner.nextLine();
            int x = generator.nextInt(diff/2)*2;
            System.out.println("Please add " +x);
            scanner.nextLine();
            System.out.println("Please now devide the number you have by two");
            scanner.nextLine();
            System.out.println("Please now subtract " + (x/2));
            scanner.nextLine();
            System.out.println("Please now subtract the \nnumber you originaly thought of");
            scanner.nextLine();
            System.out.println("The number you are now thinking of is " + y);
    It asks the user to think of a number. No input just to think of a number. Then it tries to cancel out and replace that number hopefully without the user realising. A magic numbers mind trick i guess.

    I'm looking to add a gui and have already watched some youtube vids about it but i'm stuck on how to make my program and the new jframe i've been mucking about in work together?

    Total noob, been 3 weeks so far.

    Any help appreciated

    Martin.

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Noob needing help making first program a netbeans GUI

    how to make my program and the new jframe i've been mucking about in work together?
    Can you post the code you are having problems with?
    Do you have any specific java programming questions?
    Norm

  3. #3
    Join Date
    Jun 2017
    Posts
    4

    Re: Noob needing help making first program a netbeans GUI

    Hi Norm,

    The first thing is probably something obvious im missing. Do i just copy the generated code from the Jframe tab into my program code tab?

  4. #4
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Noob needing help making first program a netbeans GUI

    Sorry, I don't know anything about the generated code you are talking about.
    I have never used netbeans
    Norm

  5. #5
    Join Date
    Jun 2017
    Posts
    4

    Re: Noob needing help making first program a netbeans GUI

    Probably out of my depth Norm but thanks anyway.

  6. #6
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,756

    Re: Noob needing help making first program a netbeans GUI

    Norm

  7. #7
    Join Date
    Jun 2017
    Posts
    4

    Re: Noob needing help making first program a netbeans GUI

    No, will check that out right now. Thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)