How to make JFrame window un-resizable?

I create a window using JFrame. I don't want user to re-size the window. How can I do that? Thanks!

JFrame f = new JFrame();
f.setResizable(false);
Jframe entends frame
setResizable() is a method in frame
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Frame.html#setResizable(boolean)

Similar Messages

  • How to make JFrame become the topmost window?

    I have server that is supposed to show a TOPMOST JFrame window each time it gets a "Show Window" command from client. I use JFrame to create and show the window in the server code:               
    JFrame mainWin = new JFrame();
    mainWin.setResizable( false );
    Container mainContainer = mainWin.getContentPane();
    mainContainer.setLayout( null );
    // add components to mainContainer
    mainWin.setVisible( true );
    mainWin.show();
    mainWin.toFront();
    If I run the server under windows platform, the first created JFrame window is always hiding behind under other application windows. However, the JFrame windows other than the 1st one are always at top.
    The BAD thing is, if I run the server under Macintosh platform, the JFrame windows are always hiding behind the other application windows.
    Does anyone know how to fix the problem? i.e., making the JFrame window appear on top of other windows under any platforms?
    Thanks.
    ZZ
    p.s. I am using JDK version is 1.3.0.

    there is some weirdness with java I've noticed under windows during development. When you start the app from a console window or script, if you change focus to another window before the first java window shows up, it will show up behind the window you changed focus to. If you leave it alone until the window shows, it will be on top. A work around is after you call show(), call toFront().

  • How to make JFrame positioned to lower right corner of user's desktop

    I'm a new java user, and I'm working on building a small
    application. When the application is launched, I would
    like the application (JFrame) window to be positioned
    in the lower right corner of the user's desktop. Does
    anyone know how to get the user's desktop size so
    I can position the application.
    Here is a code snippet where I lauch the app.
    public static void main(String args[]) {
    ArchiveRestore mainFrame = new ArchiveRestore();
    mainFrame.setSize(500, 500);
    mainFrame.setTitle("Master Model Automation");
    mainFrame.setVisible(true);
    Thanks
    -cliff

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Will get the screen size. The Toolkit class is in the java.awt package.

  • How to make jframe transparent?

    Hi
      some software's uses the monitor as a whiteboard to draw or to type text. How is this possible? I mean i thought that by making a  jframe (full screen) transparent we should be able to do this?   Is my understanding right? if so how to make the jframe transparent? when jframe is transparent will we be able to draw on it?

    Try this:
    public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
      @Override public void run() {
      JFrame f = new JFrame();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setUndecorated(true);
      f.setBackground(new Color(0,0,0,0));
      f.setExtendedState(JFrame.MAXIMIZED_BOTH);
      f.add(new JComponent() {
      @Override protected void paintComponent(Graphics g) {
      g.setColor(Color.BLUE);
      ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      g.fillOval(0, 0, getWidth(), getHeight());
      f.setVisible(true);
    Message was edited by: 946128 in respose to PhHein's comment

  • How to make dos window scrollable under win98?

    Hi, I am using win98, every time when I run my GUI application, whenever I got bunch of error message that can not be displayed in one window, I will miss the original error information. Can anyone tell me how to make my dos window scrollable so that I can view all error message.
    Thanks a lot.

    I don't think that you can do this. There is another way, however: When java throws an exception, if it is not caught in your program, it is sent to the standard error, which is the console. You can simply reset this to be a file, so you can read this to get all the error info. Try using the following code in your main method:
      public static void main(String[] arg) {
        try {
          System.setErr(new PrintStream(new FileOutputStream(new File("Errors"))));
          //instantiate your main class here
          MyClass mc=new MyClass(); //or whatever
        } catch (Exception _ex) {     
          System.out.println("An error occurred"); //exception get sent to standard error automatically, so there
                                  //is no real need to catch this exception. However, I use it to display
                                  //a message on the console to let me know an error has occurred.
          System.err.println(_ex.getMessage()); //and finally, print the exception to file
          _ex.printStackTrace();
      }

  • How to make a window fixed in size

    Hi,
    Is there a method with which I can prevent the user from resizing the current window/Form
    Secondly, which event is generated when a window is resized?
    Thankx in advance...

    1. You can use the setResizable( false ) method of the Frame class.
    2. You will need to add a listener to the addComponentListener() method of the Frame

  • How to make flash content which resize according to the broswer window

    Hi gus,
    I am doing a presentation now...but the problem i am facing
    is cos of the size of the content....what i need is when the users
    resizes the brower window, the flash content should also resize to
    fit in the window without using scrollbars....u can take a look at
    the URL to see a sample of how it is done.........
    http://www.adobe.com/products/robohelp/productinfo/features/brz_tour/
    Can somebody please help me with this./..thanks in
    advance.....

    Go to File -> Publish Settings.
    Check the 'HTML' box in the Formats tab.
    Go to the HTML tab and choose 'Percent' from the Dimensions
    dropdown.
    Set Width and Height to 100.
    Export your movie and the HTML file will contain the correct
    embedding code.

  • How to make main window (JFrame)as full screen in java??

    Hi all ,
    I got in some trouble for JFrame. I want my main window as full screen(maximum size as moniter ) ,
    now i am using jframe.setBounds(0,0,1000,900) method for fixing its size.
    any body is having idea to maximize window size by default???
    gavin

    Hi
    use this to get the screen size.
    so as to fit your gui to its size.
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

  • How to make JFrame scrollable?

    How can I make a JFrame scrollable? So that when I resize the JFrame to a smaller size the contents remain accessible? The way it is now is that when I resize a JFrame I can't access the components that fall out of the window (I'm using absolute component positioning within the JFrame). I thought adding two scrollbars to take care of this would be easy, but so far I haven't been able to get it right. Any suggestions would be appreciated.

    Why dont you put all your components in a JPanel, add a scrollpane to it and then add that JPanel to
    ur JFrame.
    += KRR

  • How to make JFrame default Maximum size state?

    Hi all,
    Is there any one know how to construct a JFrame that setMaximum when screen show?
    another word mean the JFrame in Maximum state byb default.
    regards,
    elvis
    scjp

    Pheeeewww...
    Don't people ever search the forum and read older posts?
    Both the question and the partly wrong answer have appeared many, many times before.
    In pre-1.4 Java you simply cannot maximize a frame.
    The 'solution' is probably the best you can do, but it does not really maximize the frame:
    * The user can still move/resize it.
    * It does not take into account the size/position of the windows task bar or any other window manager palette windows.
    There also has been a solution that uses the Robot class to simulate a click on the maximize button, but that's a real dirty trick, that won't work in applets and strongly depends on the exact layout of the window's decorations.
    In Merlin you can programatically maximize a frame as well as find out the screen's insets (resulting from the task bar...)
    Stephen

  • How to make New Windows open where I want!

    Every time I launch Safari, it opens the window on the left side of the screen. How to do get it to open on the right side? I'm sure there is a keystroke combination to reset the default position or AppleScript, but I can't find one. Any help would be greatly appreciated.
    Thanks in advance!

    I had the same problem way back. I finally gave up and now use the following applescript. Change the pixel coordinates of the top left and bottom right of the window, that appear in parentheses, to fit size of your screen. Mine is set for my 2x" early Cinema display.
    javascript:self.moveTo(190,0);self.resizeTo(1150,995)
    Make a bookmark put this script into the URL area of the bookmark (right side) and rename it to something like "my window size" and then put it in your bookmark bar folder. Then just click on it in the bookmark bar and window will move and resize to whatever you have entered in the parentheses.
    Fair winds and happy bytes, Dave Flory

  • How to make safari window open up to my size pref

    Sorry about the long subject title. Everytime I open safari on my Apple computers the safari window will open up in a different size or place. How can I set it to open to my own default like preference so that it covers the screen when I open safari.
    Does that make sense?
    Thanks!

    Thanks alot for the quick response. However, my problem is that I do resize the window with the lower right drag every time I open safari. It doesn't seem to save the setting or something. If I stretch it out huge....next time I open, it will be tiny, (and hitting the green button doesn't fix it) or in a different possition.
    Any other ideas?
    Thanks!

  • How to make download window open to front

    When I download a file, how can I make the download window automatically come to the front?

    THANK YOU! I don't know which idiot thought of removing the downloads window in favor of that ridiculous menu but I've been tearing my hair out trying to fix it. The old window has everything you need in one easy window while the menu requires multiple steps to check EACH download. I was ready to drop release 20 and go back to 19.

  • How to make a Window object Transparent

    hi all,
    how can i make an object of Window Class transparent.
    please help me out friends.

    This is a transparent window with an orange in it:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.peer.*;
    public class Tw extends JWindow implements FocusListener, MouseMotionListener, MouseListener
         Image     img,tim;
         Graphics  tig;
         Point     mp;
         Robot     r;
    public Tw()
         setBounds(170,170,100,100);
         try
              r = new Robot();
         catch(AWTException awe)
              System.out.println("robot excepton occurred");
         capture();
         addMouseMotionListener(this);
         addMouseListener(this);
         addFocusListener(this);
         setVisible(true);
    public void mouseDragged(MouseEvent m)
         if (mp == null) return;
         Point p = m.getPoint();
         int x = getX()+p.x-mp.x;
         int y = getY()+p.y-mp.y;
         setLocation(x,y);
         paintP(getGraphics());
    public void mouseMoved(MouseEvent m)
    public void mouseClicked(MouseEvent m){}
    public void mouseEntered(MouseEvent m){}
    public void mouseExited(MouseEvent m) {}
    public void mouseReleased(MouseEvent m)
         mp = null;
    public void mousePressed(MouseEvent m)
         mp = m.getPoint();
    public void focusGained(FocusEvent fe)
         setSize(0,0);
         capture();
         setSize(100,100);
    public void focusLost(FocusEvent fe)
    public void capture()
         Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
         img = r.createScreenCapture(new Rectangle(0,0,d.width,d.height));
    public void captureX()
         Rectangle rect = getBounds();
         setVisible(false);
         Thread.yield();
         Image xmg = r.createScreenCapture(rect);
         img.getGraphics().drawImage(xmg,rect.x,rect.y,rect.width,rect.height,null);     
         setLocation(rect.x,rect.y);
         setVisible(true);
    public void paint(Graphics g)
         Rectangle rect = g.getClipBounds();
         if (tim == null)
              tim = createImage(getWidth(),getHeight());
              tig = tim.getGraphics();
         if (!rect.getSize().equals(getSize())) captureX();
              else                               paintP(g);
    public void paintP(Graphics g)
        tig.drawImage(img,0,0,getWidth(),getHeight(),
                           getX(),getY(),getX()+getWidth(),getY()+getHeight(),null);
         tig.setColor(Color.orange);
         tig.fillOval(10,20,70,80);
         tig.setColor(Color.green);
         tig.fillOval(21,16,20,10);
         tig.fillOval(40,02,11,21);
         g.drawImage(tim,0,0,null);
    public void update(Graphics g)
         this.paint(g);
    public static void main (String[] args) 
         new Tw();
    }Noah

  • How to make JFrame ToFront to all applications

    HI
    My problem is i have a JFrame where in i have a JCheckBock and when i check it my frame should be top from all applications opened(like MS Word,notepad or any window) and when it is dechecked it should be back when any application is opened . I tried in solaris by using toFront() but no result is found any suggestions please...

    You should use JLayeredPane as container of your objects. It has a method called "setLayer", or similar, through which you can assign Z-Order to the objects contained in it.
    See the JDK Documentation on "JLayeredPane" topic.

Maybe you are looking for

  • Activation issue Macromedia Studio MX 2004

    Can anyone tell me how to activate Studio MX 2004? I've had this software for years and now I have a new computer and I need to continue to use it. I realise that it is old software but it meets my needs and I have no interest in more bells and whist

  • Charger going on and off

    My charger has randomly stopped working right. the light goes on and off, usually off. if i press hard on the box part of the charger then the light will come back on. i'm assuming the connection isn't being made well, since it seems to increase with

  • Find ECC idoc using PI message

    Hi all, I have PI messages. To find respective ECC idoc, 1) i am going inside a message in SXMB_MONI. 2)Going to Call Adapter step. 3)In the SOAPHeader, there is a sub step called "IdocOutbound". There, i have idoc number. Further, i am trying to fin

  • Adobe Premiere Elements 8 is low on system memory.  XP

    Hi, I am running Adobe Premiere 8 on Windows XP 32 bit and I keep running into an error message that says Elements 8 is low on system memory.  Usually shortly after the program crashes and closes.  I've done some searching and the only fix I have fou

  • 8i Personal Ed. R3 V8.1.7 for Win98 zip has dupe files

    So that we may better diagnose DOWNLOAD problems, please provide the following information. - Server name - Filename PSORACLE81798.ZIP - Date/Time 6/26/02 22:00 - Browser + Version Internet Explorer 5.5 - O/S + Version Win 98 - Error Msg None The 8i