Mouse Event Listeners with Full Screen JMF

I am trying to call the mouseClicked function from JMFs addMouseListner API in order to stop a media file when a user clicks the mouse button (or a key) like in a screensaver
I am able to access the function just before the player is started but once the media file begins to play I am not?
Here is the code I am using for the player and listener:
public static void main(String[] argv) {
JMF myFrame = new JMF("Java Media Framework Project");
myFrame.setUndecorated(true);
myFrame.show();
Dimension screenDim =Toolkit.getDefaultToolkit().getScreenSize();
myFrame.setSize(screenDim.width, screenDim.height);
myFrame.setResizable(false);
myFrame.addMouseListener(
new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
System.out.println("Mouse was clicked");
System.exit(0);
myFrame.play();
Are there any other methods to get around this? Is it possible to embed a JMF application in a window that I can then monitor mouse events from??

I passed the player object to a Listener class and I can get it to work ok with keyboard controls so Im sure the thread is not being blocked...but my problem still exists in being able to monitor mouse events within the JMF display while the media is being played at full screen. (i.e. in order to stop the media)
Maybe I can use the ControllerListener within the JMF player to monitor mouse events? Any ideas on how I do this?
Is it possible to layer the display with a transparent window from which I can monitor mouse events from?
You mentioned asynchronical playback...I am looking into this idea, are there any examples of this on the web I can look at?
Thanks for your speedy reply also!!
Regards,
Joe
public static void main(String[] argv) {
JMF myFrame = new JMF("Java Media Framework Project");
myFrame.setUndecorated(true);
myFrame.show();
Dimension screenDim =Toolkit.getDefaultToolkit().getScreenSize();
myFrame.setSize(screenDim.width, screenDim.height);
myFrame.setResizable(false);
myFrame.new Listener(myFrame);
myFrame.play();
public class Listener implements KeyListener,
MouseListener,
MouseMotionListener,
WindowListener {
private JMF owner;
Listener(JMF w) {
owner = w;
owner.addMouseListener(this);
owner.addKeyListener(this);
owner.addMouseMotionListener(this);
//owner.addWindowListener(this);
private void stop() { owner.stop(); }
//---------- KeyListener Implementation ------------------
public void keyPressed (KeyEvent evt) { stop(); System.out.println("key pressed");}
public void keyReleased(KeyEvent evt) { stop(); }
public void keyTyped (KeyEvent evt) { stop(); }
//---------- MouseListener Implementation ----------------
public void mouseClicked (MouseEvent e) { stop(); System.out.println("Mouse clicked");}
public void mousePressed (MouseEvent e) { stop(); }
public void mouseReleased(MouseEvent e) { stop(); }
public void mouseEntered (MouseEvent e) { }
public void mouseExited (MouseEvent e) { }
//---------- MouseMotionListener Implementation ----------
public void mouseDragged(MouseEvent e) { }
public void mouseMoved (MouseEvent e) {
if (oldMouse == null)
oldMouse = new Point(e.getX(), e.getY());
else if (e.getX() != oldMouse.x
|| e.getY() != oldMouse.y)
stop();
Point oldMouse;
//---------- WindowListener Implementation ---------------
public void windowOpened (WindowEvent e) { stop(); }
public void windowClosing (WindowEvent e) { stop(); }
public void windowClosed (WindowEvent e) { stop(); }
public void windowIconified (WindowEvent e) { stop(); }
public void windowDeiconified(WindowEvent e) { stop(); }
public void windowActivated (WindowEvent e) { stop(); }
public void windowDeactivated(WindowEvent e) { stop(); }
}

Similar Messages

  • Help:How to publish a Flash with full screen HTML

    Please, guys, be kind enough to teach me how to publish a
    Flash with full screen size in HTML. I have tried to search the
    board, but so far no luck.
    Originally, I want my .SWF to keep changing its background.
    The solution I got was placing colored stage-sized rectangles on
    the bottom layer. Then I don't want the viewers to see the HTML
    area where I cannot seem to control smooth color changes.
    So, after I construct a Flash file with backdrop-color
    changing by the method I mentioned above, how do I publish it with
    full screen mode in HTML, as you can see
    here? Help!
    Thanks in advance, guys.

    Here's an AS2 and a AS3 version I got from David Stiller
    2 small details you have to add 1 in publish settings set Dimensions to percent 100 100
    and in the html set <style>body {margin: 0; padding: 0}</style>
    // AS2
    import flash.display.BitmapData;
    Stage.align = "TL";
    Stage.scaleMode = "noScale";
    var tile:BitmapData = BitmapData.loadBitmap("tile");
    function fillBG():Void {
      beginBitmapFill(tile);
      moveTo(0, 0);
      lineTo(Stage.width, 0);
      lineTo(Stage.width, Stage.height);
      lineTo(0, Stage.height);
      lineTo(0, 0);
      endFill();
    fillBG();
    var listener:Object = new Object();
    listener.onResize = fillBG;
    Stage.addListener(listener);
    // AS3
    stage.align = StageAlign.TOP_LEFT;
    stage.scaleMode = StageScaleMode.NO_SCALE;
    var bmp:Tile = new Tile(50, 50);
    var tile:BitmapData = new BitmapData(50, 50);
    tile.draw(bmp);
    function fillBG(evt:Event = null):void {
      graphics.beginBitmapFill(tile);
      graphics.moveTo(0, 0);
      graphics.lineTo(stage.stageWidth, 0);
      graphics.lineTo(stage.stageWidth, stage.stageHeight);
      graphics.lineTo(0, stage.stageHeight);
      graphics.lineTo(0, 0);
      graphics.endFill();
    fillBG();
    stage.addEventListener(Event.RESIZE, fillBG);
    David Stiller
    Co-author, ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/dpsAS3QuickReferenceGuide
    "Luck is the residue of good design."

  • Lack of All format playable Video player with Full Screen STRETCH feature

    I am a big fan of Nokia and i know Windows phone is the world best smart phone.im using Lumia 820. but in my highend Lumia devices lack of a
    All format playable Video player (like mkv etc.)officially from Nokia or Microsoft.pls this is very important thing for all Lumia user for HD movie experience.pls update current video player.now I'm using Moli player but there is 1
    vital feature is missing...this is Full Screen STRETCH...when i play movie using Moli player on my phone screen upper and lower portion appear black bar.It mean Ascept ratio not match.This is very important for full screen movie exp.But  this
    feature is also available on Android  MX player.
             So,I request you please update current video player with
    Full Screen STRETCH feature for windows phone user.Thank you.

    Hello,
    You should ask in the
    Windows Phone forums on the Microsoft Community forums.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Creating a FLV video player with full screen option

    > This message is in MIME format. Since your mail reader
    does not understand
    this format, some or all of this message may not be legible.
    --B_3258016930_5977304
    Content-type: text/plain;
    charset="ISO-8859-1"
    Content-transfer-encoding: 8bit
    Hi!
    I am trying to create a video player that will allow full
    screen functions
    like what we can see on youtube. I know how to create the
    window and the pop
    up but the only problem I am having is having the original
    video in the
    small screen to pause or go silent when the full screen mode
    is activated.
    How can get it done?
    Thank you.
    °K.
    --B_3258016930_5977304
    Content-type: text/html;
    charset="ISO-8859-1"
    Content-transfer-encoding: quoted-printable
    <HTML>
    <HEAD>
    <TITLE>Creating a FLV video player with full screen
    option</TITLE>
    </HEAD>
    <BODY>
    <FONT FACE=3D"Arial"><SPAN
    STYLE=3D'font-size:12.0px'>Hi!<BR>
    <BR>
    <BR>
    I am trying to create a video player that will allow full
    screen functions =
    like what we can see on youtube. I know how to create the
    window and the pop=
    up but the only problem I am having is having the original
    video in the sma=
    ll screen to pause or go silent when the full screen mode is
    activated. How =
    can get it done?<BR>
    <BR>
    Thank you.<BR>
    <BR>
    <BR>
    <B>&deg;K.<BR>
    </B> </SPAN></FONT>
    </BODY>
    </HTML>
    --B_3258016930_5977304--

    Hello,
    You should ask in the
    Windows Phone forums on the Microsoft Community forums.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Website with Full Screen Background Images

    I'm trying to create a website with full screen background images (or  possibly, a video) that will crop to the browser window. It's also  important that the image be center-justified. The Die Antwoord site does  pretty much what I'm trying to accomplish. I'd also like to know how  they can use such high resolution images. If I try to use a high res  image, the file size is enormous. Another site that uses similar  technology only with a video is the TV on the Radio site.
    I  am fairly new to Flash so please forgive me if this is a rudimentary question.  Any help will be greatly appreciated.

    Hi Bob,
    Thanks for your reply.
    What I'm concerned about is the crispness of my full-page images. Am I right in assuming with a PDF folio, static images won't be as crisp? Is there a way to maintain its sharpness?
    M

  • Need help with full screen slideshow image quality

    I am looking to display some images with full screen slideshow. The images I add are very large, over 5000 wide. When I publish the site some images retain their quality while others lose it and look like crap. Why would this be and how can I fix it. I tried to resize them to the 2560x1707 that muse does, and then add them. This doesn't change the end result of poor quality.

    Go to Assets Panel and locate the image you want to use at original size. Right click the image and chose 'Import Larger Size'.
    See if that helps retain quality for that image, since Muse does not resize/interpolate that image for you.
    Cheers,
    Vikas

  • X220:Graphics problem with full screen videos

    I have got my X220 laptop last month. I am facing problem while playing youtube videos full sceen.
     videos can be seen best with smaller window but there is major graphics problem with full screen.
    Can someone help on this?
    I am using Windows 7 Enterprise edition.
    Thanks

    what do you mean by major graphics problem, please elaborate.
    Regards,
    Jin Li
    May this year, be the year of 'DO'!
    I am a volunteer, and not a paid staff of Lenovo or Microsoft

  • Problem with Full Screen

    Ok I am getting problems with full screen graphics on some computers.
    I am writing an internet based RPG and this is really eating into my time...
    Can any one explain why my graphics will not show some times (works others) with the exact same code running....
    I am using a BufferStratagy with a frame.
    Any help would be gladly apreashiated thank you in advance,
    Phibred

    Not a thread issue, no thread on this side of the program and yes there is a media tracker. However I have learned that my problem was that my screen does not like to flip to 800x600 for java applications for some reason thx any way.

  • Embed with full screen

    Hi, i will try to sum this up...
    what i need help with is embedding with full screen, how do i
    do that? like for ins-tents a youtube video, now i know they don't
    have any "full screen" button on their video as you embed it, but i
    want to make a costume one, like i make a link under the video
    "full screen" then you press it and the video will adjust to your
    IE or Firefox browser,, I've seen many sites to that for example
    www.all-aboutsp.com.
    and my second question, how do i embed a video from another
    website but yet use my own Player like www.southparkzone.com ?
    thanks in advance

    nobody can?

  • Spry event listeners with dynamic form elements

    Hi ,
    I am trying to implement spry event listeners with a form that has dynamic check boxes and text field name. I now i can get the elements in a var and loop through with a normal function but can this work for spry events listeners

    Short answer is yes. But I have a feeling that you need further assistance, in which case give us a URL to a page that you want to apply the event listener to.

  • Lion Screen Sharing with Full Screen apps on Remote Lion

    Has anyone figured out how to EASILY work with multiple desktops and full screen apps on the remote mac when Screen Sharing with one Lion mac from another?  All of the standard methods of switching between desktops and full screen apps (swipe, cmd + <arrow>, etc) all take place on the the local Mac, and not the remote one. 
    The only real effective methods I have found so far are using the dock (not elegant with full screen apps), and removing an app from full screen.  Either way, these methods are clumsy and do not compliment the new features that Lion provides. 

    You're not going to believe this.
    Problem was on my buddy's end.  The  slash key "/" was stuck down on her keyboard.
    Sometimes the solution is so far out of normal troubleshooting, you're luck if you ever find it...
    Nothing to see here, move along...

  • Problem with full screen playback

    Everything works fine until I go to preview in full screen. I hit the space bar to play the viewer and nothing happens. If I move the mouse over to where the play button is in the viewer window before the screen goes full and click where it was, it will play.
    The spacebar works fine when not in full screen mode. Any ideas?
    Im running FCE 3.0 in a PB 1.5 ghz with 2 gigs of ram running 10.4.8. I have not changed anything about my system that i know of (except the normal updates) since i did my last project last year and the full screen worked fine then.
    Thanks for any help.
    John

    By previewing fullscreen on your Powerbook, you're stretching video that is 720x480 to fit a 1280x854 screen. Recipe for ugliness.
    I'd recommend just setting your Canvas to 100% and viewing it at native resolution.
    I saved a different window layout for this on my Powerbook. It has a keyboard shortcut assigned to it, so I have one layout for basic editing, and another layout to blow it up to 100% for viewing.

  • Mouse disappears when is full screen

    i am on 2 screens, when i put the laptop in full screen while watching a vid, the mouse goes after i click a few time on the other displays?

    *edit
    Found workaround for this problem on web.
    1. right click on itunes on your desktop and go to properties.
    2. click on compatibility tab
    3. check box for "Disable display scaling on high dpi settings and apply.
    You will get a warning when you open itunes now that display settings are now set to an older version or something like that but just hit ok....and now full screen video! Probably isn't quite as clear as it should be if apple fixed this problem (I mean come on I know there have to be a ton of us out here that use large lcds or plasmas as our monitors so why its not fixed beats me) but hey at least it works in fullscreen mode this way. The major problem with this workaround is that it makes it quite hard to see text and other things in itunes store because they are now quite small. So what Ive had to start doing is keep it on normal settings while I go into itunes, and do my searching and renting and buying videos, then close it, make the changes of the workaround and then reopen it so that I can watch in fullscreen. Yeah its a pain but it works.
    Message was edited by: batou01

  • Going to next ppt slide with full screen dashboard problem

    Hi,
    we're using Dashboards 6.0.7.0 and Powerpoint 2010. I want to use interactive dashboards in my presentations, e.g. with a slider or mouse-over. I have embedded the dashboards into my ppt, that is I used the export to ppt functionality and copied the whole slides into my presentation. The problem is, that I want the dashboard to cover the whole presentation slide. As soon as I use the dashboards functionality, like hovering over mouse-over sensitive fields, I can no longer go on to the next presentation slide, as Powerpoint will no longer react to my presenter or go to the next slide on clicking with the mouse. I always have to stop presentation mode (ESC) and jump manually to the next slide to continue with my normal presentation.
    Do you have the same problems? How do you go to the next slide when using full-screen dashboards in your ppt-presentations?
    I'm very much looking forward to your ideas!
    Thanks, Philipp

    did you try to click outside the canvas ?

  • Screen Changes With Full Screen Playback Over HDMI

    Any one know if this is the best way to report a flash issue to the development team?
    Home Theater PC connected to a Sony  Bravia Television via HDMI
    Issue is that when the Flash content is played back on full screen, the Television flickers and displays a 'scene changed' anytime the mouse cursor appears or disappears. Happens in IE, Firefox, and Chrome.  This problem began with the latest version of Flash player. 

    I have been trying to get this to work too.
    Seems an obvious void with many of us trying to have both audio and video in a playlist!
    Apple, please make it so visualizer plays while a song is playing but a video will play full screen if it's a music video! Please?

Maybe you are looking for

  • T30 will not boot up

    My T30 will not boot up.  It beeps 6 times, but then locks.  It also does this with the hard drive removed.  I can purchase a new hard drive, but not confident that it is a bad hard drive issue.  Any suggestions?

  • Upload data to application server

    Hi All,   Is there any SAP standard program to upload data from a flat file to application server.I dont have authorization to write a program in quality system so i need a standard program Thanks, Rakesh.

  • Turning off yellow warning messages?

    Do we have any control over various warning messages? For example 'Swiss Franc is not an official Currency in Unites States' or ' Expense date doesn't fall within the dates of the expense report'

  • Activation ios 7

    Hi, I live in Ukraine, there is no support, and I have an invitation that would untie his Iphone

  • SD Certification  Preperation

    HI SD Certification ... Preperation. I am working in sap SD from three year ( as a Configuration Support ) . i have the academy manuals Course version 81  2008. SCM 600, 605, 610, 615, 620 , 650 , Solman 4.0 overview, ERP Entro . please advise the