Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #441

Re: Windows Decoration Li

From "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Subject Re: Windows Decoration Li
Message-ID <LOIhh.25163$6J4.10816@newsfe08.phx> (permalink)
Newsgroups comp.lang.java.gui
References <1166481378.405097.235620@80g2000cwy.googlegroups.com>
Date 2011-04-27 15:27 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Michael Dunn wrote:
>> there doesn't seem to be any way to see actions on the title bar on a JFrame.
> 
> seems to work OK like this, but the frame might not be what you want.
> 
> import javax.swing.*;
> import java.awt.*;
> import java.awt.event.*;
> class Testing
> {
>   public void buildGUI()
>   {
>     JFrame.setDefaultLookAndFeelDecorated(true);
>     final JFrame f = new JFrame();
>     f.setSize(400,200);
>     f.setLocationRelativeTo(null);
>     f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>     f.setVisible(true);
>     f.addMouseListener(new MouseAdapter(){
>       public void mousePressed(MouseEvent me){
>         if(me.getY() < f.getRootPane().getInsets().top +
>                               f.getContentPane().getY())
>         {
>           System.out.println("Title bar clicked");
>         }
>       }
>     });
>   }
>   public static void main(String[] args)
>   {
>     SwingUtilities.invokeLater(new Runnable(){
>       public void run(){
>         new Testing().buildGUI();
>       }
>     });
>   }
> }
> 

Michael:

That doesn't work in my WinXP SP2 box running Sun's 1.6 JDK.

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Windows Decoration Listen "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: Windows Decoration Li "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: Windows Decoration Li "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: Windows Decoration Li "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: Windows Decoration Li "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
    Re: Windows Decoration Li "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
      Re: Windows Decoration Li "Thomas Hawtin" <thomas.hawtin@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000
  Re: Windows Decoration Li "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:27 +0000

csiph-web