Forcing a button to click

HELP URGENT!!! pls...
how can i force a button to click..
i have the code now for the mouse listener
and im planning to make for the key listener
i want it that when i press a button in the keyboard it will associate
the mouse listener program ive made.
when i press the button 1 in the keyboard i want that the button will be clicked automatically so i have just only the mouse code for simplicity.
but the problemis i can't communicate to the mouse events ive made. how? coz im new to java

You can trigger an 'Event' like the following (I just took this out from a working pgm in which I wanted the opposite; namely, I wanted to trigger a keyTyped event when I click on a Label) :
//  All this code resides in a subclass of Label.
  public class MyLabel  extends    Label implements MouseListener {
    private char   label;
    private char[] labelChars;
    public MyLabel(String label_name) {
      super(label_name, Label.CENTER);
      labelChars = label_name.trim().toCharArray();
      label      = labelChars[0];
      addMouseListener(this);
    public void mousePressed(MouseEvent me) {
  // This is the 'key' (no punn intended) statement. ... O'right, punn intended.
  // label is char variable, and is the 1st character in the String name of my Label.
      keyTyped(new KeyEvent(this, KeyEvent.KEY_TYPED, 0, 0, 0, label));
    }I stripped off all the surrounding code. You should be able to ... well basically, reverse this logic.
~Bill

Similar Messages

  • Forcing an Applescript Screen to stay active until a button in clicked...

    I'm trying to get an Applescript to run, which will display a message either before of after a user has logged on to his/her account. Only when the button is clicked will the user then be allowed to continue using his/her computer.
    Another member gave me the following script, which works well on OS 9 Macs, but when used on OS X macs, the message is displayed, but the user can ignore the message and continue working away. How can I force the user to click the OK button before he/she is allowed to contine?
    on run
    display dialog "Do not use this computer for anything naughty!" buttons {"OK"} with icon 2
    end run
    Thanks in advance...

    Thanks again all for the quick replies. Your help is greatly appreciated! :)
    OK, well I've tried requestFocus() and requestFocusInWindow() (which is supposedly recommended according to the API notes)
    What I've done is to put a focus request in both a mouseEntered event and in the start method of the applet, with a focusListener added to see when focus is gained.
    For some reason, focus is still not gained until the mouse is actually pointing in the applet. Maybe this is on purpose? My request for focus in the start method seems to fail.
    Here's a snippet of both the start method and the mouseenter:
         public void start() {
              message="starting!";
              requestFocusInWindow();          
         public void mouseEntered(MouseEvent event) {
              requestFocusInWindow();
    As you can see, it's really simple. The message changes as soon as the focus is gained, via the interface for FocusListener.
    So it's better! It accepts my keyboard input right away as long as the mouse is in the applet area. However, it still doesn't accept my kybd input from the get-go if the mouse cursor isn't in the applet area. :(
    I guess this is okay but not ideal. Anyone know why the request for focus isn't working in the start method?
    I did try the javascript but for some reason it didn't seem to make a difference? maybe i'm using it wrong:
    <HTML>
    <APPLET CODE="movinghello.class" WIDTH=750 HEIGHT=400/>
    <script language="JavaScript">
    <!--
    document.movinghello.requestFocusInWindow();
    //-->
    </script>
    </HTML>

  • HT201276 My mouse is frozen and will not click on the Cancel or Force Quit buttons.  There is a box saying "Do you want to force Mail to quit?  Can't move mouse ... it is frozen.  Help???

    My mouse is frozen and will not click on the Cancel or Force Quit buttons.  There is a box saying "Do you want to force Mail to quit?  Can't move mouse ... it is frozen.  Help???

    Use gift cards.

  • How to redirect to a different page when a browser's Back button is clicked

    In my application a user logs-in and searches on the form provided. Now
    If a I click on browser's Back Button I see a message saying Page Has Expired, now at this point if I click on the browsers refresh button it shows me the page again.I want if browser back button is clicked and then Refresh button is clicked I don't want to show the same page rather redirect to a different page and invalidate the session. Is there a way clicking on browser back button I redirect to a different page.I have the following code on top of each jsp pages:
    response.setHeader("Cache-Control","no-cache"); //forces caches to obtain a new copy of the page from the origin server
    response.setHeader("Cache-Control","no-store"); //directs caches not to store the page under any circumstance
    response.setDateHeader("Expires", 0); //causes the proxy cache to see the page as "stale"
    response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibilityAny help is appreciated. Thanks

    There's no way to know when the back button is clicked, so I don't see how you can do anything about it. Since that message comes from a page which was created by a POST form submission, you can put some unique value in a hidden field that let's the server side record and if it gets it again (from the reload) then it can ignore the form data and redirect.

  • How to Capture the event when minimized button is clicked of a JFrame?

    Hi All,
    In my SWING application, I want to do something when the minimized button is clicked. But not able to understand how to do that.
    My basic requirement is like that, if I minimize the JFrame, it should be minimized to system tray with an icon. Again when the icon is clicked, the frame should be maximized in the Windows.
    Also, how to make my JFrame visible/invisible. If I close it, then the process will got killed... that I don't want to happen. Should I us setVisible(true/false) for the frame... Please suggest...
    Thanks,
    Ujjal

    There could be some mistake in my basic understanding... Anyway this is what I wrote...
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    public class WindowIconify extends JApplet
         JFrame jf;
         JPanel jp;
         public void run()
              jf = new JFrame("test");
              jf.setSize(200,200);
              jp = new JPanel();
              jp.setBackground(Color.BLACK);
              jf.add(jp);
              jf.setVisible(true);
         public boolean handleEvent(Event event)
              if ( event.id == Event.WINDOW_ICONIFY)
                   System.out.print("iconifying");
              return true;
         public static void main(String args[])
              WindowIconify wi = new WindowIconify();
              wi.run();
    }

  • Creating a plot on a java Frame when a button is clicked

    hi
    I want to create a plot in a java application in a frame when a button is clicked.I mean to say a
    a plot between two single dimensional arrays one as x-axis and the other as y-axis. Can u please suggest me with an example
    Thank u

    JFreeChart

  • Tried purchasing iTunes music. Put in my apple id and password then i was directed to a 'Terms and Conditions' page. I checked the box then clicked the 'accept' button next page read 'your Session has timed out '  try again  with a Done button to click on

    Tried purchasing music from the iTunes Store. When the window popped up I put in my apple id and password. Then I was directed to a 'Terms and Conditions' page. I checked the box next to the 'Yes I agree to these terms and conditions' - then clicked the 'accept' button next page read 'Your Session has timed out. Try again.'  with a 'Done' button to click on. Oh the same thing happens when i try to download  free iTunes. Yes I have tried & tried it again I even logged off and singed back in-- no joy 
    After accessing my iTunes account I was not able to change anything like my credit card number when I tried and was sent right to the 'Your session has timed out. Try again.'
    The last time I purchased any anything was on September 25th 2011 and the 'terms & conditions' page was last updated on October 12, 2011
    Does anyone have an idea to what is going on with my iTunes version 9.2.1 (5) and I can not upgrade to a higher version my iMac does not have the intel processor chip.Thank you for your time and help with this matter. You are greatly appreciated 

    I am having the same problem also! I posted on here about it, but no one has responded with ideas. I called technical support and e-mailed them, the only suggestions they gave was for the to turn off my firewall. But I didn't change anything, so it shouldn't suddenly stop working. Maybe this is just an iTunes issue? But it doesn't even recognize my account anymore, and I cannot log in now.
    If you happen to get an answer, will you please let me know what works for you?
    Thanks!

  • SRM RFx Response - How to check if a button is clicked or not

    Hi All,
    This is rani.  Im very new to SAP.
    Im into my first project, in which im having an Immediate enhacement.
    In SRM Portal, I need to logged in as bidder to create a bid response.
    "Participate" button is there, i need to clicked that button, this is mandatory.
    So how and where to check whether the button is clicked or not.
    else i need to raise the error message in BBP_DOC_CHECK_BADI and some fileds needs to be grayed out.
    The webdynpro component is FPM_OIF_COMPONENT.
    Can u please help me out in this regard.
    Thanks in Advance,
    Rani.

    Hi  Rani ,
    In SRM 7.0 the system variables ( sy-ucomm & sy-Tcode ) will not work .
    if you want the action code  triggered in the  Webdynpro screen inside the BADI: BBP_DOC_CHECK_BADI
    kindly study the SAP Note 1334202 - How to get current action ID and transaction group
    Below piece of code will give you the action Id in side the badi
    DATA: lo_trans_context TYPE REF TO /sapsrm/if_transaction_context,
            lv_action        TYPE /sapsrm/pdo_action_type,
            lv_tcode         TYPE /sapsrm/transaction_group.
      lo_trans_context = /sapsrm/cl_transaction_context=>/sapsrm/if_transaction_context~get_instance( ) .
      lv_action = lo_trans_context->get_current_action( ). "  replacement for sy-ucomm
      lv_tcode  = lo_trans_context->get_transaction_group( )." replace ment for sy-tcode
    kindly go through the SAP note provided .
    Regards
    Chinnaiya P
    Edited by: chinnaiya pandiyan on Jun 27, 2011 7:34 PM

  • How to check if a button is clicked or not

    Hi All,
    This is rani.  Im very new to SAP.
    Im into my first project, in which im having an immediate enhancement.
    In SRM Portal, I need to logged in as bidder to create a bid response.
    Participate button is there, i need to clicked that button, this is mandatory.
    So how and where to check whether the button is clicked or not.
    else i need to raise the error message in BBP_DOC_CHECK_BADI and some fileds needs to be grayed out.
    The webdynpro component is FPM_OIF_COMPONENT.
    Can u please help me out in this regard.
    Thanks in Advance,
    Rani.

    HI,rani;
       you can use the FM  :BBP_PD_BID_GETDETAIL ,you will get the detail of the Rfx ,and check the status of the Rfx !
       Alex

  • How to Create a Dynamic http address that opens the Explorer Window for a List Item When a Button Is Clicked--Currently Trying to Make this Work with Javascript

    I have created a button (via Content Editor) that uses JavaScript to open the Attachments folder of a list item in the Explorer Window in SharePoint 2010. The purpose is to have drag and drop functionality for each list item, having multiple attachments.
    The button works but opens the "Attachments" folder containing all of the other folders for each list item (one folder per item). It seems that when you add an attachment to a list item, SharePoint numbers the folder based on the item's ID. What
    I'm trying to do is take the JavaScript I have and have it run when a button is clicked in a custom form. When it runs, I'm trying to get it to open the "specific" folder for the list item. I have had success creating a hyperlink in the list that
    does this; however, the link WILL NOT work until I use the Content Editor created button that runs JavaScript, that prompts me to click OK to my profile certificate, and then opens the Attachment folder. After that occurs, I can use my hyperlinks without issue
    because I'm no longer prompted to click OK for my cert.
    So I'm trying to take the JavaScript I have and place it in a list item form (custom form) and have it run when a form button is clicked. The problem is I have very little knowledge of JavaScript (did I mention little?) and
    "don't know how to take the "http:" address I have in the script and append to it the list item ID, according to the record I have open."
    So that for any record I open, the script will grab the corresponding record ID (or list item ID) and append it.
    Here's the script I'm working with (which I didn't create but am grateful for):
    <style>
    .httpFolder {behavior:url(#default#httpFolder);}
    </style>
    <script text = "javascript">
       function fnOpenFolderView(){
       oDAV.navigateFrame("https://server/collection/site/subsite/Lists/Sublist/Attachments","_self");
    </script>
    <div id = "oDAV" class = "httpFolder"/>
    <input type = "button" value = "Open Attachment Folder" onclick = "fnOpenFolderView()"/>
    The above script, in the Content Editor, creates a button that opens the Attachments folder for the corresponding SharePoint list.
    JackSki123

    Hello Thriggle,
    Thank you for pointing that out. I appended your "GetUrlKeyValue" to the end and it worked. That said, I noticed it doesn't run as smoothly as when I simply click on the Content Editor button I created that resides on the SharePoint List
    ASPX page (not the form). The Content Editor button has the same code, minus the "GetUrlKeyValue". I click it; I get prompted to choose my cert; it opens right up.
    Now go to the ASPX Display form where I dump the code in a table cell. Button appears in cell; I click it; wait; wait; I get prompted for cert; it opens. Do I need some sort of "throttle" for the JavaScript? For instance, I thought before running
    JavaScript, you reference the library first. This code doesn't do that. I'm wondering if there's something more I need to make this run smoothly. Thank you both for getting me this far. 
    JackSki123

  • How can I set a value in a field before create when a New button is clicked

    Hi,
    I am using
    JDeveloper 10.1.3.1.0.3984 and
    JHeadstart 10.1.3.1 release 10.1.3.1.26
    I have one group and there is a detail group under that group.
    From main group to detail group there are 3 field relating those groups.
    field1
    field2
    fieldSEQ (auto-generated by database trigger)
    These 3 fields are PK.
    In the detail group, there is a New button. So, when the New button is clicked, it tries to create the record with those 3 fields value as those are coming from main group. As a result it's giving the duplicate error as that record already exists in the table.
    But I don't want to create the record with that SEQ as that will be created in the trigger.
    How can I set the SEQ temporarily any no. (-1) before create when the New button is clicked?
    Can anybody help?
    Thanks
    Syed Jabbar
    University of Windsor
    Windsor, ON, Canada

    Hello Syad,
    What I would suggest is setting the sequence number at the creation of the entity object (so in the create() method) by using the database sequence. This way it will always be unique.
    So something like:
    protected void create(AttributeList AttributeList) {
    super.create(AttributeList);
    SequenceImpl sequence =
    new SequenceImpl("KCP_SEQ", getDBTransaction());
    setFieldSeq( sequence.getSequenceNumber());
    If this still does not solve it: please go to the ADF Forum since this problem is an ADF problem, not a JHeadstart problem.
    Regards,
    Evert-Jan de Bruin
    JHeadstart Team.

  • How to get a node  in a Jtree on which right mouse button is clicked

    I am dealing with a situation in which whenever tree component is clicked by right mouse button I am needed to get the tree node on which right mouse button was clicked.

    MouseEvent e = ...
    TreePath path = tree.getPathForLocation(e.getX(), e.getY());
    Object nodeClickedOn = path.getLastPathComponent();Or something along those lines.

  • Button on Click, loads a pdf in new window

    Hello, I am trying find the correct as3 code to make a button on Click, open a pdf in a new window. I have tried different ways, but when I add the code not only does it give me errors, but it makes my swf flip through all the pages instead of stopping on load. It is fine before I enter the code for this button.
    Just to let you know, this button is within a movie clip on the main stage. I really wanted it in a MC within another MC, but can't figure out where to put the code.
    Should it go on the main timeline, where all the rest of the code is, or should it go within the MC?
    Please help! Very frustrated with AS3.
    Thanks!

    This is all my code. At this point my MC moves through all my content pages. Before I entered the last code (last 3 lines) it worked fine. I'm sure I am missing something simple. With the last piece of code it also gave me the error "1120:access of undefined property TNT_pricelist09. I would imagine because I have to add the folder name to the file name?
    Thanks for your help!
    home_btn.addEventListener(MouseEvent.CLICK, homePage);
    pricing_btn.addEventListener(MouseEvent.CLICK, pricingPage);
    about_btn.addEventListener(MouseEvent.CLICK, aboutPage);
    contact_btn.addEventListener(MouseEvent.CLICK, contactPage);
    function homePage(e:MouseEvent):void
    content_mc.gotoAndPlay("home");
    function pricingPage(e:MouseEvent):void
    content_mc.gotoAndPlay("pricing");
    function aboutPage(e:MouseEvent):void
    content_mc.gotoAndPlay("about");
    function galleryPage(e:MouseEvent):void
    content_mc.gotoAndPlay("gallery");
    function contactPage(e:MouseEvent):void
    content_mc.gotoAndPlay("contact");
    content_mc.pricePDF_btn.addEventListener(MouseEvent.CLICK, openPDF);
    function openPDF(e:MouseEvent):void
    navigateToURL(URLRequest(TNT_pricelist09.pdf));

  • Need to show popup when the Submit button is clicked for the second time ..

    Hi guys,
    I have a requirement where i need to show a popup or alert when the submit button is clicked twice . When it is clicked for the first time one method is been called and its process starts. When the user clicks the submit button for the second time they should be shown a popup stating "Submit button already been clicked, please clicked OK to continue".
    Can anyone help with this please , its really urgent requirement ?
    Thanks in advance

    Hi,
    I dont have any sample code to give you now. For quick reference, I can advice some psuedo steps to achieve your requirement. I dont have access to JDEV to test this. If any syntax errors then pls correct yourself.
    1. Extend Controller since it is standard page ( Refer Anil Passi site for steps to extend seeded ontroller)
    2. Write below logic in your Process Request method
    super.processRequest(oaPageContext, oaWebBean);
    pageContext.putSessionValue("status", "notInitiated");
    3. Include below logic in your PFR method
    if(pageContext.getSessionValue("status")!=null){
    if("notInitiated".equals(pageContext.getSessionValue("status")))
    super.processFormRequest(oapagecontext, oawebbean);
    pageContext.putSessionValue("status", "initiated");
    else
    String message = "Display error message as required";
    throw new OAException(message, OAException.ERROR);
    You may need to import required packages ( Related to OAException).
    Remeber, to sumbit the request, user need to refresh the page again so that "status" variable will be refreshed.
    Hope it helps.
    Thanks
    venkat

  • How do I open a web page in Adobe Reader from ipad2?  I don't see any buttons to click. I'm new user

    How do I open  a web page in Adobe Reader? I got the app for ipad2, but when a page says I need a certain version of AR, I don't know what to do. I'm a new user and don't know if I have to "open" AR and it automatically reads whatever doc I have up on the web, or is it always running and any web page I'm on should show a button to click in order to open the page in AR?

    If a website says that you need a certain version of Adobe Reader, it is probably attempting to detect whether or not you have the Adobe Reader browser plugin installed. This is something that only works on desktop systems where browser plugins exist. Since browser plugins don't exist on mobile, website developers should take care to present different messages and provide different options for downloading PDF's when visited by mobile browsers. I recommend contacting the website owner and requesting that they implement access for mobile devices.

Maybe you are looking for