Re: Windows Decoration Listeners? - Problem Solved
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Dec 2006 19:14:51 -0800
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/
.
- Follow-Ups:
- Re: Windows Decoration Listeners? - Problem Solved
- From: Thomas Hawtin
- Re: Windows Decoration Listeners? - Problem Solved
- From: Michael Dunn
- Re: Windows Decoration Listeners? - Problem Solved
- References:
- Windows Decoration Listeners?
- From: Jason Cavett
- Re: Windows Decoration Listeners?
- From: Knute Johnson
- Re: Windows Decoration Listeners? - Problem Solved
- From: Jason Cavett
- Re: Windows Decoration Listeners? - Problem Solved
- From: Michael Dunn
- Windows Decoration Listeners?
- Prev by Date: Re: graph use.......
- Next by Date: Re: closing a specific JFrame of several
- Previous by thread: Re: Windows Decoration Listeners? - Problem Solved
- Next by thread: Re: Windows Decoration Listeners? - Problem Solved
- Index(es):
Relevant Pages
|
|