Results 1 to 2 of 2
- 02-02-2013, 06:57 AM #1
Member
- Join Date
- Jan 2013
- Posts
- 9
- Rep Power
- 0
Click in JFrame Titlebar sets the JFrame Opaque
Hi,
I have a JFrame that I would like to set Opaque when the MouseButton is held down on the TitleBar and moved and returns to solid when released. I have two problems.
(1) The only way I could get the Opacity to work was by setting: JFrame.setDefaultLookAndFeelDecorated(true); This works but changes the Titlebar to a really ugly non-Windows look and feel Titlebar. Would like it to work without changing the Windws look and feel.
(2) Second problem is that when I click on the Titlebar, I cannot move the JFrame.
Java Code:JFrame.setDefaultLookAndFeelDecorated(true); win=new JFrame("Calculator"); win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); win.setBounds(400,200,335,630); win.setResizable(false); win.setFocusable(true); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) { System.err.println("Translucency is not supported"); } win.getLayeredPane().getComponent(1).addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me){ win.setOpacity(0.65f); } public void mouseReleased(MouseEvent me){ win.setOpacity(1.0f); } });
- 02-02-2013, 07:29 AM #2
Re: Click in JFrame Titlebar sets the JFrame Opaque
Cross posted
Click in JFrame Titlebar sets the JFrame Opaque (Swing / AWT / SWT forum at JavaRanch)
Didn't bother to reply to one response there before posting here.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
How to remove a JPanel from a JFrame after a button click, and add a new one ?
By fatabass in forum New To JavaReplies: 8Last Post: 02-23-2012, 06:08 PM -
Calling another JFrame from a JFrame through a JButton...(Help Reqired)
By nish.singha20 in forum AWT / SwingReplies: 3Last Post: 11-27-2011, 05:18 AM -
to pass a parameter from a jframe children to its jframe mother
By anix in forum NetBeansReplies: 5Last Post: 06-14-2010, 06:10 PM -
How to make a Jframe un-focusable when another Jframe is active?
By Robert_85 in forum Advanced JavaReplies: 4Last Post: 04-22-2009, 11:02 PM -
How to detect double click with a JFrame
By Jary316 in forum New To JavaReplies: 3Last Post: 01-05-2009, 08:39 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks