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 .
I'm not a Java expert, so all I can recommend is searching the internet. But you've probably done that
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
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.
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/
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.
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.
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
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
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.
I don't know where you got that code sample. I can't find a "setOnAction" method anywhere in the JButton class. 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!"); } });
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.