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


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

Re: Windows Decoration Li

From "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this>
Subject Re: Windows Decoration Li
Message-ID <1166481378.405097.235620@80g2000cwy.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <1166464557.075332.270460@l12g2000cwl.googlegroups.com><V
Date 2011-04-27 15:27 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui

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

---
 * 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