What event will be fired if clicked on top right button of JFrame?

HI!
I meet a issue when I developing java GUI application.
I found when I clicked on top right button x of JFrame . It fire an event windowClosing(event e)
If I clicked on JButtom and try to close this JFrame . It fire an event windowClosed(WindowEvent e)
        j.setVisible(false);
        j.dispose();
        j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);Is anyway I could fire same event when clicked on either +top right button x+ of JFrame or JButtom ?
amazing!?
Thanks!

camickr,
NO, you fully understood my question, but also solve it already... you are correct
clicked on top right button of JFrame and close button are fired on same event.... private void this_windowClosing(WindowEvent e)
1)clicked on close button fired windowClosing event byWindowEvent windowClosing = new WindowEvent(j, WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(windowClosing);
2)clicked on top right button of JFrame it fired windowClosing eventI just want an assist to run j.dispose();, will it must fire windowClosed event? anyway to avoid this event?
May be my explain not clear!

Similar Messages

  • Video of Some Events Will Not Play in Window at Top Right

    Some of my events that show on the bottom half of the screen do not appear at all in the top right video block when they are playing, no matter whether I try to play them from the bottom half or if I first stick them into a project. Other events from the same camcorder work just fine.
    Any thoughts would be much appreciated.

    Some thoughts in random order
    1. Do you see a yellow triangle by the event name?
    2. Have you tried rebooting your Mac?
    3. Have you moved any events in the Finder?
    4. Do the event names have any odd characters like : or /?
    5. What kind of clips are these? What kind of camcorder?
    6. Has iMovie asked you to optimize clips?

  • What event will be triggered by check button on ALV?

    Hi,
    What event will be triggered by the standard check button on ALV? ON_DATA_CHECK is only triggered by a change in an editable field on ALV, so if no change were made, ON_DATA_CHECK wouldn't be triggered. I also tried events for before and after standard function but neither were triggered. How can I use the standard check function?
    Regards,
    ts

    Hi ts,
    The event ON_DATA_CHECK would trigger only if the content on alv is dirtly i.e. user modified something.
    If there are no changes done for the contents, whats your requirement to use check button?
    You can create a custom alv toolbar button and use event ON_FUNCTION on click of tool bar button.
    Regards,
    Rama

  • Which event will be fired when I after set JFrame.setVisible(false)

    Experts.
    I want to know which event will be fired when I after set JFrame.setVisible(false)?
    Because I need to check a thread is finished it job or not.
    I have checked windowClosing event, but it doesn't work.
    Thanks
    Francis

    Oh....
    Sorry, I find it will fired on componentHidden event.
    Very sorry.

  • Fire a left click when the right button is pressed

    I am working on a small program with a text area and mouse functionality. I have all my listeners in place but I need one additional feature and I am unsure how to go about implementing it. I want to be able to fire a left click when the right button is pressed.
    The reason is because right clicking does not move the caret around the text area. I need to be able to move the caret with a right click so I can then invoke another method to do some other functionality that is associated with the right click. Any method is acceptable as long as a right click will result in the caret being able to move to a location much like a left click can.
    all help is appreciated. Thanks.

    I'm not sure if this is "better", and my guess is that it isn't, but how about using a Robot object here to create a left mouse press and release? For instance,
    import java.awt.AWTException;
    import java.awt.Robot;
    import java.awt.event.InputEvent;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JComponent;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class RightClickAsLeft
      private JPanel mainPanel = new JPanel();
      private JTextArea area = new JTextArea(20, 50);
      private Robot robot;
      public RightClickAsLeft()
        try
          robot = new Robot();
        catch (AWTException e)
          // TODO Auto-generated catch block
          e.printStackTrace();
        mainPanel.add(new JScrollPane(area));
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 18; i++)
          for (int j = 0; j < 80; j++)
            sb.append((char)(40 + j));
          sb.append("\n");
        area.setText(sb.toString());
        area.addMouseListener(new MyMouseListener());
      public JComponent getComponent()
        return mainPanel;
      private class MyMouseListener extends MouseAdapter
        @Override
        public void mouseClicked(MouseEvent e)
          int button = e.getButton();
          if (button == MouseEvent.BUTTON3)
            if (robot != null)
              robot.mousePress(InputEvent.BUTTON1_MASK);
              robot.mouseRelease(InputEvent.BUTTON1_MASK);
      private static void createAndShowUI()
        JFrame frame = new JFrame("RightClickAsLeft");
        frame.getContentPane().add(new RightClickAsLeft().getComponent());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
          public void run()
            createAndShowUI();
    }Edited by: Encephalopathic on Apr 10, 2009 9:59 AM

  • My phone just turned off and will not go back on. my top lock button has been broken for over a year. Help!

    my phone just turned off and will not go back on. my top lock button has been broken for over a year. Help! I have tried plugging it into wall unit and computer but my home button just doesnt do anything!

    It seems that year long delay from having your lock button repaired has finally caught up to you.  Sounds like you have some damage to your phone that requires repair/replacement.  Take it to a Apple store or contact Apple Tech Support.

  • HT1222 I started the lastest iPhone 5s software update then my phone just shut down and will not turn back on. I've tried the home button, the button plus the top right button together for 20 sec, plug it in and nothing

    I started the lastest iPhone 5s software update then my phone just shut down and will not turn back on. I've tried the home button, the button plus the top right button together for 20 sec, plug it in and nothing

    Plug your device into the original charger & block in a wall outlet and leave it alone for a couple of hours. Then, while it is still plugged in, restart it by holding down the home button and the power button for 10-15 seconds until you see the Apple, then let go.

  • When Application_Start event will be fired

    Hi All,
    In ASP.Net the Application_Start event will be call for every user or will call only once for the first user who access the application.
    Regards, Ravi Neelam.

    https://msdn.microsoft.com/en-us/library/ms178473%28v=vs.140%29.aspx
    There's a paragraph that says (italics mine):
    The Application_Start and Application_End methods
    are special methods that do not represent HttpApplication events.
    ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance.

  • T440/T540: Will the trackpad have dedicated left and right buttons?

    I'm wondering if anyone knows if Lenovo is going to ship the upcoming Haswell T440/T540 line of notebooks with a trackpad that has dedicated left/right buttons, or, if they're going to go with a non-buttoned approach?
    I've got a couple people waiting on these but they're the type that will do far better with actual physical buttons than just a flat trackpad they have to click "somewhere" on in just the right manner.
    Really hoping Lenovo is sticking with what works rather than getting needlessly fancy (or cheap)...
    Chuck
    Solved!
    Go to Solution.

    X240s and T440s are already out, and they don't have any physical buttons for trackpad.  I think you can safely assume all of the 40-series ThinkPads will have the same keyboard/trackpad.
    Per the marketing page:
    ... a larger, smooth trackpad with 5-point click integration — indicated by subtle bumps and stripes — can be configured multiple ways through Settings...
    http://shop.lenovo.com/il/en/laptops/thinkpad/t-series/t440s/

  • Events triggered when the cross on the top-right corner is tapped

    Hi all,
    I am writing a program for Pocket PC using Personal Profile. I am trying to use WindowListener to make my program do something when the cross on the top-right corner of a frame is tapped. However, neither windowClosing nor windowClosed is triggered. Could anyone give me some hints about doing something when the cross on the top-right corner is tapped?
    Thanks,
    Jokeshing

    the answe to this is to use the windowIconified event. This is what is actually trigged when the X is pressed.

  • What event is generated whn i click on JMenu and not menu item

    I have a menu that does not have any menu item.
    but the event handling of it does not work i am using action performed.
    Am in wrong in the approach?
         //Build the second menu.
    menu2 = new JMenu("Options");
    menu2.setMnemonic(KeyEvent.VK_O);
    menuBar.add(menu2);
              menu2.addActionListener(this);     

    Hi there,
    Are you sure you downloaded it from mozilla.org and not from another site? There are unfortunately counterfeit sites out there that are trying to offer Firefox downloads when in reality they are malicious.
    Go to www.mozilla.org and make sure you install Firefox from there and let us know if that makes things work for you.
    Thanks!
    - David

  • Mouse will only click with the right button...

    recently my macbook has decided that i dont need a right mouse button, and the touchpad is not responsive when clicking either. i have some suspicion that the trackpad button might be stuck. im also curious as to whether the usb's might be messed up. has anyone ever had this issue? how should i go about fixing it?

    nope, but i noticed since the lion update that the problem only persists if i touch the trackpad before i finish signing into my account...

  • What is the top right button in the color palette used for

    I've seen several tutorials on different mac apps and when they refer to the color palette I see a oval shape button in the top right corner. Maybe that was in 10.5 or latter but I'm using Lion and there is no oval button in my color palette. I see this in Pages, Pixelmator and Keynote but no oval button showing.
    Thanks in advace

    I've found over the past day that its presence comes and goes, presumably based on background apps.
    As I'm unable to predict when I'll catch it next time, it's best I close this question and I'll reopen a new question when I can provide a screenshot.
    Many thanks for your response, and I'll watch for its reappearance.
    John

  • What event is called when the handle next to a tree node is clicked

    Hi,
    I have a JTree...and the nodes in the tree have a little handle next to them. When i click on the handle, the children of that node, are shown below (as expected). However, what event occurs before the treeExpanded event is fired?? it seems like something happens just before it.
    thanks

    Post your code, I dont think any event except treeExpanded is fired.

  • What event is fired when

    Hi Everyone,
    I have a page that is displayed using
    CompleteAuditController *screen = [[CompleteAuditController alloc] initWithNibName:@"CompleteAuditWindow" bundle:nil];
    screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController:screen animated:YES];
    [screen release];
    So when this is done on the CompleteAuditWindow page
    [self dismissModalViewControllerAnimated:YES];
    What event (if any) is fired on the caller page??
    in essence, I need to know when this page become the active page on the stack.
    Thank you
    take care
    tony

    Both [viewWillAppear:|http://developer.apple.com/iphone/library/documentation/UIKit/ Reference/UIViewControllerClass/Reference/Reference.html#//appleref/occ/instm/UIViewController/viewWillAppear:] and [viewDidAppear:|http://developer.apple.com/iphone/library/documentation/UIKit/R eference/UIViewControllerClass/Reference/Reference.html#//appleref/occ/instm/UIViewController/viewDidAppear:] should be sent to the parent controller object. - Ray

Maybe you are looking for

  • Does iBooks author and iBooks support thai fonts?

    I ,live in Thailand,want to create books by using iBook author but from what i've know iBook only support one font for THAI language, is it true or not. Also does iBooks author support modifed thai font from the internet?  Last one, can I use .ibooks

  • Prblem in readmorelink in news iview of xml form builder

    hi, i am getting portal runtime error when i click on readmore link in news iview i have taken std news i have not cahnged anything i searched in sdn the solution they have given is also not working can any body help me in this regard Portal Runtime

  • Font rendering in edit mode

    When we are making edits with the cs3 verison of contribute the font will render to an unreadable size when in edit mode. Does anyone have a clue as to why this is happening?

  • How do I get rid of an app I don't want?

    not sure how to get rid of an app I do not wnat anymore?

  • Web part refresh causes sticky headers to disappear in sharepoint list

    I embedded a snippet called "sticky headers" that freezes the column titles of a long sharepoint list so that when you scroll down, the column titles remain visible. However, I noticed that the "sticky headers" disappear when the web part refreshes a