Nathan Tibbitts

Greenhorn
+ Follow
since Apr 25, 2017
Nathan likes ...
Eclipse IDE Linux Python
Behind You
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nathan Tibbitts



To replicate:
1. Put this code in a file called MiniMusicCmdLine.java
2. run javac MiniMusicCmdLine.java
3. get no errors
4. run java MiniMusicCmdLine
5. NOTHING

As you can see, I get NO errors from the compiler. I, however, get no feedback from running it. The code is from HeadFirst Java 2nd Edition 2005. Page 346. Sorry if my style is not very good.
1 month ago

Henry Wong wrote:You forgot to close the "if" block, hence, the "else" can't be matched to an "if".

Henry


I closed the If block using a curly brace. }
It still shows up with an error giving no other token besides syntax error on token "else". delete this token.
1 year ago
The only thing in this code that is getting errors is else.
Why?

1 year ago

Liutauras Vilda wrote:

Nathan Tibbitts wrote:I just want to know what to do to make this code active(Meaning to actually do something!)


Probably start from describing to community what do you want this code to do, rather than do something.

What your program is meant to do?


I'd like the button labeled test to close the program.
I'd like the button labeled A1 to display a shape and rotate it.
B1 to play a .wav file.
And C1 to change its label based off of the number of ticks.
Just need help adding the labels.
2 years ago
I just want to know what to do to make this code active(Meaning to actually do something!) Do I add a listener for every single button? Thanks!
Here's the code:
2 years ago

Hey, I click the button and NOTHING Happens. Even though I implemented the listener. There are no compiling errors.
2 years ago
I am afraid that is a good example of how not to do it. If you manage to get that code to compile with the class and interface names the same …
you are making the same design mistake as before. A display class shou‍ld be used for display. A Listener class shou‍ld be used for listening. You will get horrible non‑object‑oriented code like that, with a large actionPerformed method and lots of if statements. DT showed you very nicely how to implement individual Listeners for each button. You would require a method for each distinct action and you can then simply write What does the letter e in this code represent?
2 years ago
I did all the things, now the only error is
2 years ago

John Joe wrote:You need to implements ActionListener to your class


So, how would I do that?
2 years ago
The Error code is: Exception in thread "main" java.lang.ClassCastException: SimpleGUI1b cannot be cast to java.awt.event.ActionListener
at SimpleGUI1b.go(SimpleGUI1b.java:16)
at SimpleGUI1b.main(SimpleGUI1b.java:7)

2 years ago

Hey, just wondering, but this code seems valid in Eclipse, yet it is giving me the Error "Timing cannot be resolved to a variable. myMidiEvent cannot be resolved to a variable." Thing is, I copied the code from Head First Java completely.
2 years ago

This Java is really weird. My compiler recognizes that Javax.sound is a valid type/object(Not sure which!) The problem is it doesnt recognize Sequencer, Sequence, MidiSystem.getSequencer(). It treats createTrack() as a variable too. Help!
2 years ago