Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1612
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail |
|---|---|
| From | "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> |
| Subject | Re: How to disable maximu |
| Message-ID | <4643d097$1@dnews.tpgi.com.au> (permalink) |
| X-Comment-To | comp.lang.java.gui |
| Newsgroups | comp.lang.java.gui |
| In-Reply-To | <1178831980.559902.309550@h2g2000hsg.googlegroups.com> |
| References | <1178831980.559902.309550@h2g2000hsg.googlegroups.com> |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] |
| Lines | 60 |
| Date | Wed, 27 Apr 2011 15:34:20 GMT |
| NNTP-Posting-Host | 96.60.20.240 |
| X-Complaints-To | news@tds.net |
| X-Trace | newsreading01.news.tds.net 1303918460 96.60.20.240 (Wed, 27 Apr 2011 10:34:20 CDT) |
| NNTP-Posting-Date | Wed, 27 Apr 2011 10:34:20 CDT |
| Organization | TDS.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1612 |
Show key headers only | View raw
To: comp.lang.java.gui
"hardemr" <emrahayanoglu@gmail.com> wrote in message
news:1178831980.559902.309550@h2g2000hsg.googlegroups.com...
> Hello Everyone,
>
> I have a problem. How can i disable maximum and minimum icon on the
> jFrame?
this works OK using java 1.5.0_05 on win xp,
but not guaranteed to work using other versions/platforms
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing
{
int count = 0;
public void buildGUI()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame f = new JFrame();
f.setSize(400,300);
f.setLocationRelativeTo(null);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
disableMinMax(f);
f.setVisible(true);
}
public void disableMinMax(Component comp)
{
if (comp instanceof JButton && count < 2)
{
comp.setEnabled(false);
MouseListener[] listeners = comp.getMouseListeners();
for(int x = 0, y = listeners.length; x < y; x++) comp.removeMouseListener(listeners[x]);
count++;
}
if (comp instanceof Container)
{
Component[] comps = ((Container)comp).getComponents();
for(int x = 0, y = comps.length; x < y; x++)
{
disableMinMax(comps[x]);
}
}
}
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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to disable maximum&mi "hardemr" <hardemr@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000 Re: How to disable maximu "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000 Re: How to disable maximu "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:34 +0000
csiph-web