How to make a modal frame?

Hello!
My problem is quite simple, but I don't know how to make some MODAL frames (JFrame I mean). In my application, the user can open a same frame even if this frame is already opened and that's not really good.
So, I want the user to close the frame before opening another one.
Can anyone explain me how to do that?

Generally your actionListener will be an internal class of your main frame class. Usually an anonymous internal class. That means it can act on variables in the frame (which is the sensible place to keep the flags).
Something like:
class Class1 extends JDesktop {
boolean itsOpen = false;
openAction.setActionListener(new ActionListener(){
  public void actionPerformed(ActionEvent e) {
    if(!itsOpen) {
       itsOpen = true;
       openAction.setEnabled(false);
       MyInternalFrame newFrame = new MyInternalFrame(Class1.this, ....);
       add(newFrame);
   });You do need some way for the internal frame to act on the variables in the main frame. There are various ways of achieving this.
If we're dealing with a genuine InternalFrame there's a special InternalFrameListener (?) which allows your main frame to listen for the window closing. You can use this instead of hacking the dispose method.
If you're main frame is a JDeskTop then you can use getDesktop() in your internal frame to access it, then cast the result to the real class of your desktop.
Our you can simply add a pointer to your class1 to the contructor of your internal frame class.
You could even get clever and create your own listener system.

Similar Messages

  • How to make an internal frame a modal frame?

    aoa Friends i am trying to make a application using jframe with jdesktoppane and jinternal frame.is there any body who can guide me through that :
    how to make a jinternal frame a modal frame so that if a new jinternalform is opened than the previous one could not be accessed and if new one is closed then we can use that form.

    http://developer.java.sun.com/developer/JDCTechTips/2001/tt1220.html
    This is the example I used approach 2 to simulate a model frame.
    rykk

  • How to make another modal popup window in a modal popup window?

    how to make another modal popup window in a modal popup window?
    two modal windows must be made by inheritance of JDialog.

    the jdialog has constructors where you can set another jdialog as owner. (the same as frame)
    Visit our german java forum at http://www.java-forum.org/de
    An english version will be released soon at http://www.java-forum.org/en

  • How to make a transparent Frame

    How to make a transparent Frame , just like the .NET Frame ??

    Maybe searching the forum using the keywords "+transparent +frame" or "+transparent +jframe" would be a good place to start.

  • How to make a Poster Frame in a Flash 8 Video player

    Hi to all,
    I want to make a poster frame (a simple jpg)
    to display before the FLV video plays.
    So first the user to click the play button or on this poster frame.
    The code below does exactly what I need, but it is in Flash CS4.
    How could I do the same with Flash 8 Pro (ActionScript 2.0)?
    Any help?
    import fl.video.VideoEvent;
    function showPosterFrame(event:Event):void {
        myPoster.visible = true;
    function hidePosterFrame(event:Event):void {
        myPoster.visible = false;
    function playMovie(event:MouseEvent):void {
        myVideo.play();
    myPoster.addEventListener(MouseEvent.CLICK, playMovie);
    myVideo.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, hidePosterFrame);
    myVideo.addEventListener(VideoEvent.COMPLETE, showPosterFrame);
    Iason_K

    are you using an flvplayback component?

  • How to make a Poster Frame to Flash 8 Video

    Hi to all,
    I want to make a poster frame (a simple jpg)
    to display before the FLV video plays.
    So first the user to click the play button or on this poster frame.
    The code below does exactly what I need, but it is in Flash CS4.
    How could I do the same with Flash 8 Pro (ActionScript 2.0)?
    Any help?
    import fl.video.VideoEvent;
    function showPosterFrame(event:Event):void {
        myPoster.visible = true;
    function hidePosterFrame(event:Event):void {
        myPoster.visible = false;
    function playMovie(event:MouseEvent):void {
        myVideo.play();
    myPoster.addEventListener(MouseEvent.CLICK, playMovie);
    myVideo.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, hidePosterFrame);
    myVideo.addEventListener(VideoEvent.COMPLETE, showPosterFrame);
    Iason_K

    are you using an flvplayback component?

  • How to make a still frame of iDVD menu?

    I want to make a DVD label and cover that copy the title menu page. How do I make a still frame that I could manipulate in iPhoto or Photoshop?
    Thanks
    Ashley

    I do this all the time. Turn off motion at a point you like.
    Go into the Applications folder. Find the Utilities folder. Open it. Find Grab. Double-click on it. Go into the Menu, click on Capture and select Selection. Now, drag your cursor across the menu and release. Name and save the image (to your desktop?).
    Open in Photoshop (or Elements). Crop to 4.75 x 4.75 inches for Apple's CD case. Crop to 5.125 x 7.25 inches for DVD case. Print and insert.
    Not exactly "easy," but it works for me.

  • How to make picture inside frame leaving bits of the picture out?

    Hey
    Sorry for the cryptical topic name. What i would like to do is use a frame with a picture so that the part of the picture that is inside the frame is visible and the part that is out of frame is not visible... Can somebody please assist me in accomplishing this? i have the frame and the picture...
    Best regards
    Jesper Pedersen

    Thank you very much, that helped a lot! One last thing... Now that I have made this frame with picture, how do I import it into an .indd document? I have tried making a new photoshop document with transparency and dimensions that fit the image, but how do I copy the frame+picture into the new document? I am having trouble selecting both the frame and the picture...

  • How to make a original frame same with Comment List and Attachment?

    How can I make original frame looking like Comment List?
    I'm using Windows XP and Adobe Acrobat 9 Pro and Acrobat 9 SDK.
    I want to make a new plug-in that use a new frame.
    The new frame is looking like Comment List and Attachment.
    I want to show my original list and input form to the frame.
    It is close to Comment List frame, but I want to show original list.
    Additionally, I want to add new button upper of Comments Button on Navigation Button Panel.
    Can I have any help?

    There is no support in the SDK for adding your own panels.
    There is no support for modifying the existing panels.

  • How to make keyboard modal?

    I have a bunch of text edit fields. When the user clicks on one of them the keyboard comes up. But they can touch on another field before they click the DONE button on the keyboard, then they might be editing two fields. I am currently closing off the edit when another one opens up but is there a simpler way, to make the keyboard entry modal so that no other touches can happen until then?

    Yes, absolutely. There is no limitation as to how many components a JDialog can contain.
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JDialog.html
    In the JDialog's constructor you can pass :
    - the parent JFrame or JDialog,
    - whether the current JDialog is modal
    - its title.
    Then you add components the same than for a JFrame : setContentPane(a Container) or getContentPane().add(...).

  • How to make a modal JWindow

    I want to make my JWindow modal. Any idea????
    Thanks very much..

    Hi,
    I know thats possible through JNI by making calling to the native operating system. I dont know how to do that. If you could give any idea, or sample code, that would be great. Thanks very much....

  • How to make a freeze frame sequence

    title pretty much says it

    I don't know what a freeze frame sequence is. Sounds it is a bunch of freeze frames tied together, or it could be a video that plays for a while and then freezes.
    In the first case you might want to try posterize time, which would make a video jump say 10 frames at a time.
    In the second case, you would move the CTI (Current Time Indicator) to the point when you want to freeze the frame and then go to Layer > Time > Freeze Frame.
    If a freeze frame sequence is something else please give us an accurate description or example.

  • How to make awt modal dialog to NOT appear on top of existing windows

    Hi,
    I am working on a program that displays awt modal dialog box when it needs some action from the user. My problem is that the modal dialog box cann't be top window as there is one VC++ window that needs to be always top window. Another requirement I must satisfay is that there should not be any flickling. I've tried with setAlowaysOnTop(false), dialog.toBack(), transferFocus(), etc but with no avail. Any help will be greatly appreciated. Thank you in advance.

    Note: This thread was originally posted in the Swing forum, but moved to this forum for closer topic alignment.

  • How to make clip "skip" frames?

    I have a clip I would like to move jerkily, in other words, repeat a given frame 3 times, then skip the next two frames and repeat the third frame three times, etc., etc. What's the best way to accomplish this (without doing freeze frames manually)?

    I could only think of one way... Export the clip as a QT Pro movie self contained and then Export from QT as a "Movie to Image Sequence". Then go in and Duplicate twice the frames you want to repeat. Its easy to delete the frames you don't want. When finished with this arduous task then you Open the Image Sequence back to QT and then import back to FCE. I'm glad you are doing it and not I. If one were an expert in AppleScript I guess you could write a script to do the Duplicate and Delete operations on the appropirately numbered frames (files). But I am not so I did it manually.
    Incidentally I tried it on a very small clip (about 27 frames) and it didn't look very jumpy to me.

  • Does anybody know how to make a modal JFrame?

    Thanks

    Hi, Thanks, but I don't want to use Dialogs since I ned to change the appearance of the "Message title" - color background and the close button. That is why I want to use a JFrame.

Maybe you are looking for

  • SUB TOTALS  IN ALV

    The below code is  giving the wrong result...how can i get   SUBTOTALS LIFNR WISE AND  THEN SUBTOTALS  BUKRS WISE.................................... SELECT BUKRS LIFNR GJAHR BELNR BUDAT BLDAT WAERS DMBTR WRBTR SGTXT SHKZG BLART XBLNR HKONT PRCTR FRO

  • Prepping a Sequence for Web/and EXporT

    Any link or answer to this- i'm preparing a 2 minute trailer for web. what are the settings necessary in final cut to prepare for the quicktime export. Also once in a quicktime format what should the export settings coming out. currently have final c

  • What is the maximum temperature for a macbook generic processor to operate?

    Right now the temperature for my cpu is 185 degrees Fahrenheit. Is that bad? Whats the highest temperature a Macbook can properly operate?

  • Sql Monitor is not working for forms10g

    Hi All, Sql Monitor is not working for forms10g.How can i solve this problems. Regards Gopinath M

  • Download folder not working, how do I fix this?

    I am computer-dumb. But I use one, and need to figure this problem out. When I open an email that has a word attachment or something, I used to just click on it, and my downloads folder would appear and I would open the document from the downloads fo