Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

working in background

Thread view: 
dvdsum - 05 Apr 2007 22:33 GMT
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!
Knute Johnson - 06 Apr 2007 00:30 GMT
> Hello, excuse me for my terrible english.
>
[quoted text clipped - 6 lines]
> 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.

Signature

Knute Johnson
email s/nospam/knute/

Andrew Thompson - 06 Apr 2007 03:22 GMT
..
>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

Signature

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

sakina kapasi - 06 Apr 2007 06:23 GMT
> .
>
[quoted text clipped - 4 lines]
> >..the does the background processing and when it is
> >finished open up a dialog

> >..with your message.
>
[quoted text clipped - 6 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200704/1

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
dvdsum - 06 Apr 2007 08:58 GMT
Thank you, these are good solutions!
dvdsum - 06 May 2007 13:38 GMT
> > .
>
[quoted text clipped - 46 lines]
>
> - 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.
Andrew Thompson - 06 May 2007 14:11 GMT
...
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

Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.