Java homework help please :(

Discussion in 'Miscellaneous' started by britbrit3197, Apr 15, 2014.

  1. I dont usually ask for homework help but im having trouble with my java homework. So if anyone knows java and arrays + ComboBoxes + GUI's can you send me a PM to help me :( .
  2. I'm not a Java expert, so all I can recommend is searching the internet. But you've probably done that :p
    technologygeek likes this.
  3. Sorry I never mess with GUI apps :(
    mba2012 and SoulPunisher like this.
  4. good their crap ._.

    I need to make on so that ppl can pick 1 - 11 and hit the vote button then it displays how many ppl voted for what. if this was C++ it would be much easier

    EDIT: What do you use to compile with, im using TextPad and its complete crap xD
    mba2012 and PandasEatRamen like this.
  5. What? You get homework about java? :o
  6. College :)
  7. Well, that's better than WWII in my opinion :p I can't help you though I think :rolleyes:
  8. Use IntelliJ IDEA :3
  9. Maven is the industry best practice for Compiling, but for editting/project management: http://www.jetbrains.com/idea/

    is single handedly the best java IDE.
    SoulPunisher likes this.
  10. See Brit? And you were afraid to ask. You're getting help \o3o/
    maxthegreat2 likes this.
  11. but im not getting any help. Why you in this thread the only java you know is a coffee
    607, mba2012, maxthegreat2 and 5 others like this.
  12. The Oracle website has excellent documentation for it, and I have a pdf book somewhere on my hard drive that explains how to use arrays and I believe i saw some GUI stuff in there too, as soon as I find it i'll post the title here. its free :)
    I do know where i got it though. its http://it-ebooks-search.info/
  13. That sounds like something that can be done in 2 minutes with C#..

    I hate it when people think that every language is good for everything.
    607 likes this.
  14. It can be done in java in 2 minutes too if you know the system.

    Getting to know the systems GUI interaction is going to be roughly the same in Java vs C#.

    Someone who's only done backend application development in C# is going to have the same learning hurdle for developing GUI's as brit is with java.
    SoulPunisher likes this.
  15. If you knew and mastered both languages, which would you choose for this?
  16. well i know C++ its way easier than Java for me, i think my problem with Java is I have no examples and my teacher is online class only and she never helps. When I turn in my work she gives me my grade but doesnt tell me whats wrong with it and how to correct it so pretty much i dont know what mistakes im making so im just gonna make them over and over again :(

    EDIT: I actually got the Gui to work (i dont know how) but its the whole CLICK A BUTTON and it counts the vote im not getting.

    The teacher wants it a certain way but to me this is stupid and I could do this a whole lot easier my way
    607 likes this.
  17. Generally GUI controls register and match back to an event handler to run when clicked.
    Very similar capabilities, but java runs everywhere which c# doesn't
    SoulPunisher likes this.
  18. To get a button press, use something like this:
    Code:
    btn.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent event) {
                    System.out.println("Hello World!");
                }
            });
    btn is the name of the button you created. The code for the button goes in the function. I copied and pasted this from the default template in netbeans although I have done some gui stuff before on fx. I am guessing that some kind method for getting information from a combobox would go in the function from above.
  19. I don't know where you got that code sample. I can't find a "setOnAction" method anywhere in the JButton class. :confused:

    To respond to a button click, call the "addActionListener()" method (at least, this is how I do it):

    Code:
    JButton button = new JButton("Click me");
    button.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        JOptionPane.showMessageDialog(null, "I've been clicked!");
      }
    });
    
    607 likes this.
  20. TextPad seems pretty nice. On Windows, I like to use Notepad++. I would avoid using an IDE like Intellij if you are new to Java. They are very powerful, but take time to learn. :)

    Shameless plug: Check out my EMC Shopkeeper program if you want to see how a Java GUI app is made. ;)