[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

Similar Messages

  • 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

  • A notepad in the title bar of an event means not visible

    Hi,
    Using iCal 3.05 notepads in the title bar of an event are not visible. Enlarging the event (e.g. changing to "day" presentation an enlarging with the mouse), which is advised does not help.
    Willem

    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

  • Capture click event on dialog title bar

    Hi,
    I want to capture a mouse release (or click) event on the JDialog's title bar. Adding a mouse listener to the dialog itself does not work of course.
    Is this possible?
    thanks!
    Greg

    You would need to use a "decorated" dialog.
    Then the title bar is actually a Swing component. So you can use the getComponent(...) method of the dialog to get the title bar and add your listener to it.

  • Disabling close 'X' icon in the title bar of JDialog

    I found that JDialogs by default come up with the close 'X' icon. The only manipulation that can be done is by setting the DefaultCloseOperation.
    Is there some way I can avoid showing that icon on the title bar?
    My JDialog already has a 'Close' button and I have written an action listener for it. I dont want to listen to WindowEvents as well.

    JDialog d = new JDialog((Frame)c, true);
    d.setSize(400,300);
    d.setUndecorated(true);
    d.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);That bit of code seems to get rid of the title bar entirely and cause a MetalLookAndFeel dragging bar without an X to appear.
    Let me know if this is a satisfying solution
    My full test code followsimport java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DyalogTest extends JFrame
       public DyalogTest()
          super("Dialog Test");
          setSize(500, 400);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          Container c = getContentPane();
          c.setLayout(new FlowLayout());
          JButton b = new JButton("Initiate Dialog");
          b.addActionListener(new ActionListener()
             public void actionPerformed(ActionEvent e)
                Component c = SwingUtilities.getRoot((Component)e.getSource());
                JDialog d = new JDialog((Frame)c, true);
                d.setUndecorated(true);
                d.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
                JButton b = new JButton("Dispose");
                b.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                      Component c = SwingUtilities.getRoot((Component)e.getSource());
                      JDialog d = (JDialog)c;
                      d.setVisible(false);
                      d.dispose();
                d.getContentPane().setLayout(new FlowLayout());
                JPanel p = new JPanel();
                p.setPreferredSize(new Dimension(400,300));
                p.setBorder(BorderFactory.createTitledBorder("Vanilla Dialog"));
                p.add(b);
                d.setContentPane(p);
                d.pack();
                d.setVisible(true);
          c.add(b);
       public static void main(String[] args)
          new DyalogTest().setVisible(true);
    }

  • How to send a warning message before closing soft via X of the title bar

    With labview 8.2:
    I would like to send a warning message before closing my soft when the user press the "X" of the title bar. Is it possible to do that without a Windows dll?
    Thanks a lot,
    Daniel.

    Gerd,
    I think a filter event for 'Panel close?' is more appropriate because you have the possibility to cancel the event or continue the event.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • 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

  • Displaying our own icon at the title bar of a frame.

    Hai,
    How do i display an Icon of my choice at the title bar of a frame or a dialog box.
    Thank you.

    Thank you shahidjava for the kind reply,
    I tried your code as follows but I'am getting an exception saying "wrong number of arguments in the method.".
    Can you please help this out.
    import java.awt.*;
    import java.awt.event.*;
    public class testIcon extends Frame
         public testIcon()
         setVisible(true);
         setTitle("mohammad afzal....!");
         setBounds(100,100,200,200);
         getIconImage("afzal.gif");
         public static void main(String args[])
         testIcon ti=new testIcon();
    }

  • How to customize the title bar on my own Look And Feel?

    Hi all!
    I am creating my own Look and Feel which extends from NimbusLookAndFeel. What I'm doing is overwriting UIDefaults values??, referring to the Painters. For example:
    +uiDefault.put ("Button [Enabled]", new ButtonEnabledPainter());+
    But now I need is to customize the title bar of the JFrame's, but I do not see this option in Painter's values ??can be overwritten by Nimbus (http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/_nimbusDefaults . html).
    You know as possible? I have to overwrite an existing UI component? The idea is I want to make the look and feel like SeaGlass, but the code seems a bit complex to know where to begin.
    I hope you can guide me on this issue.
    Thank you very much for everything! And excuse my English!.
    Greetings!

    very simple example, with direct methods
    import java.awt.*;
    import java.awt.event.*;
    import java.util.LinkedList;
    import java.util.Queue;
    import javax.swing.*;
    public class NimbusBorderPainterDemo extends JFrame {
        private static final long serialVersionUID = 1L;
        private JFrame frame = new JFrame();
        private JPanel fatherPanel = new JPanel();
        private JPanel contentPanel = new JPanel();
        private GradientPanel titlePanel = new GradientPanel(Color.BLACK);
        private JLabel buttonPanel = new JLabel();
        private Queue<Icon> iconQueue = new LinkedList<Icon>();
        public NimbusBorderPainterDemo() {
            iconQueue.add(UIManager.getIcon("OptionPane.errorIcon"));
            iconQueue.add(UIManager.getIcon("OptionPane.informationIcon"));
            iconQueue.add(UIManager.getIcon("OptionPane.warningIcon"));
            iconQueue.add(UIManager.getIcon("OptionPane.questionIcon"));
            JButton button0 = createButton();
            button0.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    frame.setExtendedState(ICONIFIED);
            JButton button1 = createButton();
            button1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    frame.setExtendedState(MAXIMIZED_BOTH | NORMAL);
                }//quick implemented, not correct you have to override both methods
            JButton button2 = createButton();
            button2.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    int confirm = JOptionPane.showOptionDialog(frame,
                            "Are You Sure to Close Application?", "Exit Confirmation",
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
                            null, null, null);
                    if (confirm == JOptionPane.YES_OPTION) {
                        System.exit(1);
            buttonPanel.setLayout(new GridLayout(0, 3, 5, 0));
            buttonPanel.setPreferredSize(new Dimension(160, 30));
            buttonPanel.add(button0);// JLabel is best and cross_platform JComponents
            buttonPanel.add(button1);// not possible put there witouth set Dimmnesion
            buttonPanel.add(button2);// and LayoutManager, work in all cases better
            titlePanel.setLayout(new BorderLayout());//than JPanel or JCompoenent
            titlePanel.add(new JLabel(nextIcon()), BorderLayout.WEST);
            titlePanel.add(new JLabel("My Frame"), BorderLayout.CENTER);
            titlePanel.setBorder(BorderFactory.createLineBorder(Color.GRAY));
            titlePanel.add(buttonPanel, BorderLayout.EAST);
            JTextField field = new JTextField(50);
            JButton btn = new JButton("Close Me");
            btn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    System.exit(1);
            contentPanel.add(field);
            contentPanel.add(btn);
            fatherPanel.setLayout(new BorderLayout());
            fatherPanel.add(titlePanel, BorderLayout.NORTH);
            fatherPanel.add(contentPanel, BorderLayout.CENTER);
            frame.setUndecorated(true);
            frame.add(fatherPanel);
            frame.setLocation(50, 50);
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
            frame.setVisible(true);
            ComponentMover cm = new ComponentMover(frame, titlePanel);
            //by camickr http://tips4java.wordpress.com/2009/06/14/moving-windows/
        private JButton createButton() {
            JButton button = new JButton();
            button.setBorderPainted(false);
            button.setBorder(null);
            button.setFocusable(false);
            button.setMargin(new Insets(0, 0, 0, 0));
            button.setContentAreaFilled(false);
            button.setIcon(nextIcon());
            button.setRolloverIcon(nextIcon());
            button.setPressedIcon(nextIcon());
            button.setDisabledIcon(nextIcon());
            nextIcon();
            return button;
        private Icon nextIcon() {
            Icon icon = iconQueue.peek();
            iconQueue.add(iconQueue.remove());
            return icon;
        private class GradientPanel extends JPanel {
            private static final long serialVersionUID = 1L;
            public GradientPanel(Color background) {
                setBackground(background);
            @Override
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                if (isOpaque()) {
                    Color background = new Color(168, 210, 241);
                    Color controlColor = new Color(230, 240, 230);
                    int width = getWidth();
                    int height = getHeight();
                    Graphics2D g2 = (Graphics2D) g;
                    Paint oldPaint = g2.getPaint();
                    g2.setPaint(new GradientPaint(0, 0, background, width, 0, controlColor));
                    g2.fillRect(0, 0, width, height);
                    g2.setPaint(oldPaint);
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    try {
                        UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
                    } catch (Exception fail) {
                    UIManager.getLookAndFeelDefaults().put("nimbusFocus", Color.RED);
                    NimbusBorderPainterDemo nimbusBorderPainterDemo = new NimbusBorderPainterDemo();
    }

  • Displaying Jtimer in the title bar of jframe

    we have an urgent requirement to display Time (should run continously) and Date in the title bar of the java
    application. Please give input..

    To update a frame's title, call setTitle:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TitleUpdater {
        public static void main(String[] args) {
            final JFrame f = new JFrame("TitleUpdater");
            JButton btn = new JButton("press here");
            btn.addActionListener(new ActionListener(){
                int count = 0;
                public void actionPerformed(ActionEvent evt) {
                    ++count;
                    f.setTitle("pressed: " + count + " times.");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(btn, BorderLayout.NORTH);
            f.setSize(400,100);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • 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 can I get back the title bar in Thunderbird 38?

    The title bar can be turned on and off in Firefox. In the current version of Thunderbird (31), the title bar is present by default and there is no option to turn it off. In the beta version (38), there is no title bar by default… but I can't believe that there's no way to get it back. So, where is this setting? I can't find it.

    I sure agree that the setting isn't easily discoverable, but that's too late for the 38.0 release given that string freezes went in effect already (the reason being that localizers have to translate all UI elements for their respective language).
    The respective [https://bugzilla.mozilla.org/show_bug.cgi?id=814571 bug report] has been up for more than two years, but thus far not much progress in terms of a solution acceptable by the developers. I don't know if the extension proposed in the last comment was ever developed and posted.

  • Is there a way to modify the name displayed in the Title Bar at the top of the Audition Window?

    It's not uncommon for me to have a copy of Audition versions 1.5, 2.0 and 3.0 all open at the same time if I'm doing some editing for a complex project. 
    It would be handy for me to quickly see which window I have open without having to recognise the icons of the different versions.  At the moment, each Title Bar just displays the Audition icon and the words "Adobe Audition".  I'd like to add the version number to the name, if it's possible.  I'm happy to edit the Windows Registry, if that is what is needed.
    Does anybody know where the Title Bar information is stored?

    I have an answer you might like Howard.
    You could simply export one title to a PRTL file, then duplicate it using an Excel VB macro to change the name of the file based on a list in an excel file. You could type in a couple of dates, then just drag down to the 365th row and all of the dates would be there waiting for the macro to rename the file. Then, if you are really talented, you could find the appropriate text in the XML file and change it to match the name of the title, but without the PRTL extension.
    That way the font and position and style would all be right and the effort would be in a file you could share with the world.
    Hmmm. I might have to try that myself one of these days. Could come in handy. If you are more comfortable with Word than Excel, create the dates in Excel and paste them into a table in Word. Just be careful not to mess up the
    Edit: Oh, and of course, you import the titles back into Premiere Pro.

  • How do you make the title bar display different text than the page title?

    I'm looking for a way for the title bar display of my web page to be different than the text in the actual nav bar created by iWeb. For instance, I'd like the nav bar to just say Home for my main page, but in the title bar in the browser say "blah blah blah."
    I know there has to be a way to do this. iWeb has actually done it on one page already, but I can't figure out how. I think it picked up the title bar text from the first text box in the page. For instance, the page name in the navigation bar is "blahs for today" but the browser title bar when you open that page says "blah blah," which happens to be the first line of text on the page. The page title in iWeb.app, though, is "blahs for today." But if I look at the source code it lists title as "blah blah."
    I'm guessing I might be able to work around by making an invisible text box with the text that I want in the title bar as the very first thing on the page, and hope iWeb makes that the title bar text. I'd rather have a more correct way of doing it.
    Is there a way of doing this in the source code without having to change a lot of stuff?
    Thanks for any help.

    Richard Kirkman1 wrote:
    I think it picked up the title bar text from the first text box in the page. (...) I'm guessing I might be able to work around by making an invisible text box with the text that I want in the title bar...
    Richard ~ The key is the default Title box that iWeb creates for every new page — it's that which you need to edit, not another text box you've created. And to make the text in that Title box invisible, see here.

  • Any way to get at the title bar in JFrame?

    I'd like to either add a button to the title bar (title pane?) or override the behavior of the resize button. As far as I can tell, the LookNFeel classes don't allow you to add anything, just change colors, icons, etc. The WindowListener classes don't let you get at the resize button. I don't want to override Component.setSize() (that causes other problems), I just want to have the resize button do something different (or add another button).
    I'd appreciate any ideas!

    1) You could create your own frame that extends JWindow. This would be quite involved, since you'd need to make it respond to mouse drags, mouse resizing etc explicitly (if you wanted that functionality), but you would be able to add your own custom border, which you could make to look like a system border, or you could make comletely different.
    2) I don't know this could be persuaded to do what you want, but you could try adding a ComponentListener to the JFrame to check for resizes, and take action accordingly

Maybe you are looking for

  • Creation of a Table control with the wizard

    Hi all, I'd like to add a table control to my dynpro with the wizard. I want to use an internal table and a work area from my program but I get the following error : "The table work area WA_FID does not exist or is not a structure". here is my data d

  • Is this possible.........? connect to rtmp from XML

    AS3 Code var myXML:XML; var myLoader:URLLoader = new URLLoader(); myLoader.load(new URLRequest("xmlfile.xml")); myLoader.addEventListener(Event.COMPLETE, processXML); function processXML(e:Event):void           myXML = new XML(e.target.data);        

  • LED on power adapter doesn't always light?

    I have two power adapters, on one the LED lights all the time and is either green when recharged, or orange when charging. Another has an intermittent behavior as far as the lighting is concerned, and won't light up when it is charged. The menubar sh

  • MDB is not picking up messages in the Queue

    Hi , I am trying to implement a MDB (Producer) , that acts as a Message Producer also . This MDB pickes up a message from a Queue and sends it to another Queue(Queue 2) after some processing. The MDB listening to the Queue 2 is not being able to pick

  • How do you sync "all" the Photo Streams from my iOS6 devices to iPhoto '11

    I just purchased iPhoto 11 for my MacBook running Lion OS. I can't seem to sync all the Photo Streams from my iOS6 devices to my MacBook. I need more than 30 days.