How to see if title bar of Window is selected

In my Java program I have various Window types, such as JFrame and JDialog. How can I recognize if the title bar of the window has been selected?
(Java must recognize when it is selected, because this selection allows you to move the window.)
Please help! Thanks!

BrigitAnanya wrote:
Well, I don't just want to know if the window got the focus, which can also happen when something else inside the window gets selected, not just the title bar.You could add a focus listener in the JFrame or JDialog.
FocusListener focus = new FocusListener(){
       public void focusGained(FocusEvent e) {
          System.out.println("I got focus");
       public void focusLost(FocusEvent e) {
          System.out.println("I don't have focus");
};In the future swing related question should be posted in the swing forum.
Edited by: Yannix on Sep 26, 2007 3:42 PM

Similar Messages

  • How Can I change the colour in title bar of Window in Form 9i

    Hello
    All,
    I want to change the colour of title bar in window ?
    how can I ?
    From
    Chriag Patel

    Chirag,
    this is not in a scope of control for Forms and instead determined by the look and feel.
    Frank

  • How do I get TITLE BAR ONLY to display for a window (without minimizing the whole window)?

    I want ONLY the title bar to show, then resize to normal then shrink when I ask it to.
    JIM

    Here is an extension that you can control which toolbars show in '''Full Screen''' mode ("'''F11'''), and in what he calls '''zombie mode''' which I would call '''Full Window''' mode ("'''Shift+F11'''")
    This is with Menus showing.
    The title bar will show in zombie mode, not in Full Screen mode ("F11")
    The change that I make in the options myself is that the tabs bar always shows
    I like to see the title bar normally but in either of those two with the tbs bar displayed, I can hover over the active tab to see what the title actually is.v
    KrickelKrackel :: Autohide for Firefox
    :http://www.krickelkrackel.de/autohide/.
    Requires secure server [http://kb.mozillazine.org/Unable_to_install_themes_or_extensions_-_Firefox#Unsecured_updating override], well worth the extra effort to install.
    More information on my page (and alternatives, this is what I want and use)
    :http://dmcritchie.mvps.org/firefox/firefox.htm#autohide
    I display all tabs on the tabs bar such that they do not roll off or scroll across, and I have my tab borders color coded.
    * [https://addons.mozilla.org/en-US/firefox/addon/stylish/ Stylish :: Add-ons for Firefox]
    * [http://userstyles.org/styles/24728/ Tab Color Underscoring active/read/unread (Fx3.6 ) - Themes and Skins for Browser]
    * [http://userstyles.org/styles/9043/ Tabs Bar Minimal Size - Themes and Skins for Browser]
    You can make '''Firefox 7.0.1''' look like Firefox 3.6.*, see numbered '''items 1-10''' in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 thru 8.0, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
    * http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface
    <p>There is a lot more beyond those first 10 steps listed, if you want to make Firefox more functional.</p>
    <p><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small></p>

  • How to blink jframe title bar?

    hi, i have an application i dont know how to blink the title bar of the frame when it is minimized. I hope you can help me. Thanx in advance.

    When the frame doesnt have focus
    you can use
    yourFrame.setVisible(true);
    and it will blink similar to the MSN Messenger on the task bar..
    It works well on XP, 98 n ME.. I havent tried on 2000 but i use it for the messenger I developed and it works absolutely fine
    Hope it helped
    Boney S.
    [email protected]

  • How to see my play list on Windows when I created it on Apple ?

    How to see my play list on Windows when I created it on Mac OS X ?

    View > Show Sidebar form the top menu
    Then your phone and playlists are on the left.
    Drag your playlist up to phone and it will copy it

  • How to see the scrubber bar in Imovie window

    This might sound a little weird, but I don't see the scrubber bar in my Imovie library workscreen--and I don't see any dropdown menu options or icons that would make it visible.  Any thoughts?  Thanks in advance--C

    Thanks again for getting back to me.  What I'm looking for is a way to determine the exact time of a location in a clip, either in the clip view or the timeline view.  This image seems to indicate that the clip view should have some kind of time bar:
    And it seems the timeline view should also have some way of keeping track of time (I can move the vertical white line along the clip in the timeline view, but there doesn't seem to be any way to see at what point the line is; the readout indicates how long each clip is but the number of seconds doesn't change as I move the playhead):
    So I'm looking for a way to determine via a clock/counter where exactly I am in a clip.  I'm sure it's something simple, I don't know what I'm missing!

  • Firefox opens and I see a title bar but the main window content is not refreshed or loaded

    I installed Firefox 4.0 and it installed fine. When I run it, the window opens with the title bar and borders but the inside content pane is blank. The only option I have it to close it.
    If I uninstall 4.0 and reinstall the latest 3.x release, it works fine. I've removed all of the 3rd party add ons but am still having this issue.

    I think I found the problem. I have 3 monitors, my primary monitor is connected through an external USB video card (Sabrenet Viewmax) using DisplayLink drivers. When I move the Firefox browser window over to the laptop monitor or to the monitor that is connected through the laptop's VGA port, Firefox works as expected. Is this a driver issue? a Firefox issue? As a side note, one of my Microsoft apps is having the same exact issue, Microsoft Visual Studio Web Developer Express.
    Help?

  • How to edit file title bar?

    In Frame 7.2, when I open two or more files (stored in a folder several levels below My Documents), the path is long enough in the file title bar that it's difficult to see the file name without dragging the window to the left or shutting down some control boxes stored on the right side.
    Is there a way to make Framemaker show only the file name? My alternative is to move all files up a few levels to shorten the path.
    Yours,
    Michael F
    =======

    Michael,
    This is a known problem. Unless you can live with waiting for the tool tip showing the full path (at least in the most recent versions of FrameMaker), the only option is to modify this property via FDK programming. A friend of mine has a script titled In Window Title, Display File Name Only (to be used with FrameScript) in his free script collection:
    http://www.i-frame.itl.info/en/feature-description/free-scripts/in-window-title-display-fi le-name-only.html
    If it really bugs you, it might be worth investing the $149 for the FrameScript plug-in to run this (and other useful) scripts.
    - Michael

  • How to turn of menu bar and window decoration of Forms 11g Rel2?

    According to Forms documentation, one can turn off menu bar and window decoration.
    How can that be done?.
    Best regards, Luis ...:)=

    From the documentation (Forms Deployment Guide), see Section 3.4.3. Refer to "guiMode"
    http://docs.oracle.com/cd/E38115_01/doc.111210/e24477/basics.htm#BABGEGBC

  • 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();
    }

  • How to change the title bar wdith , scroll bar widths in tune with a 7" screen

    can you please help me customize my user chrome section so that I can REDUCE the WIDTH of the scroll bar ( horizontal and vertical ) . That is , at max the scroll bar can be ___ pixels of __ % of total width. ( prefer the relative reference )
    Also the title bar ( that black surrounding area that bears the minimize, maximize,close buttons ) needs its width reduced to half of what it is now. How do I do this ?

    No. That doesn't work any more. In current Firefox versions native scroll bars are used and you can't do style those via userChrome.css (user interface; chrome windows) and userContent.css (websites). You can try a large theme if you do not want to make the changes via the Control Panel

  • CS4 - No title bar in Windows 7 64 bit

    A couple of weeks ago I installed CS4 64 bit in the 64-bit beta of Windows 7. All I did was open it, look at it, do a bit of minimal adjustment to the Prefs, open a couple of photos and pretend to edit them.
    I opened it 2 days ago, and it was still fine. It Photoshop had a standard Windows 7 Aero title bar.
    Today it has no title bar, just a bit of space above the menu line. Bridge still has a title bar, however.
    I've trashed my prefs; no good. Trashed them, rebooted. No good.
    Any suggestions?
    Thanks
    Mary

    Steve, Zeno, Rob, Bob
    I've got egg on my face. The reason I don't have a title bar is (quoting from a CS4 review), 'There’s no longer a title bar to consume extra screen real estate unnecessarily.' !
    I must have been running it maximized before yesterday, and didn't notice the 'no title bar' phenomenon.
    After reading Steve's post, I googled harder and found the answer.
    Sorry for taking up bandwidth. (On the other hand, if I hadn't seen that Steve, using Vista not 7, had the same, er, feature, I might have gone through a horrid cycle of reinstalling etc.; so posting did help me!)
    Mary

  • How to report Safari title bar rendering bug?

    I have captured a screenshot of a Safari for Windows bug where the title bar renders incorrectly when the "Develop" menu is turned on. Where can I submit this information?

    Click Help -> Report bugs to Apple...
    This method allows you to send your bug report directly to Apple. Thanks for sharing this info with the forum. I was not able to reproduce this error.

  • How to rotate caption (title) bar of CDockablePane

    Dear All
    Is that possible to   rotate caption (title) bar of CDockablePane when it dock.
    I mean to say is that possible to put title bar in the left side or right side with rotate text.
    if possible could some one tell me how.
    Thanks in Advance.

    I think it is hard to rotate caption (title) bar of CDockablePane. Create a non-caption dialog and custom a area as the left caption bar. And You need to make the dialog dockable.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to see the Tabs in Aurora( windows 8 app ) ? I only can see them by oppening a new tab. But In case I want to change tab I can't see them.

    I Install Firefox Aurora as it support windows 8 style app. But In the windows 8 mode , the tab are hidden which I think is a good style. But I cant see any option to see them when I want. I just can see them when I open a new window. And select the option "open in the new window", it just show the tab bar which is not like the original version of Firefox. And also the search engine here is bing.com . How to change it.

    Where did you see Aurora as a Windows 8 application?
    Aurora is not the name of a version but one of the four main development channels. They are Release (26.0), Beta (27.0b9 currently), Aurora (28.0a2) and Nightly (29.0a1). When Firefox 27.0 is released on Feb 4 the versions will move/merge to next channel around time also.
    Aurora is not meant for regular use as Aurora and Nightly gets checkins almost everyday and they get a update each of those days.
    Also there is a good chance that the Australis that many people dislike will move with 29.0 from Nightly to the Aurora channel next week.
    Edit:
    Hmm you may have seen older articles like https://blog.mozilla.org/futurereleases/2013/09/21/help-test-a-preview-of-firefox-optimized-for-windows-8-tablets/
    At the time of that article, version Firefox 26.0 was being developed early on the Aurora channel.

Maybe you are looking for