Place a JButton over the visualcomponent

Hi to all.
I'm a newbie to JMF.
What I'm trying to do with no success is to add a permanent feature lets say a button on top
of the visualComponent given from the player.
It is impossible for the moment.
I'm really desperate beacause I can't find a way out.
For whom has already worked with JMF it sould be easy but not for my.
Any hint or help Would be really wonderful
Thanks to all in advance
Mandy
I Post here my code
import javax.swing.*;
import javax.swing.border.*;
import java.io.*;
import javax.media.*;
import javax.media.format.*;
import javax.media.control.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import com.sun.media.protocol.vfw.VFWCapture;
public class MediaPlayer extends JFrame implements WindowListener,
ComponentListener {
     private MenuBar mb;
     private Menu fileMenu;
     private Menu aboutMenu;
     private MenuItem aboutItem;
     private MenuItem exitItem;
     protected final static int MIN_WIDTH = 320;
     protected final static int MIN_HEIGHT = 240;
     protected static int shotCounter = 1;
     protected JLabel statusBar = null;
     protected JLayeredPane visualContainer = null;
     protected Component visualComponent = null;
     protected Player player = null;
     protected CaptureDeviceInfo webCamDeviceInfo = null;
     protected MediaLocator ml = null;
     protected Dimension imageSize = null;
     protected FormatControl formatControl = null;
     protected VideoFormat currentFormat = null;
     protected Format[] videoFormats = null;
     protected boolean initialised = false;
     * Costruttore *
     public MediaPlayer(String frameTitle) {
          super(frameTitle);
//          dimensione della finestra
          Image icon = Toolkit.getDefaultToolkit().getImage("icona.gif");
          this.setIconImage(icon);
          Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
          this.setLocation(10 , 10);
          this.setSize(screenSize.width-100,screenSize.height-100);
          this.setResizable(false);
// Add Menu Bar
          mb = new MenuBar();
          fileMenu = new Menu("File");
          mb.add(fileMenu);
          setMenuBar(mb);
          aboutMenu = new Menu("About");
          fileMenu.add(aboutMenu);
          AboutAction aboutAction = new AboutAction();
          aboutItem = new MenuItem("Application");
          aboutItem.addActionListener(aboutAction);
          aboutMenu.add(aboutItem);
          ExitAction action2 = new ExitAction();
          exitItem = new MenuItem("Exit");
          exitItem.addActionListener(action2);
          fileMenu.add(exitItem);
          addWindowListener(this);
          addComponentListener(this);
          getContentPane().setLayout(new BorderLayout());
          JPanel genericcontainer = new JPanel();
          //visualContainer = new JLayeredPane();
          //visualContainer.setLayout(new BorderLayout());
          visualContainer = new JLayeredPane();
          visualContainer.setBorder(BorderFactory.createTitledBorder(
"STREAM VIEWER"));
          genericcontainer.add(visualContainer);
          getContentPane().add(genericcontainer, BorderLayout.CENTER);
          statusBar = new JLabel("");
          statusBar.setBorder(new EtchedBorder());
          getContentPane().add(statusBar, BorderLayout.SOUTH);
     * @restituisce true se viene trovata una webcam *
     public boolean initialise() throws Exception {
          return (initialise(autoDetect()));
     * @params _deviceInfo, informazioni sulla webcam rilevata * @restituisce
     * true se la webcam viene correttamente rilevata*
     public boolean initialise(CaptureDeviceInfo _deviceInfo) throws Exception {
          statusBar.setText("detecting WEBCAM");
          webCamDeviceInfo = _deviceInfo;
          if (webCamDeviceInfo != null) {
               statusBar.setText("Connessione alla webcam : "
                         + webCamDeviceInfo.getName());
               try {
                    ml = webCamDeviceInfo.getLocator();
                    if (ml != null) {
                         player = Manager.createRealizedPlayer(ml);
                         if (player != null) {
                              player.start();
                              formatControl = (FormatControl) player
                              .getControl("javax.media.control.FormatControl");
                              videoFormats = webCamDeviceInfo.getFormats();
                              visualComponent = player.getVisualComponent();
                              if (visualComponent != null) {
                                   visualContainer.setOpaque(false);
                                   visualContainer.add(visualComponent, new Integer(1));
                                   visualContainer.add(new JLabel("sssss"), new Integer(2));
                                   Format currFormat = formatControl.getFormat();
                                   if (currFormat instanceof VideoFormat) {
                                        currentFormat = (VideoFormat) currFormat;
                                        imageSize = currentFormat.getSize();
                                        visualContainer.setPreferredSize(imageSize);
                                        setSize(this.getSize().width, this.getSize().height
                                                  + statusBar.getHeight());
                                   } else {
                                        System.err
                                        .println("Errore nella rilevazione del formato video.");
                                   invalidate();
                                   pack();
                                   return (true);
                              } else {
                                   System.err
                                   .println("Errore nella creazione della componente visiva.");
                                   return (false);
                         } else {
                              System.err
                              .println("Errore nella creazione del player.");
                              statusBar.setText("Errore nella creazione del player.");
                              return (false);
                    } else {
                         System.err.println("Nessun MediaLocator per: "
                                   + webCamDeviceInfo.getName());
                         statusBar.setText("Nessun MediaLocator per: "
                                   + webCamDeviceInfo.getName());
                         return (false);
               } catch (IOException ioEx) {
                    statusBar.setText("Connessione a: "
                              + webCamDeviceInfo.getName());
                    return (false);
               } catch (NoPlayerException npex) {
                    statusBar.setText("Errore nella creazione del player.");
                    return (false);
               } catch (CannotRealizeException nre) {
                    statusBar.setText("Errore nella realizzazione del player.");
                    return (false);
          } else {
               return (false);
     * Cerca una webcam installata per Windows (vfw)*
     * @restituisce le informazioni sul device trovato
     public CaptureDeviceInfo autoDetect() {
          Vector list = CaptureDeviceManager.getDeviceList(null);
          CaptureDeviceInfo devInfo = null;
          if (list != null) {
               String name;
               for (int i = 0; i < list.size(); i++) {
                    devInfo = (CaptureDeviceInfo) list.elementAt(i);
                    name = devInfo.getName();
                    if (name.startsWith("vfw:")) {
                         break;
               if (devInfo != null && devInfo.getName().startsWith("vfw:")) {
                    return (devInfo);
               } else {
                    for (int i = 0; i < 10; i++) {
                         try {
                              name = VFWCapture.capGetDriverDescriptionName(i);
                              if (name != null && name.length() > 1) {
                                   devInfo = com.sun.media.protocol.vfw.VFWSourceStream
                                   .autoDetect(i);
                                   if (devInfo != null) {
                                        return (devInfo);
                         } catch (Exception ioEx) {
                              statusBar
                              .setText("Errore nella ricerca della webcam : "
                                        + ioEx.getMessage());
                    return (null);
          } else {
               return (null);
     public void playerClose() {
          if (player != null) {
               player.close();
               player.deallocate();
               player = null;
     public void windowClosing(WindowEvent e) {
          playerClose();
          System.exit(1);
     public void componentResized(ComponentEvent e) {
          Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
          setSize(dim.width-100,dim.height-100);
     public void windowActivated(WindowEvent e) {
     public void windowClosed(WindowEvent e) {
     public void windowDeactivated(WindowEvent e) {
     public void windowDeiconified(WindowEvent e) {
     public void windowIconified(WindowEvent e) {
     public void windowOpened(WindowEvent e) {
     public void componentHidden(ComponentEvent e) {
     public void componentMoved(ComponentEvent e) {
     public void componentShown(ComponentEvent e) {
     protected void finalize() throws Throwable {
          playerClose();
          super.finalize();
     public class ExitAction implements ActionListener {
          public void actionPerformed(ActionEvent evt) {
               playerClose();
               System.exit(1);
     public class AboutAction implements ActionListener {
          public void actionPerformed(ActionEvent evt) {
               JFrame myframe = new JFrame();
          JOptionPane optionPane = new JOptionPane("\n" +
                    " Java Application\n" +
                    "\n" +
                    "Created by M.Zachariadou\n" +
                    "\n" +
                    " uses jre 1.6.0_3\n and JMF 2.1.1" +
                    "\n" +
     JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION);
     optionPane.createDialog(myframe, null).setVisible(true);
     public static void main(String[] args) {
          try {
               MediaPlayer myWebCam = new MediaPlayer("Video Streaming from WEBCAM detected");
               myWebCam.setVisible(true);
               if (!myWebCam.initialise()) {
                    System.out.println("WebCam non trovata / inizializzata");
          } catch (Exception ex) {
               ex.printStackTrace();
}

Yes. Make sure that you move it behide the control. To do so click on just
the label then go to the reorder control on the toolbar and select move it
backward or move it to back.
-Tom
"Mikey" wrote in message
news:[email protected]..
> I am trying to place text over the top of the round led control when I
> do this I am unable to click on the control. Is there a way to make
> the control translucent, so I can place it over the top the the text.
> The control must be labled and they must be placed very close to one
> another, not leaving enough roon to place the lable anywhere but on
> the led. Is there a way to do something like this?

Similar Messages

  • Trying to place one item over the top of another

    I am using DW CS3 and I am trying to create a banner (of pictures) and over the top of that I want text-only logo to appear above and drop down to overlap the top of the pictures. I'm sure there is some easy way to do this, but everything I try doesn't work. I can get the text behind the pictures but not in front of them. Any help is greatly appreciated.
    I have attached a .gif image so you can see what I want it to look like.

    Gary,
    I do understand that it is easier if I send a link to what I'm trying to do; however, I am just beginning the designing so it is pretty much a blank slate. Here is what I have in mind:
    I have The Nook Cafe as a logo image .gif that I want to place over a banner of pictures I have that are individual pictures placed within a container, this is what I am thinking:
    #header
    this would contain text for the upper right corner
    #headerlogo
    this would contain The Nook Text image
    #photos
    this div would contain the photos
    #photo1
    #photo2
    etc...
    So this is what i have tried:
    <div id="header">
    <div id="headerlogo">
    <div id="photos"> <div id="photo1"></div><div id="photo2"></div><div id="photo3"></div>
    </div></div></div>
    then I played with the z value and the margin settings.....all to no avail.
    Does this make more sense? As you can see I am lost as to how to accomplish the overall look I am going after.

  • How do I place an image over the header?

    I am new to web design and new to Dreamweaver CS4.  I have used 2 column template with header and footer.  I have got a header title (an image) but I want to place an image to the left of it in the top left corner of the web page.  I want the header region to be the height of the title as I want the image to have a greater height than the header area.  When I insert the image it goes into the header region and the header automatically increases its height to fit the image.  How can I overlay the image on the header rather than inserting it in the header?  Any help would be appreciated.

    Designing web pages is nothing like designing for print.   To achieve what you want , you'll either need to create a special header image in Photoshop or Fireworks that contains white space and/or slices from surrounding images.  Insert this new image into your header region.
    Or, you could simply place image in the background using CSS.  Then align your message text using CSS floats and margins.  See demo below for an example.
    http://alt-web.com/TEMPLATES/I-page-with-floats.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • Music library after data recovery - ID3 tags all over the place

    Hi,
    For a short time there i was using my external drive as my music library, while i sorted enough space ot run it from C:
    However, that didn't last long and i was asked if i wanted to reformat the drive.
    Using Easeus I was able to recover the mp3s. But they're all over the place i.e songs labelled as one thing will be something else, about 70% of the time. Also some songs randomly chnage to others.
    Is there any method i can use to resolve any of this, without re-doing my entire collection?
    thanks for any suggestions
    matt

    The best option is to recover from backup, but I guess you don't have one. You can also recover from an iPod if you have one:
    http://discussions.apple.com/message.jspa?messageID=9990366#9990366
    Failing that, are you certain that the tags are wrong in the actual files, the tags are part of the file, so I am surprised if they were changed if you were able to recover the files successfully. It is hard to see how they could be messed up if the file is OK unless something else messed with them.
    I am afraid you have a lot of work ahead of you. You might be able to use a tag editor to get tags from the internet - MP3 tag is an example, but I think the tracks need to be arranged into CDs for this to work.
    There is also something called PicardTagger which is supposed to use the audio footprint of the file to identify it, but I have no experience with it myself.
    http://musicbrainz.org/doc/PicardTagger

  • HT1926 I was prompted to install iTunes 11.1.4 this morning. It failed (first time EVER) with the comment that 'msvcr80.dll' was not available. Upon searching for that .dll in my computer, I found it to be all over the place! Thoughts?

    I've NEVER had a version update fail. I did go to 'Tools' and download for a manual install of this update as the info screen suggested. It, too, failed. After searching for the 'missing' msvcr80.dll on my computer, I found it all over the place!
    Ran a malware & virus scan with nothing evil popping up.
    Tried going back to a restore point before a previous update and doing the install. It failed.
    OS: Vista Home Premium x64, SP2 (and current with all MS updates)
    Now I'm pretty nervous re: syncing with ANYTHING-especially my iPod that has all my music I teach from at work.

    Solving the iTunes Installation Problems in Windows
    1. Apple has posted their solution here: iTunes 11.1.4 for Windows- Unable to install or open - MSVCR80 issue.
    2. If the Apple article does not fully resolve the problem for you, then try Troubleshooting issues with iTunes for Windows updates - MSVCR80.

  • My mouse keeps jumping all over the place and i dont know why!

    My trackpad doesnt allow me to fully control the mouse on the screen! it keeps jumping all over the place and i dont knw why! i updated my computer yesterday and it was working fine but by the end of the night it started to not function properly again.                   

    A fairly well known flaw that occurs to some trackpads. See here: http://support.apple.com/kb/TS1449

  • Images all over the place

    Today was my deadline and it is blown.
    I'd love to get this done over the weekend, but it's looking baaaad.
    I have a 350 page book I'm working on for export to pdf.
    It's my own book.  It's not for a client (I don't have any nor should I).
    I have a deadline because there will be some lovely publicity about it coming out in April or May so I want to get Amazon going on it ASAP.
    I have about 80 images.
    I'm in Indesign CC on a mac
    Just when everything looks perfect, I find some little glitch, correct it, and all the images float loose and go to all the wrong places.
    I can ANCHOR some images but not all.
    At the beginning of this project I was trying to anchor all of them to relevant text but got a lot of weird reactions from them and so I give it up when when it goes weird. 
    I know!
    What do I mean by that?  The image jumps off to the side or to a previous page or the text wrap stops working. Some behave nicely.  but most don't. I SPENT ABOUT A WEEK ON THIS. IT'S TOO COMPLICATED FOR ME AT THIS POINT.
    I've re-placed images and captions hundreds of times.
    If someone can offer some very very simple advice as to what would be my best move, I'd love to have it.  Complicated advice won't help me. I will not understand it. And I don't have time to take a class in indesign.  I mean, I've done pretty well, but this problem keeps arising.
    My default plan now is to delete ALL images.  Work on the text.  And then place the images one by one where they finally belong starting from the top.
    AFTER FIRST INSERTING A link or something to the image or to the name of the image without modifying the text.
    CAN SOMEONE TELL ME HOW TO DO THAT or SUGGEST A BETTER PLAN?

    My default plan now is to delete ALL images.  Work on the text.  And then place the images one by one where they finally belong starting from the top.
    If the all images it's on one folder, when file>place select all images then you use up arrow or down arrow keys to choose which photo you want to place on it's page.
    I've re-placed images and captions hundreds of times.
    If the caption include in photos metadata, after placing photos select all photos in links panel then mouse right click select captions>generate live captions or generate static captions

  • How to get rid of duplicate addresses all over the place?

    Duplicate addresses appears all over the places: on my mac (in the mail program) and in my ios devices.
    I suspect that it occurs during some synchronisation activities but how to get rid of this once and for all?
    Thanks for your help. It helps also if some tell me that I am not alone in that kind of trouble

    iCloud- Resolving duplicate Contacts after setting up iCloud Contacts

  • Why is my page or connection jumping all over the place after my recent update to firefox 5.0

    I came back from a week away and when I got on the internet firefox had updated to 5.0 and ever since then my pages just jump all over the place Why?

    Hi Aish,
    I have found the problem, but not sure where to find the solution as I'm pretty new to Adobe products.
    I built another site to see if I had the same problem, this time I made it shorter to see if the length was the problem. I put in some elements and 'assets', added parallax scroll key frames, left out pretty much most other things to see if I could pin the problem down. I found that I had the exact same problem.
    In the Muse preview it scrolls with the mouse like a dream when I grab the scroll bar and drag it down. But when I preview in business catalyst, export HTML or preview in browser, it goes crazy and won't let me get to the bottom. Further to that, when you scroll back to the top, everything is out of place and gets worse every time you scroll down and back to the top.
    I have a touch screen computer and tried to scroll the screen with my finger rather than dragging the scroll bar down with the mouse. The website works like a dream when I scroll with my finger, even when I scroll back to the top everything stays in place and the whole site works lovely! I then tried the other, long website to see if this was the same case and it was exactly the same case. It scrolls with a finger like a dream, but has a fit when you drag down the scroll bar with a mouse.
    My next question would be could I somehow disable some kind of touch scroll option in only the desktop version of the site, but leave it active in mobile and tablet sites? If I can do this can you please advise me on how to deactivate it, I think that should solve the problem.
    Can you please get back to me with an answer to this? I would be very greatful!
    Marc.

  • Why is the webpage jumping all over the place with parallax scrolling?

    Hi all, I'm getting a little frustrated here... I've built a looooong (10,200 pixel) parallax scrolling site, when I click 'Preview' it plays like a dream, but when I render the HTML, view in browser or publish to business catalyst to view, it just jumps all over the place. I realise that the page is extremely long, I'm thinking it could be that but just need to clarify it before I rework it all and maybe find out after, that it was something else that was causing it to happen.
    Your views would be greatly appreciated!

    Hi Aish,
    I have found the problem, but not sure where to find the solution as I'm pretty new to Adobe products.
    I built another site to see if I had the same problem, this time I made it shorter to see if the length was the problem. I put in some elements and 'assets', added parallax scroll key frames, left out pretty much most other things to see if I could pin the problem down. I found that I had the exact same problem.
    In the Muse preview it scrolls with the mouse like a dream when I grab the scroll bar and drag it down. But when I preview in business catalyst, export HTML or preview in browser, it goes crazy and won't let me get to the bottom. Further to that, when you scroll back to the top, everything is out of place and gets worse every time you scroll down and back to the top.
    I have a touch screen computer and tried to scroll the screen with my finger rather than dragging the scroll bar down with the mouse. The website works like a dream when I scroll with my finger, even when I scroll back to the top everything stays in place and the whole site works lovely! I then tried the other, long website to see if this was the same case and it was exactly the same case. It scrolls with a finger like a dream, but has a fit when you drag down the scroll bar with a mouse.
    My next question would be could I somehow disable some kind of touch scroll option in only the desktop version of the site, but leave it active in mobile and tablet sites? If I can do this can you please advise me on how to deactivate it, I think that should solve the problem.
    Can you please get back to me with an answer to this? I would be very greatful!
    Marc.

  • My fonts are all over the place, how do I get them back?

    Recently some of pages I view in Firefox have the text scattered all over the place and makes them impossible to understand. How do I get them back to normal? I am using a 2 x 2.8Ghz Quad Core Intel Xeon Mac, 12GB RAM running OSX 10.9.5 and Firefox 37.0.1. I have attached a screen shot of my Facebook Page to try and help explain my dilemma. Regards, Mal

    You can check for corrupted and duplicate fonts and other font issues:
    *http://www.thexlab.com/faqs/multipleappsquit.html - Font Book 2.0 Help: Checking for damaged fonts
    *http://www.creativetechs.com/iq/garbled_fonts_troubleshooting_guide.html
    You can try to disable hardware acceleration in Firefox.
    *Firefox > Preferences > Advanced > General > Browsing: "Use hardware acceleration when available"
    You need to close and restart Firefox after toggling this setting.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    *https://support.mozilla.org/kb/upgrade-graphics-drivers-use-hardware-acceleration
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Why does my audio jump all over the place after detaching it

    in iMovie HD you could extract audio then work with clips over it, in 09 I can't do anything. I extract/or detach the audio, but it is still attached or something. if you put a clip in the project widow the whole thing moves over, not just the video. So I saw the tutorials and they said you can replace a clip. but no window opens up over the clip??? any help

    After detaching audio, it is easy to drag the audio to some other place in your project.
    If you want to put clip A on top of a portion of clip B while keeping the audio from clip B, this is easily done. It is called a cutaway in iMovie 09.
    First go into iMovie Preferences and turn on the advanced tools.
    Select clip A so that it has a yellow border around it. This can be from the Event or from the Project.
    Now drag clip A and drop it on Clip B at the point where you want the cutaway to begin.
    A popup menu will come up. Select "CutAway"
    You are done, but you can fine tune it if you like.

  • Rewards - I have plenty of points and my account is in good standing. When I hover over the Place Bid button, a hand appears but I can't actually bid on anything. What's the deal?

    Rewards - I have plenty of points and my account is in good standing. When I hover over the Place Bid button, a hand appears but I can't actually bid on anything. What's the deal?

        I'm glad you are taking advantage of Smart Rewards, holla2012. When attempting to place a bid, have you noticed if the time on the item is near expiration? Have you tried clearing your cookies and cache on your browser?
    AndreaS_VZW
    Follow us on Twitter @VZWSupport

  • I have a comment.  I am very upset with Photoshop and all your tutorials regarding the quick select tool.  I have watched many tutorials and read instructions until I am blue in the face.  This tool does not work.  It is all over the place and all of your

    I have a comment.  I am very upset with Photoshop and all your tutorials regarding the quick select tool.  I have watched many tutorials and read instructions until I am blue in the face.  This tool does not work.  It is all over the place and all of your tutorials make it look so simple.  How can you advertise this as a viable tool when it just doesn't work?

    It is all over the place and all of your tutorials make it look so simple.
    This is a user to user Forum, so you are not really addressing Adobe here, even though some Adobe employees thankfully have been dropping by.
    How can you advertise this as a viable tool when it just doesn't work?
    Concluding something does not work because you fail at using it is not necessarily always justified.
    The Quick Selection Tool certainly has limitations, but your post seems to be more about venting than trouble-shooting – otherwise you might have posted an image where you failed to get an expected result.

  • Is anyone else having sensory issues since updating to the IOS 7.1.1? My phone is all over the place when trying to scroll or play a game. Know how to fix? It didn't do this till after this update.

    My phone is all over the place when trying to scroll or play a game. Know how to fix? It didn't do this till after this update.

    Do a
    Reset: Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Note: You will not lose any data

Maybe you are looking for