How to put a JFrame on the top of all other applications

when some message is received, I want to put an existing JFrame on the top of all other applications. So that the user knows that some message has arrived.
I tried toFront(), but it blinks the JFrame on the taskbar never comes on the top of other application.
Any ideas.
Rajesh

On Windows 98 the toFront() method works, but maybe not exactly how you expected.
There seems to be a delay of about 20 seconds.
If your frame has not been active within the last twenty seconds then the frame is displayed when the toFront() is used.
If the frame has been active within the last 20 seconds then the icon will flash.
I believe this behaviour is to prevent frames from poping up all the time. Here is a simple program that shows this behaviour:
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import javax.swing.*;
public class FrameToFront
    public static void main(String[] args)
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        frame.setSize(200, 200);
        frame.setLocationRelativeTo( null );
        frame.setVisible(true);
        int delay = Integer.parseInt(args[0]);
        final Timer timer = new Timer(delay, new ActionListener()
            public void actionPerformed(ActionEvent e)
                System.out.println(new Date());
                frame.toFront();
        timer.start();
}After you start the program click on the dos window to hide the frame. Try the following two cases:
java FrameToFront 5000
java FrameToFront 20000

Similar Messages

  • How to put JTable checkbox on the top of its cell

    my JTable only had 2 columns, one data type is boolean, display as checkbox, one data type is String,cell Renderer is JTextPane which data had large size ,and each row had different height depended on data size.
    now the checkbox is displayed at the centre of each row, i hope it can be displayed on the top of this row, how i can set it. please help guide.
    Many Thanks
    Susan

    Camickr,you are excellant, it's resolved as you said as following:
    private JTable tblMain = new JTable(){
            public Component prepareRenderer(
                TableCellRenderer renderer, int row, int column) {
                Component c = super.prepareRenderer(renderer, row, column);
                if (c instanceof JCheckBox)
                    ( (JCheckBox) c).setVerticalAlignment(JCheckBox.TOP);
                return c;
            public Component prepareEditor(
                TableCellEditor editor, int row, int column) {
                Component c = super.prepareEditor(editor, row, column);
                if (c instanceof JCheckBox){
                    ( (JCheckBox) c).setVerticalAlignment(JCheckBox.TOP);
                    c.setBackground(Color.white);
                return c;
        };

  • How to make a jframe or jdialog on top of all other applications

    I just want to know if there a way to make a jframe or jdialog on top of an application like games?
    Thanks in advance...

    Try searching the forum?

  • How 2 put desktop widget in the background?

    i have managed to put widget on the desktop from the dashboard. now i want to know...
    a) how to put the widget in the background? it remains on top all the time.
    b) how to have 'space' specific widgets. right now all of them appear in all spaces.
    thanks
    Neerav

    haha! i thought it was a hidden secret until google told be otherwise.
    btw, i am not sure if u understand my question. i want the widgets to stay on the desktop but not on top of all other applications. it should come on top only when i select it.
    rebooting still maintains the widgets i transfered to the desktop to stay there, which is good, but, they always remain on top, which i don't want.
    Neerav

  • When I open a link from another website ForeFox puts a messagge at the top of the new link saying that it has blocked the websiste from transferring me to a new

    When I open a link for another website Firefox opens a new tab but puts a line on the top of the new page saying that Firefox has blocked the website from transferring me to another page.
    I have to press ALLOW before Firefox will open the new page.
    How can I solve this problem.
    Many thanks in advance.

    hello betth007, in order to get effective help, please open a new question at https://support.mozilla.org/en-US/questions/new instead and include a bit more details about your issue (what kind of error message are you getting, etc.). thank you!

  • HOW TO PUT MOVIES BACK IN THE CLOUD ON IPAD

    HOW TO PUT MOVIES BACK IN THE CLOUD ON IPAD

    You can't put films in the cloud yourself, whether they will show in the cloud for redownloading depends upon what country that you are in, if the rights-holder allows redownloading, and if the film remains in your country's store. You can delete a film from your iPad via the Edit button at the top right of the film select ion screen in the Videos app or via Settings > General > Usage > Videos (that should also give you an Edit button top right of the screen or you can swipe/drag across a film form right-to-left) - but the film might not then show in the cloud for redownloading. If you haven't already done so you should connect the iPad to your computer's iTunes and do File > Devices > Transfer Purchases so that you can take your own backup copy of your downloads (apps, ibooks etc could also be removed from the store and not be redownloadable in the future).

  • How to create a title over the top of the left-most column in a cross-tab.

    This is one of those things that seems simple until you try it.
    I'm almost there.  I moved the cross-tab from the report header to the report footer so I can have a page title.  I tried using an overlay but it didn't work for any page past the first.
    I can't seem to figure out how to put a title over the left-most column though.
    Thanks in advance,
    J

    I have used a text box, after you type in the text, select the box, and move it to the front.
    then select the crosstab and move it to the back.

  • HOW TO PUT TWO PANNEL IN THE SAME PAGE

    HI ALL
    I NEED TO KNOW HOW TO PUT TWO PANNEL IN THE SAME PAGE TO FULLY UTILIZE FULL PAGE AREA BECAUSE THE PANNEL WIDTH IS TOO SMALL , SO I WANT TO MAKE THE PAPER CONTAIN TO PANNELS VERTICALLY.
    THANK YOU

    So Barb,
    I like to use multiple desktops and move back and forth between then using gestures. At the moment I have 5 open: Chrome, Firefox, Safari, Photoshop CS 6 and a desktop. I use "gestures" to navigate between them:
    Mac Basics: Multi-Touch gestures - Apple Support
    and I use Mission Control (F3) to move the various desktops around in the order I want them.
    Mac Basics: Mission Control - Apple Support
    So say I'm searching for a photo to open in CS 6, I find it on the open desktop then hit select "open" in CS 6 and go to that folder in the select pane.
    Even right now I'm typing this in Safari and "gesturing" back to Chrome where I did the search about multi touch and mission control. I drag copy the URL there  and gestured back here to paste the URL into this text.
    If you did a lot of photo searches, I set professional clients of mine in Chicago up with dual monitors (In this case you'd have an external monitor on extended desktop.). So all you need to do is just glance over at the second monitor slide your cursor over there open stuff up find your photo and go back to Photoshop and open it up.
    Hope this helps.

  • How can put photo comment in Facebook in safari or other browser, am using ipad 4 and this was working perfectly but unfortunately it's not working now..the attach photo feature is there but can't attach, please help me in this

    How can put photo comment in Facebook in safari or other browser, am using ipad 4 and this was working perfectly but unfortunately it's not working now..the attach photo feature is there but can't attach, please help me in this

    How can put photo comment in Facebook in safari or other browser, am using ipad 4 and this was working perfectly but unfortunately it's not working now..the attach photo feature is there but can't attach, please help me in this

  • How to put dead notes on the guitar software instrumet??

    How to put dead notes on the guitar software instrumet??

    a dead note is when you mute the chords, like on the smells like teen spirit riff

  • Could you please tell me how to delete a bookmark on the top of page (it has a space for four bookmarks). Thanks

    Could you please tell me how to delete a bookmark on the top of page (it has a space for four bookmarks). Thanks

    To delete a bookmark from your bookmark toolbar, point at the bookmark with your mouse or trackpad, then right-click on it (press the right-hand button on your mouse or trackpad) and choose "Delete" from the pop-up menu.
    For other ways of deleting bookmarks, see '''[[Deleting Bookmarks]]'''.

  • How to get Drafts Mailbox at the top rather than in ON MY MAC

    My wife is switching from Entourage to Mail and I can't get her set up the same as I have been in Mail for years. At the top of the left panel I have Inbox, Drafts, Sent and Trash, with sub listings for each of my mail accounts, followed by SMART MAILBOXES and ON MY MAC. My wife has the same except for the Drafts and its sub listings. Instead, she has several Drafts Mailboxes (1 for each email account) under ON MY MAC. How do I get Drafts at the top as I have it?

    Then it may be that by some action, some existing Drafts mailboxes were found, and Mail moved them to the On My Mac section.
    Has she yet in Mail composed a message, clicked on Save as Draft before sending, and checked to see if that has been saved in newly created Draft mailbox in the location you expected?
    Ernie

  • How to put a check with the date

    Hi,
    I have created a ztable with 3 fields .
    clientcode(3),
    date,--date geneated
    version--- fileversion
    i need to update this table everytime i execute the data. Every time version shd get incremented when i execute the program.  When i excute the program next day version shd be updated by '1'.
    i wrote the code for version updated i'm not getting the logic how to put a check with the date.
      SELECT *
       FROM zfi_enetflver
       INTO TABLE gt_flver.
      SORT gt_flver DESCENDING.
      CLEAR: gv_dt, v_file.
      CONCATENATE sy-datum6(2) sy-datum4(2) INTO gv_dt.
      READ TABLE gt_flver WITH KEY client_code = gv_clcd.
      IF sy-subrc = 0.
        idx = sy-tabix.
        IF gt_flver-zdate = ' '.
          gt_flver-zdate = sy-datum.
        ENDIF.
        IF gt_flver-version = ' '.
          gt_flver-version = '001'.
          gv_filever = gt_flver-version.
          MODIFY gt_flver INDEX idx TRANSPORTING zdate version.
          MODIFY zfi_enetflver FROM TABLE gt_flver. "TRANSPORTING version.
          CONCATENATE 'E:\' 'ENET\' gv_clcd gv_dt '.' gt_flver-version INTO v_file.
        ELSE.
          gt_flver-version = gt_flver-version + 1.
          gv_filever = gt_flver-version.
          MODIFY gt_flver INDEX idx TRANSPORTING version.
          MODIFY zfi_enetflver FROM TABLE gt_flver .
          CONCATENATE 'E:\' 'ENET\' gv_clcd gv_dt '.' gt_flver-version INTO v_file.
        ENDIF.
      ENDIF.
    clientcode is the key field in ztable do i need to make date field key ??
    please help me with the logic

    You need to implement below logic:
    1. check if field_date = sy-datum. in this case do nothing.
    2. else . move sy-datum to field_date .
    3. modify your internal table with field_date .
    4. populate final table to database table .
    hope you get it.

  • How can I script a Flash .exe file to always stay on top of all other windows?

    Hi All,
    I'm new to action script, and I just need this one script
    > How can I script a Flash .exe file to always stay on top of
    all other windows?
    Basically what i want to do is have a flash-created
    step-by-step instructional movie, but for the movie to remain on
    top of all windows so the instructee is able to follow the
    instructions on-screen...
    It would be preferable to not have to buy another product
    just to do this... as I said, this is the only scripting I need.
    Thanks in advance
    Cheers
    Rick

    if you create your exe with mProjector you can use one of its
    new AS
    commands to do this.
    setZOrder
    http://www.screentime.com/software/mprojector/docs/mWin_setZOrder.htm
    all APIS
    http://www.screentime.com/software/mprojector/docs/index.html
    Demo
    http://www.screentime.com/software/mprojector/demo.html
    mProjector installs new classes and help into Flash, to
    enable them you
    must build your app with mProjector (its input is your swf)
    John Pattenden
    Screentime Media - Flash Tools since 1997
    http://www.screentime.com

  • In iphoto, when I go to events on the top bar, all the options come up in grey so I can't create a new event. I did one a while ago but ever since, have had this problem. Anyone got a solution or know why this happened?

    In iPhoto when I go to Events on the top bar, all the options appear in grey so I can't create a new event. I did it once a while ago but have not been able to since, Anyone know why this should happen and how to solve it?

    'tis all good right now, just checked on another post dealing with the smae problem, unfortunatley i was forced to downgrade to GB 2.0 but hey, it's only until i can find the iLife '06 DVD.

Maybe you are looking for

  • Xorg 6.8 and dual head setup

    Hello, I have a laptop with an ATI 9600 mobile chip which ran in xinerama mode fine for the previous release of xrog or xfrree86 but with the new xorg reslease 6.8 I can no longer run 2 monitors. It will run fine in single head mode, but it will no l

  • Fan Speed & internal Temperatur​e of 600-1170a

    Hi There, I have an all in one desktop PC, Model is 600-1170a, Product Number is: VT558AA-ABG, OS is win7 home Premium Pack 1. it restarts itself after continuous running for several hours, I installed SpeedFan v4.50 software and found speed of fan2

  • R12 upgrade testing

    Hi all, We have upgraded from 11.5.10.2 to  R12 (12.1.3) on linux platform (rhel 4.6 to 6.2) Can any one suggest what testing(technical) we have to go through after the R12 upgrade has been done. Thanks

  • ALV grid - Disabling options

    Hi, I have a question on the ALV grid. In the ALV grid, there is the button - EXPORT under which the following options are available:- - Spreadsheet - Word Processing - Local File - Send... I just want to whether it is possible to remove the 'Send' o

  • R 12 on windows 2008 - RDBMS

    R 12 - production running on Windows 2008 - 32-bit, installed in Dec' 2011. There is huge files are generating in this RDBMS location and it occupied 146GB space sine 26th Jan 2012. What could be the reason and how to resolve this issue. Please help