Changing window state by JFrame

Hi guys,
I want to maximize a JFrame window, bit I dont know how.
I tried it with
public void maximizeWindow() {
frame.setExtendedState(Frame.MAXIMIZED_BOTH); // frame is the instance of JFrame
}I too tried it with Frame.MAXIMIZED_VERT and Frame.MAXIMIZED_HORIZ, bit it didn't work.
About a quick help I would be very happy.

package fi.stuff.testing;
import javax.swing.JFrame;
import java.awt.Frame;
public class Test
     public static void main(String[] args)
          JFrame frame = new JFrame("Maximized");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setExtendedState(Frame.MAXIMIZED_BOTH);
          frame.setVisible(true);
}It does work here. Have you perhaps set setResizable(false)?
Cheers

Similar Messages

  • Invalid request for a change in window state

    Ok...
    Creating a JSR168 portlet and it works fine in Pluto, but I get the following when I deploy to P7:
    ERROR: Content not available. REASONE: Invalid request for a change in window state
    Here is what the portlet is supposed to do:
    * Display a form
    * User clicks find
    * Lookup is performed
    * Window state in processAction() method of portlet is changed to MAXIMIZED
    * I'm guessing this is where the error is occuring
    I also think that for the TableContainer, I have some sort of attribute incorrect having to do with one of the channelsIs values.
    I tried toggling them one way or another without any effect.
    Suggestions?

    Ive run into this issue also. I need a way for a portlet to change to its maximized state for the purposes of user registration. Is there anyway this can be done? I know that sun jsp "Providers" which are shown on their example desktop, have some sort of maximized state that they can go into, but im not sure how to use this in a portlet.
    There seems to be very inconsistent support between the proprietary sun provider api, and the portlet api.

  • Remembering Window State

    Various threads have addressed parts of this topic, but I haven't seen a complete workable solution so far. Here's the problem:
    When my application starts, it's supposed to restore its main window (a JFrame) to the state it had when it was last closed (unless it was minimized). If it was maximized, it should maximize automatically, otherwise it should open with the same location & dimensions it last had. As the application runs, I monitor changes in size, location & maximized state, then save them to a properties file when it exits.
    Mostly, this is working OK, but I'm having a problem the ComponentListener. When the user maximizes the window, the componentMoved method is called, but at that point the Frame state doesn't indicate the window is maximized. So I save the window coordinates, but they turn out to the wrong coordinates, because the window is maximized. Here's my componentMoved method:
    * Saves new position when frame moves.
    * @param event The event being handled.
    public void componentMoved(ComponentEvent event)
       Object source = event.getSource();
       if (source instanceof UprrFrame)
          UprrFrame frame = (UprrFrame)source;
          if (frame.isMaximized() == false)
             frame.saveBounds();
    }The frame.IsMaximized method looks like this:
    * Determines whether the frame is currently maximized.
    * @return <b><code>True</code></b> if maximized.
    public boolean isMaximized()
       int state = getExtendedState();
       boolean maximized = (state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH;
       return maximized;
    }I'm, not sure if I'm doing something wrong, or whether I've stumbled across an AWT/Swing bug. Any insights would be greatly appreciated!
    P.S. I'm running JDK 1.4 under Windows XP.

    If your solution works for you, then thats all good. However, i'll add this for completion...
    Actually, the invokeLater in componentMoved does not always work in this case... it might seem to work all the time, but in reality, it's just luck that it's working. If you test it in enough environments, or with slower machines, you'll see what I mean.
    Basically, you are trying to time it so that the test for frame maximization occurs after the window state change event. However, the window state change events are caused by asynchronous native window events.. and if the machine is slow enough (or perhaps fast enough), the invoke later is executed too sonn, and it says the frame is not maximized when it is.
    You need to save the window location in componentResized, and rollback the save transaction when you hear a window state changed event from NORMAL -> BOTH_MAXIMIZED.

  • 8.1, Change pageflow state from event listener

    Hi,
    I've implemented an event listener in a backing file (like in the custom event
    tutorial ).
    The backing file is assigned to a portlet.
    Is it possible to change the state of the portlets pageflow when an event is received?
    I want to reset the pageflow so that the 'begin' action is executed again.
    From the tutorial and sample portal I found out, that how to change the window
    mode or the visibility, but I can't find any methods for setting the current url/action.
    Another solution would be to setup a listenTo relationship and redirect the incoming
    actions to the 'begin' action. What I'm missing here is the possibility to trigger
    such an event from a page flow (which is possible when using custom events). Can
    this be done?
    Bye
    Achim

    try to go to Control Panel\All Control Panel Items\Administrative Tools
    Disable and set the trigger as never at task scheduler > time sync
    You can also try to clean boot
    http://support.microsoft.com/kb/929135/en-us

  • Animation Window state save is inconsistent

    Photoshop 10-E does not consistently save the state of the animation window. Often it opens in Timeline mode, which means I have to set it to Frames mode, change the loop mode, and change the default frame timing, before I can even start work. I'm guessing that it's designed to save state because it does so about half the time. This is not a big issue but it's annoying and it's just one of many small annoyances that are making this version a pain in the *** to use.
    I've tried saving a workspace but it doesn't appear to save the state of the animation window, at least not consistently.
    Any suggestions about how to fix this?

    If your solution works for you, then thats all good. However, i'll add this for completion...
    Actually, the invokeLater in componentMoved does not always work in this case... it might seem to work all the time, but in reality, it's just luck that it's working. If you test it in enough environments, or with slower machines, you'll see what I mean.
    Basically, you are trying to time it so that the test for frame maximization occurs after the window state change event. However, the window state change events are caused by asynchronous native window events.. and if the machine is slow enough (or perhaps fast enough), the invoke later is executed too sonn, and it says the frame is not maximized when it is.
    You need to save the window location in componentResized, and rollback the save transaction when you hear a window state changed event from NORMAL -> BOTH_MAXIMIZED.

  • Change the statis SQL to dynamic

    To save the shared pool, I set cursor_sharing=force.
    Since the AP developer send several hundreds SQL just different in riteral,
    the response time improved. And till now no problem happened with us.
    But it is told that there are some problems with the parameter.
    my question:
    1). Do any body using this paramter?
    Are there any problem with your system?
    Please let me know your OS and ORACLE version.
    We are using WINDOWS NT and oracle8.1.7.1.1
    2). If anybody know the java tool to change the statis SQL
    to a Dynamic SQL?
    Thanks for all the helps.

    I don't have the answers to these two questions, however your problem sounds like it could be more effectively dealt with by more resources. You may want to request a memory upgrade it at all possible and just up the size of the shared pool to deal with all the different queries. When your users eventually get around to repeating the queries they'll still be there.
    I know tuning is almost always the best answer, but you've got a problem bigger than a performance tuneing measure can fix.

  • Window state persistance

    Hi
    I am using the Desktop Application provided by Netbeans 6.5 for window state persistence. I have a Jtable. If I change the JTable column widths, close the application and reopen it, the state is saved. But if I change the order of the columns, the state is not retained?
    Is there any way to persist the JTable column ordering?

    The column ordering is not saved as a object "state" sorry. However, you should be able to access the JDA (jDesktop Application) underlying table object and get a reference to the JTable's Table Model and pick out the column ordering, then save that as a Resource. Once you have done that, you'll need to fidget with the initialization code for the table object in order to restore the table model's column ordering. I say fidget because the first time the app is run, you'll obviously not have any saved resource data, but it would be created after that and you can keep going as normal thereafter.
    Enjoy.

  • How do I adjust text size in toolbar, in tandem with browser text zoom, WITHOUT limiting the screen space of my browser window as a whole? Changing Windows DPI reduces browsability of window as displayed.

    I tried to customize PC settings for my mom, whose site is failing. So I plugged in the nosquint Firefox addon and upped the font size. Additionally, I tried to make desktop text etc. (non-browser text) larger. When I accomplished this through the Windows DPI adjustment, the browser would not open to full screen width (at least, not through any means other than F11, which is something beyond my mother's understanding or patience). With DPI 120, the maximized browser will not go full screen, but will instead hold left of screen, and display less than the full width of the page being viewed (this make my mom give up. And who wants to scroll laterally anyways?). Is there some way to pair the functionality of Windows DPI boosts with Firefox text/window zoom? Thanks.
    == This happened ==
    Every time Firefox opened
    == I changed Windows DPI to >196

    See [[Toolbars and page content appear too large after upgrading to Firefox 3]]
    Try to adjust the DPI setting, see [http://kb.mozillazine.org/layout.css.dpi layout.css.dpi]
    Try to set the pref layout.css.devPixelsPerPx to 2 on the about:config page.
    To open the ''about:config'' page, type '''about:config''' in the location (address) bar and press the Enter key, just like you type the url of a website to open a website.
    If you see a warning then you can confirm that you want to access that page.

  • How can I change the state of a runtime menu item programati​cally?

    Using LabView 6.1, I would like to change the state of the runtime menu item "Operate/Print at completion".
    The goal here is to print the VI front panel according to the operator choice (OK ->print, Cancel ->don't print)
    In a first release, I put a Stop function at the dialog output (activated by the cancel button) but this function stop the complete application and my idea where to stop only the VI in which the dialog is running.
    In a second release, I've tried to use the "Application
    control/Menu" but I receive every time an error:
    Error 88 occured at Cannot modify application menu item in the printtest.vi.
    Possible reasons: LabView, Runtime menu error...
    Any suggestion is appreciated.
    Re
    gards,
    phidu

    Instead of using the print at completion option, print the VI programatically if the user selects to print...open a reference to the VI you want to print and use an invoke node to print vi to printer.
    Alternatively create another VI with a layout optimized for printout, set it to print at completion and run and load the data into that VI if and only if the user OKs the print...
    Mads
    MTO

  • My setup: iMac hardline to Canon i960 printer. Issue: endless printing of the same document. The printer window states that the pinter is in use and there is nothing listed in the Print Queue.  How can I stop printing the document?

    My setup: iMac hardline to Canon i960 printer. Issue: endless printing of the same document. The printer window states that the pinter is in use and there is nothing listed in the Print Queue.  How can I stop printing the document?

    Soution: Delete the printer and add the same printer back in, therefore creating a new print queue.

  • How can I change a State name in iphoto map?

    A few months ago, changing a location of a group of photos, I really changed a state name.
    The image shows the name State "Casa David i Mireia" where should say "Catalunya" that is the real name.
    How can I change that name. I have opened a case in Apple Support, but the solution to reinstal the app have not worked for me.
    Thank you for your help
    Jordi

    Thanks for your help!
    The problem is that I think that I changed the "default" name for the state where the photos were taken. I have 50 differents locations, that are all correct, and photo per photo, I can modify the original location, but only at "local" level.
    How can I change the name displayed in State section as "Casa David i Mireia" for "Catalunya" that is the real name for the State where the photos where taken?
    I don't if this post is comprehensive. I'm not sure.
    Thanks for your time!
    Jordi

  • My 3 year-old macbook pro is very slow. I have run disk utility and virus scan with no improvement. The "beach ball" will spin for minutes at a time when opening, closing or changing windows. Apple Store looked at it a few months ago with no help.

    my 3 year-old macbook pro is very slow. I have run disk utility and virus scan with no improvement. The "beach ball" will spin for minutes at a time when opening, closing or changing windows. Apple Store looked at it a few months ago with no help. What can I do?

    Under CPU: 3.5% user; 5% system; 91% idle; 441 threads; 90 processes.
    Under System: out of 2GB - 54.7MB free; 530MB wired; 603MB active; 862MB inactive; 1.95GB used.
    Is too much of the system memory tied up? If so, what can I do to free some up?

  • Is it possible to change application state from a component?

    I was wondering if it is possible to change application state from within a custom component and if so, what would the syntax be if I had an application named "zzz" and I wanted to change the app state from "state1" to "state2" from my component?
    Thanks!

    Hi,
    you always have a static class Application.
    Application.application will be the root component. After that you can change it state.
    Application.application.currentState = "state2";
    But it's not the best way to change states. It's better to dispatch events from components and change states in listeners.

  • What is the best practice for changing view states?

    I have a component with two Pie Charts that display
    percentages at two specific dates (think start and end values).
    But, I have three views: Start Value only, End Value only, or show
    Both. I am using a ToggleButtonBar to control the display. What is
    the best practice for changing this kind of view state? Right now
    (since this code was inherited), the view states are changed in an
    ActionScript function which sets the visible and includeInLayout
    properties on each Pie Chart based on the selectedIndex of the
    ToggleButtonBar, but, this just doesn't seem like the best way to
    do this - not very dynamic. I'd like to be able to change the state
    based on the name of the selectedItem, in case the order of the
    ToggleButtons changes, and since I am storing the name of the
    selectedItem for future reference.
    Would using States be better? If so, what would be the best
    way to implement this?
    Thanks.

    I would stick with non-states, as I have always heard that
    states are more for smaller components that need to change under
    certain conditions, like a login screen that changes if the user
    needs to register.
    That said, if the UI of what you are dealing with is not
    overly complex, and if it will not become overly complex, maybe
    states is the way to go.
    Looking at your code, I don't think you'll save much in terms
    of lines of code.

  • Change a state in main.mxml from a script in another mxml

    Hi,
    i'm having some trouble with my application, let's say i have the main application file called MAIN.MXML
    in wich i have set different States, and have different forms.
    now i have a form called loginForm which contains the textInput item for Login and Password, i also have a link Need to Register
    which onClick will change the state to show in the same panel a different form registerForm (with the relevant textInput items)
    now the MAIN.MXML includes a custom component called <comp: NetworkManager /> which includes all the logic scripts and MXML
    tags to create and manage an HTTPService request to a PHP Server.
    when the user click on the Login button, this will call a function included in the main.as script (imported in MAIN.MXML) which
    will call a function in the script within NetworkManager.MXML passing all the form data.
    in NetworkManager.MXML the script will create an XML message, will send to the PHP Server and wait the response... if this comes
    true the user is authenticated, otherwise is not.
    so far so good, i get the message sent, the correct response back. Now i want to hide the form in MAIN.MXML and put something like
    Welcome firstName lastName!! instead. But i don't know how to do it. If i try to access the states in MAIN.MXML from the NetworkManager.MXML
    i'll get all sort of errors which i don't have it here with me.
    I know this sounds like a newbie question, and it really is ... any taker?
    your help is much appreciated.
    thanks
    T.

    Hi,
    i've tried RemoveChild but i get an error like:
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$removeChild()[C:\autobuild\3.2.0\frameworks\p rojects\framework\src\mx\core\UIComponent.as:5096]
    at mx.core::Container/removeChild()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\ core\Container.as:2274]
    at components::NetworkManager/sendUserAuthHandler()[C:\Documents and Settings\Tom\My Documents\flex_prj\Shoppy\src\components\NetworkManager.mxml:182]
    at components::NetworkManager/serverHandler()[C:\Documents and Settings\Tom\My Documents\flex_prj\Shoppy\src\components\NetworkManager.mxml:98]
    at components::NetworkManager/__serverRPC_result()[C:\Documents and Settings\Tom\My Documents\flex_prj\Shoppy\src\components\NetworkManager.mxml:290]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\3.2.0\framewor ks\projects\rpc\src\mx\rpc\http\mxml\HTTPService.as:290]
    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\ projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
    at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responde r.as:43]
    at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:74]
    at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\s rc\mx\messaging\channels\DirectHTTPChannel.as:403]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()
    who is the caller of loginForm then? i've tried with Application.application.loginForm but i do get the same error though.
    loginForm is contained in a Canvas item, is it the caller? or who else?
    thanks
    T.

Maybe you are looking for