How to catch drag event in the title bar of a jframe

Hi
I want to catch the drag event in the title bar for jframe, because I have a few more window, dialogs, which I want to move along with my main window
Thanks

you can use a listener like tih one below...it works if you don't move to quickly.....
class SynchroMover extends ComponentAdapter{
  private JFrame master;
  private JFrame[]slaves;
  private int currentX;
  private int currentY;
  public SynchroMover(JFrame master,JFrame[]slaves){
    this.master = master;
    this.slaves = slaves;
    currentX =(int) master.getLocation().getX();
    currentY =(int) master.getLocation().getY();
  public void componentMoved(ComponentEvent e){
    int dx = (int)master.getLocation().getX() - currentX;
    int dy = (int)master.getLocation().getY() - currentY;
    System.out.println(dx+" "+dy);
    for(int i=0;i<slaves.length;i++)
      slaves.setLocation((int)(slaves[i].getLocation().getX()+dx),(int)(slaves[i].getLocation().getY()+dy));
currentX = (int)master.getLocation().getX();
currentY = (int)master.getLocation().getY();
the code isn't optimized...so you can probably do better

Similar Messages

  • [JS - CS5] listen events on the title bar of a palette

    I want to listen click on the title bar of a palette.
    I use
    myWin.addEventListener ("click",myFunction);
    but it works only on the bounds area, not on the title bar.
    Is it possible to listen events on the title bar?
    thanks
    Ivan

    I want to listen click on the title bar of a palette.
    I use
    myWin.addEventListener ("click",myFunction);
    but it works only on the bounds area, not on the title bar.
    Is it possible to listen events on the title bar?
    thanks
    Ivan

  • How to add an icon in the title bar,next to the maximize and minimize icons

    I need to add an icon ( help icon; ?) in the JInternalFrame� title bar. Anyone could help me????
    Thanks

    have you get the answer ?? on how you add an icon to the title bar?? ...
    if you do please inform me..
    thanks

  • Changing the logo in the Title Bar of a JFrame

    How do I change the logo in the left hand corner of the Title Bar of a JFrame window.

    Hi Sverigeterje
    Thanks.
    That's very neat. All done with one line of code, as opposed to the two lines of code I found in an answer (dated Jan 8, 2001) from Alexander Smirnov in response to a similar question (dated Sep 16, 2000) from Shawn Barker. (http://forums.java.sun.com/thread.jsp?forum=31&thread=49970 - Jan 8, 2001)
    ImageIcon image = new ImageIcon("CustomIcon.gif");
    this.setIconImage(image.getImage());
    Once again many thanks.
    George (aka cyberking1)

  • Setting an icon in the title bar of a JFrame...

    Hi,
    how do I set an image (icon) in the title bar of a JFrame (in the top left corner)?
    In JInternalFrame there is a method
    public void setFrameIcon(Icon icon)to set an image in the title bar of this internal frame - but in a JFrame I didn't find any method like this...
    Thanks in advance
    - Stephan

    Thanks ICE, that works for me...
    this.setIconImage(new ImageIcon("img\\foo.jpg").getImage());- Stephan

  • Embedding HTML in the Title Bar of a JFrame

    Hi Folks,
    I have a simple question. Do you know I can I employ an HTML-enabled script in the title bar of a JFrame? I would like to make use of the subscript tag in HTML <sub>, yet it didn't work out:
    public class MyFrame extends JFrame{
    super("<html>KPC<sub>V.10</sub></html>");
    }I don't know what I am doing wrong, but the title appears with the HTML tags, not in the way I would like it to be formatted. What would you suggest?
    Regards,

    The frame title is (typically) set in a native OS frame, which is not controlled by Java.
    Perhaps if you tell Java to let the L&F control the frame decorations it might work, but probably not, as it would probably just try to mimic what the OS does anyway, which is to not support HTML.
    So basically, you can't.

  • How to catch an event when the user change values in the project information dialog

    hi,
    i would like to know how to catch an event in my C# code when the user change values in the project information dialog?
    taskChange doesn't catch these changes.
    thanks.
    Thanks, Sharon.

    You need to write save button event handler for project information dialog. Link is having same functionality described. 
    http://blogs.msdn.com/b/husainzgh/archive/2011/08/01/hooking-into-the-project-detail-page-ribbon-save-button-without-overriding-out-of-box-functionality-in-project-web-access-for-project-server-2010.aspx
    http://www.projectserver2010blog.com/2010/01/sharepoint-2010-webpart-client-server.html
    kirtesh

  • How to change Font Type of the Title Text of a JFrame?

    Hi,
    I want to set a different Font Type for the Title text of the titlebar of my JFrame.
    Is it possible? Can anyone show me how if it is?
    Thanks.
    Niteen

    Michael,
    Thanks. It works!
    But there was a problem. I was not using the :-
    JFrame.setDefaultLookAndFeelDecorated(true);
    so I have to use it now.
    Is it possible to do it without the default decorated look and feel? Because the default LNF title bar has too much height and I am cramped for space.
    I know that's no excuse. I tried but it doesn't work.. I am using a extended JFrame like this:-
    class Testing extends JFrame
    public Testing()
    setSize(300,100);
    setLocation(400,200);
    Container container = getContentPane();
    /* add components to this container here */
    setVisible(true);
    When I use getComponent() for the container, I get an ArrayIndexOutOfBound Exception.
    When I set the argument to getComponent(0), the font in the title bar is not changed.
    What else should I do?
    Thanks.
    Niteen.

  • How add a new icon in the title bar?

    does anyone know how to change the default "java icon" that appears on the title bar of a Window (in an application Frame)?

    Hi,
    use the method public void setIconImage(Image) in Frame (inherited by JFrame).
    best regards

  • How can I move files using the title bar

    I am using Mountain Lion, latest release (10.8.4) and am wondering if there is some secret options which would allow me to move files by clicking on the title bar (of e.g. preview) and moving it to a directory.
    Unfortunately, I can only either create a link or copy the file. Moving seems to be deactivated, though I have learned from other forums posts that this was working under Tiger.
    Any advise would be greatly appreciated.
    Thanks,
    equi

    Depends on the application. iCloud-aware applications (Preview, Pages, etc) have the behavior you describe, and you can't move a file by dragging the thumbnail icon, but there is a small popup triangle to the right of the filename which contains the option "Move To" - you can then select your destination. It's not as seamless and dragging and dropping, though, I agree.
    Non-iCloud-aware apps, like Office 2011, still allow drag-to-move from the titlebar icon.
    Matt

  • Can't drag windows around using the title bar-CS4

    I just upgraded to CS4 at work last week and I'm already regretting it. Firstly, using two monitors, CS4 must like my graphics card becasue as soon as I open a document and it begins to render the window, the main monitor loses it's signal and cuts off. So I have to hard shut down and make my 2nd monitor the main one, open CS4 and a file on that monitor, then make it the 2nd monitor and pass it over to my real first monitor with a file open and make that monitor the main one again. Added to that, randomly, files will open as tabs even though I have the option unchecked in prefs. I hate tabs, I want my windows floating. But I digress.
    My current issue is the file windows are not movable using the title bar. I can expand/contract every side grabbing the edge, but clicking, holding and dragging any of the title bar is ineffective. I can drag to tab to undock it, but once floating, the title bar is non-funtional for grabbing. I can also double click on it to tab, just not to drag.
    I use a mac at home and thankfully Adobe hasn't forced the edge to edge palette background on that platform. On the mac we get a 'classic view' or something that does away with the desktop blocking grey window background. Seriously, I can't stand the full screen look. Why can't windows have that option to have just the menu bar, palettes and file windows allowing the desktop to be visible? /rant

    A new video card is often a good idea if yours is over 2 years old.  Even the modern "budget" (e.g., ~$100) cards are hugely powerful nowadays.
    This page, I believe, could be a good starting point for everything you want to know:
    http://kb2.adobe.com/cps/404/kb404898.html
    This page, specifically, talks about tested video cards with Photoshop CS4:
    http://kb2.adobe.com/cps/405/kb405711.html
    A similar page for Photoshop CS5:
    http://kb2.adobe.com/cps/831/cpsid_83117.html
    -Noel

  • Getting rid or hide of the title bar without using jwidow

    hi everyone,
    is there any way to get rid or hide of the title bar in a Jframe without using JWindow because this one didn't conserve all the abilities a JFrame(listeners)...
    thanks in advance

    It is setUndecorated(true), but you'll need version 1.4 to use it. If you don't have it, then you use JWindow...
    http://java.sun.com/j2se/1.4/docs/api/javax/swing/JFrame.html

  • How do I merge events on the new IPhoto. The old one was simply drag and drop, this one will not.

    How do I merge events on the new IPhoto. The old one was simply drag and drop, this one will not.

    There are no longer events in Photos.  The new Photos for Mac is structuring the Photos Library automatically into Moments based on dates and locations. You cannot change the moments.
    When Photos migrates an iPhoto Library, it will create album for each event in the iPhoto Library, as a substitute, but these album based "events" are a fake, because albums behave differently from events.
    In iPhoto each photo could be only in one event, so you could move photos from one event to another. With albums, dragging a photo from an album to another album will simply add the photo to the other album as well.
    You will have to remove the photo from the original album.

  • How to replace the icon in the title bar and minimized window

    I am not sure if this is a Swing question. But since nobody answered it in the Java Programming forum, let me place it here:
    I would like to set my own icon in the title bar and in the minimized window of my java application, replacing the java coffee cup icon.
    I am using:
    frame.setIconImage(new ImageIcon("image.gif").getImage())
    as was suggested previously in the Java Programming forum at:
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=5212059
    This does create the icon in both places. However, it only works when I run the program from JBuilder 2006. It doesn't work if I run the program from the .jar or the .exe file.
    How can I make it work for my .jar and .exe file?
    Please help! Thanks!

    It doesn't work if I run the program from the .jar...working example for a .jar
    import javax.swing.*;
    import java.awt.*;
    class Testing
      public void buildGUI()
        JFrame f = new JFrame();
        Image img;
        try
          java.net.URL url = new java.net.URL(getClass().getResource("Save.gif"), "Save.gif");//correct capitalization required
          if (url != null)
            img = javax.imageio.ImageIO.read(url);
            f.setIconImage(img);
        catch(Exception e){}//do nothing - default will display
        f.setSize(200,200);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to catch click event on BAR or a BAR GRAPH???

    Hello
    I want to implemnt following things,
    1. there is Bar Graph containing 10 Bars.
    2. So i want to navigate to 10 diff. pages on click of each bar.
    So how to catch click event on BAR or a BAR GRAPH.????

    Hi,
    You can set Destination URI on a graph. The URL can be specifically associated to a particular data point plotted in the graph.
    Detail for the same is provided in OAF developer guide under 'Charts and Graphs' topic.
    --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Project not working after upgrade to Kura 1.2.0

    Hello everyone, newcomer in the kura world here. Recently got a project working with kura and OSGi framework in my working place, but as we re-factored some code and decided to upgrade to kura 1.2.0, the project in my machine it no longer working whe

  • HT204365 Why did all my PDF files disappear from ibooks on my iPad

    All of my PDF files disappeared from iBooks on my iPad. Where and why did they suddenly disappear? How can I retrieve them?

  • Multiple JDS as a name serivce question

    I have three JDS (5.2) running as a naming service for host and user authentication: one master, and two slaves. My problem is that the ldap servers themselves point to another ldap server for information. So when I take one server down (patching) ev

  • Macbook air ssd problem

    I have a 2011 mabook air 13 in core i5 with a 256 ssd my problem is when i tried to install windows 7 i failed about 3 or 4 times so it created a partition on my ssd after removing them and giving up on windows 7 i was checking if i had anough room t

  • How to: Using BADI for reporting variables

    I am familiar with using the exit RSR0001. However I never used a BADI to implement such a variable. Is there some information available to get me started?