working in background

D

dvdsum

Hello, excuse me for my terrible english.

I've written a java application that works in background. It search
for a specific file until find it. During this search I'd like to do
other things (internet, email, etc...). However, I want to be advised
when my application have found this file, for example either a sound
could be produced or a message dialog that is shown in front of all
windows visualized on the screen. The second solution is better for
me. How can I do this in java?
Thank you very much!
 
K

Knute Johnson

dvdsum said:
Hello, excuse me for my terrible english.

I've written a java application that works in background. It search
for a specific file until find it. During this search I'd like to do
other things (internet, email, etc...). However, I want to be advised
when my application have found this file, for example either a sound
could be produced or a message dialog that is shown in front of all
windows visualized on the screen. The second solution is better for
me. How can I do this in java?
Thank you very much!

Start another thread the does the background processing and when it is
finished open up a dialog with your message.
 
A

Andrew Thompson

Knute Johnson wrote:
..
Start another thread ..

(class - java.lang.Thread)
..the does the background processing and when it is
finished open up a dialog

If using AWT, that would be a java.awt.Dialog,
for Swing based applications, a javax.swing.JDialog,
or (I would usually use*) a javax.swing.JOptionPane,
would be the best classes to look at.
..with your message.

(* JOptionPane makes displaying a simple message, easy.)

HTH

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200704/1
 
S

sakina kapasi

Knute Johnson wrote:

.


(class - java.lang.Thread)



(* JOptionPane makes displaying a simple message, easy.)

HTH



Well i had developen a sismilar application long back ...
it was an alarm system .
whenever an alarm triggered i had to pop up a message on the screen
and play a sond

i had achived it with dialog in awt..

public void optionPane(String message,Component c)
{
JOptionPane optionPane = new JOptionPane(message,
JOptionPane.PLAIN_MESSAGE);
optionPane.setOpaque(false);
final JDialog dialog = optionPane.createDialog(c,
" Image Uploader");
dialog.setVisible(true);

}




for audio i had used AudioClip (applet class)

import java.applet.*;
AudioClip ac = getAudioClip(getCodeBase(), soundFile);
ac.play(); //play once
ac.stop(); //stop playing
ac.loop(); //play continuously


also we have sun api for playing sound...
check this out .. http://www.javaworld.com/javaworld/javatips/jw-javatip24.html
 
D

dvdsum

Well i had developen a sismilar application long back ...
it was an alarm system .
whenever an alarm triggered i had to pop up a message on the screen
and play a sond

i had achived it with dialog in awt..

public void optionPane(String message,Component c)
{
JOptionPane optionPane = new JOptionPane(message,
JOptionPane.PLAIN_MESSAGE);
optionPane.setOpaque(false);
final JDialog dialog = optionPane.createDialog(c,
" Image Uploader");
dialog.setVisible(true);

}

for audio i had used AudioClip (applet class)

import java.applet.*;
AudioClip ac = getAudioClip(getCodeBase(), soundFile);
ac.play(); //play once
ac.stop(); //stop playing
ac.loop(); //play continuously

also we have sun api for playing sound...
check this out ..http://www.javaworld.com/javaworld/javatips/jw-javatip24.html- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

How can I do to achieve a windows that behaves like Task Manager for
Windows? It's always in front of every windows even though I change
focus on other application.
 
A

Andrew Thompson

dvdsum wrote:
...
Note that starting a new thread with a subject like
"always in front of every windows" would make
more sense. Please start a new subject in future.
How can I do to achieve a windows that behaves like Task Manager for
Windows? It's always in front of every windows even though I change
focus on other application.

..but since we're here.

<sscce>
import java.awt.*;
import javax.swing.*;

class AlwaysOnTop {

public static void main(String args[]) {
for (int ii=0; ii<8; ii++) {
JFrame f = new JFrame("Frame " + (ii+1) );
f.setLocation( ii*20,ii*10 );
f.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE );
f.setSize( 250,100 );
f.getContentPane().setBackground(
new Color(255-(ii*10), ii*30, 255) );
f.setVisible(true);
if (ii%2==0) {
// the important bit..
f.setAlwaysOnTop(true);
f.setTitle( f.getTitle() + " - ON TOP!" );
f.setDefaultCloseOperation(
JFrame.DISPOSE_ON_CLOSE );
}
}
}
}
</sscce>

HTH

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200705/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,353
Latest member
RogerDoger

Latest Threads

Top