HELP : Moving a JComponent in a JPanel

public class teste extends JPanel{
this.add(ImageComponent);
/**********doesnt work! Why?*************/
this.ImageComponent.setLocation(x,y);
public class ImageComponent extends JComponent {
}

You may use a GridBagLayoutManager, if you want to use the x,y coordinates.

Similar Messages

  • Help centering a box in a jpanel

    hi every1,
    I need some help centering a box in a jpanel both
    horizontally and vertically.
    which layout is the correct one?
    could you post a scrap of code please?
    thanxalot
    stefano

    With the GridBagLayout you basically can do everything. Are there more components in the panel or just this box. If it's just the box, change the Layout of the panel to GridBagLayout and the anchor of the box to center. That should beeverything to do.
    Cheers
    Jonas

  • I need help moving my Photoshop 7 from my old laptop to my new laptop which is running Windows 7 Enterprise.  I've tried two routes unsuccessfully.  I install the CD, it does not autoplay.  I execute Autoplay.exe at the root directory, I am welcomed, I ch

    I need help moving my Photoshop 7 from my old laptop to my new laptop which is running Windows 7 Enterprise. I’ve tried two routes unsuccessfully. I install the CD, it does not autoplay. I execute Autoplay.exe at the root directory, I am welcomed, I choose English, I accept the EULA, I get the Install/Explore choices window, with the Install button already selected, I click the Photoshop button, the CD spins, and nothing happens.  In the 2nd attempt I execute Setup.exe in the Photoshop directory, and nothing happens at all.  I’m never even offered the opportunity to enter my product code. What should I do?

    There could is likely a compatibility problem between the old software and the newer operating system.

  • I am working on a program book in Pages...need help moving pages around...

    I am working on a program book in Pages...need help moving pages around...

    I think word procession mode but I used a magazine template to get started and then just kept adding blank pages to finish...I have done these before without any trouble moving the pages around...so very confused.  Thanks for any assistance. 

  • Need iPhoto book help moving photos

    need iPhoto book help moving photos---from one page to another--basically swap positions of 2 photos 

    drag them to the photos strip leaving the frame empty and then drag the photos you want there to the empty frame from the photo strip
    LN

  • Need help moving videos/photos from Galaxy S4 to iMac

    need help moving videos/photos from Galaxy S4 to iMac
    Samsung's utility Kies is awful
    Hlpe please

    did this
    import photos from android to mac
    got this, try it
    http://www.phototransferapp.com/help/android/transfer_photos_from_your_android_t o_your_mac/
    or use the first link to try some of the google hits for ways to get photos from android devices into osx

  • Help moving things from mac to ipad.

    I just got a ipad as a gift and i just recently bought a movie and a book from itunes. I need help moving them from the laptop to the ipad! but the ipad doesnt have wifi.

    All iPads have WiFi.
    Have you read this?

  • Help moving a watermark

    Hello to everyone, i have a picture and i wanted to be able to add a watermark. I succesfully made the code to do excactly that and know i want to take another step forward and be able to drag the watermark with the mouse where i want on top of the picture. Is this posible? and if yes can anybody help and most important explain to me?
    note i also draw a rectangle over the picture wich i control with the mouse.
    my code is:
    //this is the class i draw the picture, rectangle and watermark
    public class ScrollablePicture extends JLabel
            implements Scrollable,
            MouseMotionListener, MouseListener {
    //////...... a lot of code
    public void paintComponent(Graphics g) {
                super.paintComponent(g);
                Graphics2D g2 = (Graphics2D) g;
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
                g2.setPaint(Color.blue);
                if (!missingPicture) {
                      g2.draw(r);
                      g2.draw(centerRect);
    //i use mouse clicked and note moved for simplicity
    //if there is any syggestions to which mouse method excactly to use
    //please tell
      public void mouseClicked(MouseEvent e) {
                Point p = e.getPoint();
                BufferedImage waterMarked = ScrollablePicture.graphicsConfiguration.createCompatibleImage(imageManager.getCurrentImage().getWidth(), imageManager.getCurrentImage().getHeight());
                final Graphics2D imageG = waterMarked.createGraphics();
                BufferedImage test = imageManager.getWatermark();
                // draw original image.
                imageG.drawImage(imageManager.getCurrentImage(), null, 0, 0);
                imageG.dispose();
                final Graphics2D g = waterMarked.createGraphics();
                g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f)); // 30% transparency
                //draw watermark.
                g.drawImage(test, (int)p.getX(), (int)p.getY(),null);
                g.dispose();
                imageManager.setCurrentImage(waterMarked);
          }i am expecting the watermark to be drawn when i press the mouse over the picture and at the excact location wich simply doesn't happen.
    please excuse my poor english.
    thanks in advance

    You'll have to decide how you want the user to choose between dragging the rectangle and dragging the watermark image. You could provide components that allow for the selection of one or the other or you might try to do it with custom Keystrokes or special MouseEvents.
    The class with the JFrame could host the View and any user–selection components.
    public class View extends JPanel {
        protected void paintComponent(Graphics g) {
            draw background image
            if user wants to see rectangle
                draw rectangle
            if user wants to see watermark
                draw watermark image
    public class Controller extends MouseInputAdapter {
        // mousePressed is better for low-level work like this.
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            if dragging rect
                save p in member variable (savedPt)
                enable dragging
            else if user is dragging watermark
                make Rectangle r with location and size of wmImage
                if r contains p
                    save difference between p and location of r
                    enable dragging
        public void mouseReleased(MouseEvent e) {
            disable dragging
        public void mouseDragged(MouseEvent e) {
            if dragging enabled
                p = e.getPoint
                if dragging rect
                    set rect with (savedPt, p) in component.
                else if dragging watermark
                    calculate new origin (w/savedPt & p) for wmImage
                    set new origin of watermark in view
    }

  • Help - moved itunes folders to external drive and now my itunes is totally

    A few months ago, in order to free up space on my c drive, i had to purchase an external drive - everything i installed via itunes since that date has been on the hard drive and everything was fine.
    Last night i needed more room on my C drive so i stupidly moved the remaining itunes folders from my C drive to my F drive - unfortunately, when i opened itunes it was blank.
    i've tried a few things - including adding the folder from the F drive - and that retrieved about 80% of my music/videos and the last playlists i had - however, they were all missing songs - even if all the songs that should be included remained on my itunes
    i began the tedious process of manually adding files back in but soon realized this doesn't help itunes consider this the same ipod as what's still on my actual ipod.
    *What I'd like to do (if possible) is to wipe itunes clean and somehow restore everything on my ipod into itunes so that i retrieve not only the songs and videos but also the playlists that i've spent way too much time building. At this point i fear that the various components to my ipod are in too many files on my external drive to be easily restored another way (though if i'm wrong please let me know)*
    sadly (as this story might suggest) I am borderline computer illiterate - I've read a few posts suggesting some sort of software online (something the apple help line also made an "off the record" remark about) - but I can't for the life of me figure out which i would use or how to do this without risking the contents of my existing ipod (which has the playlists and songs/video I want to reestablish).
    *Can anyone possibly suggest how to best handle this and walk me through it in painstakingly basic and specific detail? I would be forever grateful.*
    Thanks

    iTunes uses the iTunes Library files - in particular the iTunes Library.itl file - to keep track of where your song files are located as well as playlist and related information.
    Most likely in moving your folders around iTunes has been confused to such an extent that it created a new Library file. With a bit of luck you might still be able to find the old file which would restore your old Library.
    So the first thing you want to do is look around your computer and make a note of any iTunes Library.itl files you can find. Generally speaking you'll find them in the iTunes folders on your system and depending on how you've been moving the folders - i.e. whether you "cut" them or "copied" them - you may still find at least one one on your F: drive and some on your C: drive.
    Having noted where they are you know want to check each of them out as described in this article in the Apple Knowledge Base. In following those instructions you want to select the Choose Library option and use the pop-up window that appears to zero in on the various .itl files you've located.
    Remember that each Library file will show a different Library in iTunes - perhaps slightly different, perhaps completely different - and if the first one isn't what you're looking for you'll have to close iTunes and repeat the procedure by selecting one of the other .itl's.
    Post back for any clarification.

  • I need help moving two objects at the same time

    I am try to create a code that will move a mini map to where the user wants in a game. As a test I created a square and converted it to a movie and named it sq. Then I created another square and converted it to a button and named it bt. I also made bt half the size of sq and placed bt at the center of sq. I then created a drag code which like this:
    sq.addEventListener(MouseEvent.MOUSE_DOWN, startDragging); // Start dragging square by user
    sq.addEventListener(MouseEvent.MOUSE_UP, stopDragging); // Stop dragging square by user
    function stopDragging(evt:MouseEvent):void
    sq.stopDrag();
    bt.x=sq.x;
    bt.y=sq.y;
    // this moved bt to sq(x,y) when mousebutton was released
    function startDragging(evt:MouseEvent):void
    sq.startDrag();
    bt.x=sq.x;
    bt.y=sq.y;
    // this moved bt to sq(x,y) when mouse button was pushed down
    I am trying to get sq and bt to move smootly together, but as it stands right now it just jumps from place to place.
    I have tried looking for some kind of linking code in abode help search, however, I am not sure want to look for exactlly

    The mouseDown and mouseUp events are single action events, so the button will only change positions on either the mouseDown or the mouseUp events. If you add a mouseMove event listener, then you can change the location of the button every time the square moves. Alternately, you could use an enterframe event to change the location of the button relative to the square. Try this code:
    sq.addEventListener(MouseEvent.MOUSE_DOWN, startDragging); // Start dragging square by user
    sq.addEventListener(MouseEvent.MOUSE_UP, stopDragging); // Stop dragging square by user
    sq.addEventListener(MouseEvent.MOUSE_MOVE,dragButton);
    function stopDragging(evt:MouseEvent):void
    sq.stopDrag();
    function startDragging(evt:MouseEvent):void
    sq.startDrag();
    function dragButton(evt:MouseEvent):void {
              bt.x = sq.x;
              bt.y = sq.y;

  • Help moving itunes library from old PC to new mac

    Well, I followed the online directions for moving my ipod library from an old pc to my new mac. It says files have been copied and now I see all the song files in the music folder of my new mac, but they won't show up in i tunes....what's up?
    Afterwards, I also restored my ipod for a mac and erased everything...so hopefully I havn't screwed up and lost everything! If I had to do the process over, I guess now I can't go back to my old pc and re-do it, right?
    Help...

    Drag the folder of music into iTunes.

  • ITunes library help - moved to external drive and now my apps are gone?

    I moved my iTunes library to an external drive, but now my apps are gone? I do have iTunes match and iCloud, so my songs are all on the cloud, but none of my apps are showing...
    I copied everything over, consolidated, but I must have messed something up as I think I have too many library files on the external drive now. I can see all my files on the external drive, but they are not showing up when I open itunes. It looks like it linked to a new copy of a library as only my most recent apps are showing, nad none of my existing ones are on itunes. What should I do to fix this? How do I know which files to delete?
    Thanks.

    I followed the instructions from Apple support to move itunes to an external drive, did what it said (obviously I messed something up). I then started itunes and missed the part where it says to tell itunes where the library was, and consequently itunes created a new library with none of my apps or anything in it.
    All of my music is on icloud and I als ohave itunes match, so all of my music is on the cloud.
    I have read some of the other postings to delete the newly made (and missing apps) itunes library file and ithen point it to the correct library file, but I am now paranoid I would delete the wrong one.
    Thanks in advance for your help.

  • Need help - Moving my Itunes to an external hard drive

    Help! Help! Help! Am tearing my hair out here!
    I recently got my first Ipod so please excuse if I'm being thick here! Basically, I'm about two thirds of the way downloading my not insignificant CD collection onto my Ipod, which I'm doing via Itunes. The C drive on my laptop is now full to bursting and I don't even have enough space left for my anti virus (big problem!). Therefore, I am wanting to transfer my itunes to an external hard drive. First, I followed the instructions on this site for Backing up itunes library by copying to a external hard drive.........
    http://support.apple.com/kb/HT1751?viewlocale=en_US
    All that succeeding in doing was mirroring whatever I did on the C:/ drive on the E:/ drive i.e. if I deleted itunes from the C:/ drive it disappeared from the E:/ drive.
    Next, I followed these instructions for Moving the itunes media folder to the external drive.
    http://support.apple.com/kb/HT1364
    This too didn't help as the media folder is not the problem, its the library as its 735kb! Am I right in thinking there's no way of moving the library to the external drive whilst wiping it from the C;/ drive? I need to get these darn files off my laptop and to use my external drive for my itunes. Alternatively, if I were to wipe the files to free up the space (as they are backed up on the hard drive) is there a way of syncing so that it simply adds new stuff to the existing music on my ipod not replacing it..
    Hope I'm making sense and that someone can help.

    First, I followed the instructions on this site for Backing up itunes library by copying to a external hard drive.........
    That's what it does. It makes a backup copy of the iTunes folder. iTunes will not use that folder or do anything to that folder.
    All that succeeding in doing was mirroring whatever I did on the C:/ drive on the E:/ drive i.e. if I deleted itunes from the C:/ drive it disappeared from the E:/ drive.
    Do you mean after you followed the instructions and copied \Music\iTunes folder to the external drive and then deleted something from iTunes, it deleted it from the external drive also?
    As above, iTunes will not use or do anything to that folder.
    Next, I followed these instructions for Moving the itunes media folder to the external drive.
    Why? You already copied the entire iTunes folder (including th emedia folder) to the external drive.
    Hold Shift and launch iTunes.
    Select *Choose library* and select the _iTunes library.itl_ file in the iTunes folder on the external.
    This too didn't help as the media folder is not the problem, its the library as its 735kb!
    What do you mean "the library"?
    735kB is small for the iTunes library.itl file and a single file in iTunes is larger than that.
    Am I right in thinking there's no way of moving the library to the external drive whilst wiping it from the C;/ drive?
    Yes. Follow my intruction above (Choose library) and iTunes will use the iTunes folder on the external.
    You can then delete \Music\iTunes on the C: drive.

  • Need help moving masters to external drive

    Drag images from internal drive to external...
    Relocate Masters...
    Locate Referenced Files......
    I realize these options are available, but I'm wondering which way to do this. Out of 160 GB of images about 1/2 of them are imported into Aperture while the remaining 1/2 are on the Mac but not in Aperture. All images are on my internal drive and I use Aperture as referenced masters, not managed. I need to make space on my internal drive and need to move all images (those already imported and those not yet imported) to an external. Given my current set up (1/2 imported 1/2 not), which option is best for a clean move to the external w/o messing up Aperture?
    Thank you,
    Jerry

    Jerry -- sorry, this thread slipped by.  I haven't had the time recently to be attentive.
    jbshanks wrote:
    So, I still need a little help with this. If I have this folder structure on my internal drive and 1/2 of those images are imported into Aperture (but referenced), and I use the "Relocate" feature, how will they be moved? Will it take the folders to the external or just the images, leaving the folders on the internal drive?
    I'm afraid to experiment in case it messes things up. Any help is greatly appreciated.
    1.  Don't be afraid to experiment -- set up a practice Library and use it to experiment.  That's how all of us learned what we know.
    2.  Your situation is a little peculiar, and I'm going to recommend something I wouldn't otherwise.  First, backup your system and confirm your backup.  Then go ahead and use Finder to copy all the Finder folders and files in question, intact, to a new drive.  Then delete the ones on your system drive.  Then open Aperture and run "File➞Locate Referenced Files" to re-attach your Aperture Images to your moved files.  You may have to run "File➞Locate Referenced Files" more than once (but most likely not) in order to end up with no Images that have missing Originals.  (If you need to, search for posts on the board about using this command.)
    At that point, you have done what you set out to do: move all of your photo files to an external drive while retaining the connection between those that are Aperture Originals and their corresponding Images in Aperture.
    But you haven't addressed the very good point brought up by bjurasz, which is that you are going out of your way to maintain competing databases.  Aperture is a database of your Images.  It has _outstanding_ storage and retrieval capabilities.  Finder is a database of your files.  It doesn't do a tenth the job Aperture does.  Finder is a file manager.  Aperture is an image manager (that does good file management).  Aperture has _terrific_ tools for helping you instantly retrieve _any_ subset of your Images (e.g.: family, spouse, dog, students from 2010, science students from 2010, vacation photos, vacation photos w. spouse, etc.).  The key to this is simply tagging your Images (e.g.: grayscale 2010 vacation photos w. spouse and dog) so that you can retrieve them as needed.  Importantly, you are not confined to a flat folder structure and whatever information you can stuff into the file name, as you are with Finder.  (Yes, more or less -- Finder is actually much more sophisticated than many realize or use.)
    I suggest moving more fully into Aperture, learning what tags are available and deciding how to use them, designing an Aperture Library structure that meets your needs, and transitioning your Finder collection of photo files to an Aperture database of Images.
    Ask more questions -- might be best to start new threads as they come up.

  • Need help moving photos to external drive

    Hi, all--here's hoping one or more of you Aperture veterans can help.
    Here's my situation: I'm not new to photography, but I'm new to Aperture. Just bought 3.3 and still getting to know what it can do. I'm an emigre from iPhoto, and one of the reasons I upgraded within Apple is that I was tired of the non-intuitive nature of PS Elements. I like to take pictures, not spend endless time in the dim glow of a screen digging through sub-menus for stuff, and from what I read, Aperture seemed more intuitive.
    But now I've got a seemingly very basic problem that hours of poring over discussion threads and searching through the hundreds of pages of the manual has done little to address with any clarity:
    How do I move (not just copy) older photos in projects to external drives, but in such a way that Aperture still keeps track of them, even when the drives are not connected? (The Aperture marketing I read/viewed clearly said Aperture could do this, and I'm running out of space on my MacBook Pro (15" from about 2008, running Lion) with lots of CF cards piling up.)
    Info that may help:
    -I need to move not just original (imported into iPhoto directly from the camera) photos, but also those I've adjusted in Elements, then re-exported into iPhoto (I would say "and now into Aperture," but as you know, there's no longer an import process b/w iPhoto and Aperture).
    -I shoot mostly RAW.
    -I have no idea whether the pictures are "Referenced" or "Managed" (for space reasons, I have yet to import any files directly into Aperture; all existing photos are from iPhoto, and if I was given an option when I set up Aperture, I don't now recall it).
    -I have external drives with plenty of space to move older pix to (I also have multiple backups, including Time Machine, additional external hard drives, and DVDs)
    Can somebody who knows how to do this safely please explain in clear language how to move photos as projects onto external hard drives so that Aperture keeps track of them via viewable thumbnails, even when the photo files themselves live on a hard drive that is not connected at the time?
    Thanks in advance!

    First things first:
    You can easily check if an image is managed or referenced by ctrl-clicking on an image version and selecting "Locate referenced files...". If Aperture says "No Referenced Files", your originals are managed by Aperture and stored within the library itself, otherwise it should show you the location of the original, and give you some options to verify the references and so on. I don't know which method is used when importing from iPhoto.
    Now, here's something you need to ask yourself:
    Does it make more sense for you to keep the library on your laptop and the originals on an external drive, or does it make more sense to move both the library and the originals to the external drives?
    In the first case, you can open and look at the thumbnails, but there's not a whole lot else you can do with your images when the external drive is off line.
    If you have vast amounts of originals, spread across multiple drives, it might make sense to keep the library on your laptop and connect whichever external drive you need at the time. However, it might also make more sense to split such a huge library into mutiple libraries, stored with their respective originals (which could be either managed or referenced).
    In my case, it makes sense to keep multiple libraries, with managed originals, but your mileage may vary.
    Here's a tip that might help you decide: A small library is quicker to navigate and work with than a huge one, although performance has improved vastly with later versions of Aperture.
    Once you have decided on the appropriate organization, you can start moving things around (after you've created the appropriate backups):
    If your library contains all managed originals already, and you want to move the entire library off to the external drive:Simply drag and drop the library itself (using Finder) to the new location.
    If your library use referenced originals, and you want to keep it that way, or your library manages your originals, and you want to start using referenced originals:
    Select all your images
    Click on the File menu and select Relocate Originals...
    Locate the destination for your originals, and pay special attention to the "Subfolder Format" and "Name Format". I'd suggest choosing "Project Name" and "Original File Name" for the two.
    Click on Relocate Originals, and twiddle your thumbs while Aperure moves all your originals to the new location.
    If your library uses referenced originals, and you wish to let your library manage the originals:
    Select all your images
    Click on the File menu and select Consolidate Originals...
    Decide if you want to Copy or Move the originals into the library. If you're running out of space, it might be best to Move.
    Click Ok, and wait for the operation to complete.
    (Optional) If you wish to move your entire library to the external drive, drag and drop the library to the new location.
    I hope that answers your question.
    Message was edited by: KluZz (oops, premature submission)

Maybe you are looking for

  • Why does a moving object randomly change direction without a keyframe?

    I am creating a graphic in After Effects CC, which includes some rectangles zooming onscreen, slowly moving across the screen, and then zoom offscreen. However, after adding the keyframes to make the rectangle zoom offscreen, now, in the middle of th

  • Fi to mm

    I have to pay vendor 5000Rs advance through cheque. If its clear vendor sent to us  material  first step inv of rm a/c dr      to gr/ir a/c dr. This entry in sap automatically generated or manually enter by user. second procedure gr/ir a/c dr   to   

  • Questions on saving document, search result and location

    SAVE DOCUMENT Is it possible to save the document directly on the IFS's repository? Shall I save the document as local copy and then to upload the document on the IFS repository? SEARCH RESULT If I do "Find" + "on documents", I haven't unexpected res

  • Games (as a response to my last forum)

    i found a page on itunes with good games that work on the ipod nano. the page says it works on 3G nano, 4G nano, and 5G nano, but whenever i look at the system requirements for a good game, it says that it works on 3G nano, 4G nano, and 5G classic iP

  • Terminal command for opening Safari fullscreen by default?

    Not fullscreen per day, but maxed out so I can still see the menu bar. Or at least to open with a bit more padding? Safari generally does a good job, but every now and then I'd like my window a bit larger.