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


Groups > comp.lang.java.gui > #1611 > unrolled thread

How to disable maximum&mi

Started by"hardemr" <hardemr@THRWHITE.remove-dii-this>
First post2011-04-27 15:34 +0000
Last post2011-04-27 15:34 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  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

#1611 — How to disable maximum&mi

From"hardemr" <hardemr@THRWHITE.remove-dii-this>
Date2011-04-27 15:34 +0000
SubjectHow to disable maximum&mi
Message-ID<1178831980.559902.309550@h2g2000hsg.googlegroups.com>
  To: comp.lang.java.gui
Hello Everyone,

I have a problem. How can i disable maximum and minimum icon on the
jFrame?

Best Regards,

Emrah
Ankara/Turkey

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

[toc] | [next] | [standalone]


#1612 — Re: How to disable maximu

From"Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this>
Date2011-04-27 15:34 +0000
SubjectRe: How to disable maximu
Message-ID<4643d097$1@dnews.tpgi.com.au>
In reply to#1611
  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

[toc] | [prev] | [next] | [standalone]


#1613 — Re: How to disable maximu

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:34 +0000
SubjectRe: How to disable maximu
Message-ID<7200d8adeda86@uwe>
In reply to#1611
  To: comp.lang.java.gui
hardemr wrote:

>... How can i disable maximum and minimum icon on the
>jFrame?

A JFrame?  To get part of that, you can simply lock 
the size of the frame..

<sscce>
import javax.swing.JFrame;

class UnResizableFrame extends JFrame {

   public static void main(String[] args) {
      JFrame f = new JFrame("Not Resizable");
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setSize(400,200);
      f.setLocation(50,50);

      // lock the size
      f.setResizable(false);

      f.setVisible(true);
   }
}
</sscce>

.the JFrame can still be minimized to the taskbar,
in this example.

-- 
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200705/1

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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web