HOWTO: JLayeredPane with a scrollable image background

Hi,all
I want to construct a JLayeredPane with a scrollable image background,
so I do the following,but the result is: the Image displayed,but without scroll bars,but when I expand the window,the vertical scrollbar appeared,why?
I am confusing...who can help me ?
class ImagePanel extends Jpanel {
public void paintComponent(Graphics g) {
//paint the icon here
class ImageScroller extends JScrollPane {
public ImageScroller() {
ImagePanel panel = new ImagePanel();
getViewport().add(panel);
//set horizontal and vertical scrollbar's value to the icon's value
class MapPanel extends JLayeredPane {
public MapPanel() {
setLayout(new BorderLayout());
ImageScroller is = new ImageScroller();
setLayer(is,0,0);
add(is,BorderLayout.center);
}

Hi,
I too am confused as to why you've used getViewport().add instead of setViewportView(). with that i had no problems. try that. i'm not sure if it'll solve the problem though.
Regards,
Phani Kanuri

Similar Messages

  • Need to make a 20 second HD clip with a moving image background and text thats flies in...

    Hi all im quite new to after effects and need to make a 20 second HD clip with a moving image background and text thats flies in. I also need to create a basic cross image. If anyone could suggest the best way to go about doing this it would be greatly appreciated. Thank you in advance

    Thank you for both of your reponses and I will try and be clearer:
    what I want to acheive is a HD motion graphic of text which will almost spin onto the screen letter my letter and then a become static word. Behind this I would like to place a moving image clip.
    By 'basic cross image' what im looking to do is use a cruifix shape instead of a 't' on the text.
    I hope this makes sense and thanks again!

  • Re: Change the image of the image Background panel

    Hi guys,
    I m wondering how can i change the background of the image I had set earlier on as the background of the JPanel using the overriding of paintComponent() method.
    What i need to do is to create a swing component with a changing image background abilities.. can anyone help me with it.. its urgent.. thanks!!!

    Hi.
    Please see code below. I hope it help you.
    Change the image name at the constructor of MainFrame.java and put that image to folder with class files.
    MainFrame.java:
    import javax.swing.*;
    public class MainFrame extends JFrame {
      public MainFrame () {
        ChangeBGImage panel = new ChangeBGImage();
        panel.setImage("ukr.jpg");
        getContentPane().add(panel);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      public static void main (String[] args) {
        MainFrame frame = new MainFrame();
        frame.setSize(400, 300);
        frame.setVisible(true);
    }ChangeBGImage.java:
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class ChangeBGImage extends JPanel {
      Image image;
      public ChangeBGImage (Image image) {
        this.image = image;
      public ChangeBGImage () {
        image = null;
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (image != null) {
          Rectangle rectFull = new Rectangle(0, 0, getSize().width, getSize().height);
          Graphics2D g2d = (Graphics2D)g;
          BufferedImage buffImg = new BufferedImage(image.getWidth(this), image.getHeight(this), BufferedImage.TYPE_INT_RGB);
          Graphics2D g2d2 = buffImg.createGraphics();
          g2d2.drawImage(image, 0, 0, this);
          TexturePaint imagePaint = new TexturePaint(buffImg, new Rectangle(0, 0, image.getWidth(this), image.getHeight(this)));
          g2d.setPaint(imagePaint);
          g2d.fill(rectFull);
      public void setImage(String imageURL) {
        MediaTracker mt = new MediaTracker(this);
        image = Toolkit.getDefaultToolkit().getImage(imageURL);
        mt.addImage(image, 0);
        try {
          mt.waitForID(0);
        } catch (InterruptedException ex) {
          ex.printStackTrace();
      public void setImage (Image newImage) {
        image = newImage;
    Sincerely,
    Victor Letunovsky
    AlarIT programmer
    http://www.AlarIT.com

  • How do i make a still image (photo) fit the length of the music? I record music and want to put the tracks to a video file with a still image of my business logo in the background. Any help?

    How do I make a still image (photo) fit the length of the music? I record music and want to convert the tracks to a video file with a still image of my business logo in the background. On windows movie maker you could just select "fit to music" but this program isnt as easy to figure out! Any help?

    Double-click on the still image in the project timeline to open the Inspector. In the Inspector, adjust the duration by typing in a new duration to match the length of your music. I think the limit for a still image is 10 minutes. If you need more than this, simply drag the image into the timeline again then adjust its duration. The two images will play seamlessly (no gap will be visible).
    See this iMovie Help topic:
    http://help.apple.com/imovie/#mov3a883915
    You can achieve more precision when entering durations by changing a preference in the menu item iMovie Preferences. Check (tick) the preference for Show Time As HH:MM:SS:frames. This will enable you to enter the duration of stills down to the frame level, rather than full seconds (NTSC is 30 frames per second; PAL is 25 fps). When entering times, type a colon between each time segment, such as 2:50:15, which represents 2 minutes 50 seconds and 15 frames. For 5 seconds 20 frames you would enter 5:20 and so forth.
    Note that the music will only run to the length of the video in the timeline (in your case, the still images). So, after increasing the stills duration you will need to drag the end of the music track as far as required. The stills can be dragged inwards to reduce the duration if necessary.
    John
    Message was edited by: John Cogdell - added Note

  • Space between DIV with image and DIV with image background

    I have just about finalized the new design on my website. The only issue I am having now is on the gallery page.  There is a thin space between a DIV with an image and DIV with an image background.  I am using these DIV's to give the illusion of a blue border. If you look at any of the other main pages on the site the space is not there. Any ideas? 
    http://liquidfirefishing.com/index.php
    http://liquidfirefishing.com/gallery/main.php
    Here are a couple of screenshots to show exactly what I mean.

    Hello, 
    both my "IE8" and my "FF 7.01" show the blue boundary lines. Here my screenshots, left side IE8, right side FF:
    Header 1
    Header 2
    Hans-Günter

  • I have several layers for this image: Background, Moon, Tree, Grass and Clouds.  When I try to use the Move tool to move the Moon, the tool jumps to the Tree layer.  The same thing happens with the other layers as well (except the background layer).  How

    I have several layers for my image: Background, Moon, Tree, Grass and Clouds.  When I try to use the Move tool to move the Moon, the tool jumps to the Tree layer.  The same thing happens with the other layers as well (except the background layer).  How can I keep the move tool from jumpimg to the Tree layer?

    1. Pre-select (highlight) the layer to move in the Layers panel.  or-
    2. [ALT+Right mouse click]  to select the wanted layer in the image window.
    and maybe
    3. Set the PS option to "Auto-select" a layer with cursor hover.  (can be very confusing!)

  • Change image background of a shape with applescript in keynote

    Hi,
    I want to create an applescript that allow to change background fill of a shape in keynote.
    I saw background fill type is r/o ( I guess read only ), but can we change only the image file if the shape is in image fill state with already an image.
    I work with an mac book air, mac os mavericks, keynote 6.
    Thanks.

    In your assignment statement you should remove the "string(....)" XPATH method. So if you use
    xpath(BookMessage,"/*[local-name()='BookMessage' and namespace-uri()='http://UntypeMessage.Book']/@*[local-name()='Author' and namespace-uri()='']")=AuthorName;
    it will work. Now the Left-Hand-Side of the expression does evaluate to a node set (in this case it would evaluate to an XmlAttribute).
    Regards.

  • Procedure or Function that send E-mail with image background and file attached

    hi
    I4d like know if someone there is a procedure or function that send E-mail with image background and file attached, for me.
    thanks
    Josi Vieira

    If you go to this part of OTN you will find the official Oracle UTL_SMTP demo, which includes attachments:
    http://technet.oracle.com/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    Getting a background is slightly trickier. The UTL_SMTP package is for primarily sending text e-mails, whereas images require HTML e-mail. I suggest you look at the structure of a sample HTML e-mail and see if you can write the necessary HTML strings in the DATA parameter. Otherwise you'll need to investigate handcrafting a program based on the UTL_TCP package.
    [rant]
    If this seems like a lot of trouble I agree and urge you not to bother. HTML e-mail is one of the curses of the modern age, not least because it is frequently used by purveyors of viruses. I have a filter on my Outlook client that strips out all the HTML in any e-mail I receive, which means I get lots of e-mails rendered unreadable by the inclusion of <HTML> tags. But who cares, they're mostly spam anyway. In fact, the use of HTML in an e-mail is almost always an indicator of the irrelevance of its content.
    [rant]
    Vibes, APC

  • I erroneously deleted some background icons, that now have left me with only thumbnail images, what appears when I want to enlarge is a grey circle containing a black exclamation symbol, how can I get back full function and undo my mistake

    I have erroneoulsy deleted icons repetious images from the computer which then affected my iphoto images, leaving me in some cases only with the thembnail image.   When I try to enlarge or perform any other function all that appears is a black field containing a grey circle with a black exclamation symbol( !)
    within it.  How to I get back full function of these affected images and undo my goof up.   I have tried restore, but my attempts have not proved successful. 
    Help !!!
    silvercoho

    What exactly did you do to delete these?
    How did you try to "restore" and what did you try to restore?
    Probably the only solution is to restore your backup of the iPhoto library  from before you did this
    LN

  • PDF with hyperlinks to images and other PDFs.

    Hi, All.
    I would like to create a small booklet with approximately 12 to 16 pages as a PDF document but wish to have images and text in the document set as hyperlinks so that they can launch other images and/or documents. In other words, a viewer could click on an image or text and then see an enlarged image open on the center of his computer screen or see another document open over the original PDF. This would work in a similar fashion to what one can do with interactive books on the iPad created with iBook Author.
    The questions I have are:
    Where can I find more material to read on how to create PDF with these features?
    I have seen PDFs that open with an application on screen that makes them 'feel' more like a real magazine. They are not a typical Acrobat or similar PDF viewer but rather an application that 'flips' the pages in a similar manner to what one would do holding a real magazine. Is it possible to do this with the PDF documents launched by hyperlinks on my PDF document?
    Can these hyperlinks open enlarged images in the center of the screen while the remaining area around the image (background) become darker to place emphasis on the image?
    How can I learn more about these features and how to use them with Acrobat and PDF documents?
    In case the information is relevant I am currently running Acrobat 9 Pro version 9.5.3 on a Mac.
    This is sort of an urgent project so any help you can share will be very appreciated.
    TIA,
    Joe.

    hi
    flash.net is the package you need on flex, inside it you
    several methods that can help you, 2 of them are:
    URLVariables and navigateToURL
    look at them and if you can't do it, just hire me, i'll be
    glad to do it :D

  • How can I remove an image background in pages?

    I want to know how to remove image backgrounds just like how you do so through "instant alpha" on a mac.

    Hi Erika,
    Are you trying to save a portion of an image with a transparent background? It may help to post a screenshot of the image that you're working with as well as your layers panel.
    I've included a few tips below that may help you with your situation. If you need additional help, please feel free to post again
    Deleting a background and saving an image with a transparent background
    1. Here I am working with an image of a santa hat that I've cut out from a white background. I have two layers, the cut-out santa hat and the original file. I'm going to delete the background layer so that I have just one layer - the cut-out santa hat:
    2. You'll see that a checkerboard pattern has appeared behind the santa hat. This means that the background is transparent.
    3. You can then go to File > Save As... and select PNG, Photoshop PSD, or TIFF from the Format dropdown menu. These file formats will save the cut-out portion of your image on its own, while preserving the transparent background.

  • Exporting text with a semi transparent background that can be changed in PS or PP?

    I'm creating a logo with a semi transparent background that I want to place on top of photos in Photoshop and videos in Premiere.
    1. I do not see a transparent option when exporting as a .tiff. Is transparent .png my only option from AI?
    2. I will need different amounts of transparency for the background depending on the image or video it is being placed on. Is there a way to export this and still have control in Photoshop or Premiere of the amount of transparency to apply towards the background?
    Thanks!

    1. So you are suggesting to just copy from AI and paste into PS?
    2. Since the logo is text and the background is a rectangular shape, I need to make sure that I can lower the opacity in PS or PP independently of the text. I will have to do a test later, I do not have the file on this computer.
    Thanks.

  • DW CS3 problem with PNG-8 images in Design View?

    DW CS3 (build 3481) on XP seems to have problems with PNG-8 images, specifically trying to display them in design view.
    I had a very simple image that was able to be exported by Fireworks CS4 as PNG-8 using 4 colors (no transparency) for a tiny file size under 250 bytes.
    DW could not display it at all, or even recognize it, reporting it was 0 x 0 in size. I published the page anyway, and it looked fine in the browser.
    I upped the number of colors to 32, and DW could then display it in design view in the page I was working on.
    I'm still having problems with other PNG-8 images. The attached file "temp.jpg" is a screenshot showing part of the design view in DW.
    The smaller image on the left of the banner is "58_certificate_of_discharge.png" (attached), and the larger image below is used as the background of the DIV containing the form,"compassbk.png" (also attached).
    These images all look fine in the browser, but terrible in DW.
    I'm stumped as to why.
    Thanks in advance.

    According to a different discussion, the images that are stuck as "Queued" are showing a bug in the virus scanning on the forums.
    Now trying the recommended 'camera icon' method...
    Looks like it worked.
    Now compare what it looks like in DW CS3 in the design view:
    It's a 16 color PNG-8 made in Fireworks CS4 with no transparency, size is 113 x 58, ending up at 1.71K.
    If this is a repeatable problem in CS3, is there any hope of it being resolved, or am I stuck with upgrading to CS4 as my only option (assuming it's fixed in CS4)?
    Thanks.

  • Problem with V19 Scrollable Frame

    I have a magazine that worked find on V18 of producer tools, since I upgraded to V19 I am having ptoblems.
    I have a standard page size 2048x1536 (iPad 3), and I have the whole page set as a scrollable frame with a background placed behind it. Then all my content for the page is pasted into the scrollable frame which runs much lower than the 2048 page length. You can then scroll the page within the scrollable frame rather than having a long page to scroll down. This also creates a nice layering effect where the content moves on top of a static background.
    This worked fine for me on V18 producer tools, but now when I load my magazine onto my iPad, I'm scrolling through articles and when I hit the page with the scrollable frame you can no longer scroll left or right and you're stuck on the page...
    Any idea how I can fix this as I have a client that has seen and likes the layering effect? Last thing I want to do is have to remove it and just make a long page.

    Which totally sucks, BTW.
    If you use JPG or PNG then it works but you lose the razor sharp text and pinch and zoom that PDF provides.
    I really don't get this one, either. Especially since the scrollable frames option gives you the ability to make it vertical only. That should eliminate any "confusion" as to which way to you want to scroll and which way you want to swipe.
    Bob

  • In CP5 - problem with the 'Paste as Background' option

    Hi,
    Since I have started working with CP5 I am having issues with the 'Paste as Background' option.
    After I work with CP5, and use the option few times it disappears from the menu although I have an image copied to my clipboard.
    After I close Captivate and re-open it, the option appears again.
    Any ideas?
    Thanks,
    Merav.

    merav, have you run the recent update for CP5?  It fixed a lot of issues with the Background issues.
    Also, the Paste as background option is not there if you have "Use Master slide background" checked for the slide.  It defaults to "on" if you copy slides, for instance.

Maybe you are looking for