The Artima Developer Community
Sponsored Link

Java Answers Forum
setExtendedState() is not working (At least for me)

3 replies on 1 page. Most recent reply: Jan 25, 2005 11:39 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Sanjay Perera

Posts: 42
Nickname: angel6
Registered: Apr, 2004

setExtendedState() is not working (At least for me) Posted: Jan 22, 2005 7:59 PM
Reply to this message Reply
Advertisement
1) I using setExtendedState() method before using setVisible(true) and when executing simple JFrame form through command that method call is ignored i guess (Not responding for that). When I am executing through sun one studio that get called. It worked for command prompt only when I called setExtendedState() after setVisible(true). Any reason for that? Thanks for all the trouble!

2) As anyone know that passing primitive data types by reference is not allowed in Java and how this teachnique is fullfilled?

3) Is there are way to make arguements can be optional? I mean if the methodA(int numebr) requires an integer and if I simply call the method without a parameter it should not fail. So this is not possible due to method overloading mecahnism??? (C, C++ and etc supports this kind of mechanism even when method overloading is available).

Thanks for the trouble!!!!


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: setExtendedState() is not working (At least for me) Posted: Jan 24, 2005 5:54 AM
Reply to this message Reply
1. This code works fine.
public class MainFrame extends Frame {
  public MainFrame() {
    super();
setSize (800, 580);
    setExtendedState(MAXIMIZED_BOTH);
    show(); //or this.setVisible();
  }
}

Note that using windows only MAXIMIZED_BOTH works. The other 2 options (MAXIMIZED_VERT and MAXIMIZED_HORIZ don't have any effect.

2. It isn't allowed in any language because they DON'T HAVE a reference. That's why we call them primitive.
Use
Integer
instead of
int
if you want to have a reference.

3. This is the only way you should do it if you want to have a readable code.

public void method () { //no parameter
//here you can call
method (standardvalue);
}
public void method (int i) { //no parameter
//do something important
}

Sanjay Perera

Posts: 42
Nickname: angel6
Registered: Apr, 2004

Re: setExtendedState() is not working (At least for me) Posted: Jan 25, 2005 4:14 AM
Reply to this message Reply
Hello M. N.,
You have answered me all the time. Thanks!!!

1)
setExtendedState(MAXIMIZED_BOTH);
This is not working through command prompt execution. This worked only in SUN ONE STUDIO. This worked only for command prompt if I call this after setVisible(true);

2) Ok got it. I knew it had something to do with wrapper class (Hope my name term is correct (Integer, Float...)

3) Oh why I didn't think about that???

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: setExtendedState() is not working (At least for me) Posted: Jan 25, 2005 11:39 AM
Reply to this message Reply
Are you using a Frame or a JFrame?

it works fine with JFrame.


Maybe you have to set a standard dimension first, like I did.

Flat View: This topic has 3 replies on 1 page
Topic: need desktop icon Previous Topic   Next Topic Topic: path

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use