Win a copy of Java Challengers this week in the Java in General forum!

wayne whitman

Greenhorn
+ Follow
since Sep 14, 2008
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by wayne whitman

Hi All. I'm having a timer problem maybe someone can explain to me. In the following code, I am attempting to execute setRIPTrip() once every 2 seconds. What happens is it gets executed only once. What can be wrong here?



Thanks!
12 years ago
I'm really feeling like a greenhorn now. I reread some of the Swing tutorial to try and understand this better.
Made a little progress. Took the following example from the Sun Swing tutorial. Looked like a good approach.
When I tried using this approach in my code, I keep getting "is not abstract and does not override abstract method..." error at the worker = new SwingWorker() { line.
The funny thing is when I compile the example source on the command line, it compiles ok, but when I put it into a class as an example project in NetBeans, it gets the same error as when I try to incorporate it into my code.
Can anyone explain what is going on?
Why does the example compile on the command line ok, but gives the override abstract method error when you put the same code into NetBeans? (I only left out the Swing component code from the example)

Thanks for your advice, again!



12 years ago
Thanks Pete - I'm rethinking the approach. But I do see examples in the Swing tutorial using .start() to invoke the background thread.

I'll keep working on it.
12 years ago
Thanks folks, you must be correct about the thread, but I can't see why it's not executing in the worker thread.

Here's the calling code:


The playAudio ultimately tries to write to a sourceDataLine.
12 years ago
Java newbie here with a worker thread problem.

I'm trying to receive streaming audio via UPD and when the program enters the for loop in the worker thread, it hangs and the event thread becomes unresponsive.
If I comment out the for loop, all is ok. Commenting out the audioPlayer line with the for loop uncommented makes no difference as long as the for loop is there. It seems like something with the loop itself.

Shouldn't I be able to run a long loop in the worker thread without disrupting the event thread?



Any advice appreciated and thanks!
12 years ago
Ok, I'm a Java/Swing newbie, so can anyone tell me why this panel displays transparent when I run the application that calls it? The main gui comes up opaque.

public void displayRIP(byte[] response) {
JFrame rip = new JFrame("RIP Display");
rip.getContentPane().setLayout(new FlowLayout());
rip.setSize(400,200);

JPanel display = new JPanel();
display.setSize(400,200);
rip.getContentPane().add(display);

display.setOpaque(true);

JTextField tf0;
tf0 = new JTextField(8);
JTextField tf1;
tf1 = new JTextField(8);

rip.setVisible(true);
display.setVisible(true);

Thanks for any help!
12 years ago
Thanks Mark. See, it really was a newbie question as this is my first Java program and I was not aware of that tutorial.
Should be able to solve it from here.
Hi All - I have a desktop application that needs to respond to user input at all times. But, it also connects to an internet device where it needs to receive streaming audio. The problem I am having is how to code the program so it will respond to user commands via the gui at any time, but still receive the streaming audio from the internet device at the same time. I tried putting the streaming audio reception in a separate thread, but that doesn't work. The program either runs one thread or the other and since the streaming audio is continuous, it never goes back to the gui thread.

Any ideas welcomed and thanks!
Does anyone know any way to feed a sound source into JMF other than from a file or an IP url? I would like to feed it with a byte array since the source I receive from has a non-RTP header and I need to strip that off before feeding it to JMF.

Any ideas? Thanks!

waynew
12 years ago
Hello all. I am working on a program that needs to receive and send UPD datapackets which contain RTP audio, from/to an internet appliance. Once I receive the packet (this part is working) I need to strip off the non-RTP header, then playback the audio.

What to use? I can't see in any of the doc that Java Sound supports RTP, and the all Java version of JMF doesn't seem to support audio capture for sending to the appliance.
Must be all Java as this will be a multi-platform program.

Any pointers? Glad I found the friendly JavaRanch, after the notSoFriendly BIG Java forum. Thanks for any tips.
12 years ago