Iconified Windows

Hello,
I have a top level container as follows:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class WindowTest extends Window {
   int x = 0;
   int y = 0;
   int xPos = 0;
   int yPos = 0;
   public WindowTest(Frame parent) {
      super(parent);
      this.setSize(200,200);
      this.setBackground(Color.black);
      this.setLocation(200,200);
      this.show();
      addMouseListener(new MouseAdapter() {
         public void mousePressed(MouseEvent e) {
          x = e.getX();
             y = e.getY();
      addMouseMotionListener(new MouseMotionAdapter() {
         public void mouseDragged(MouseEvent e) {
            setLocation(getLocation().x+(e.getX()-x),
               getLocation().y+(e.getY()-y));
   public static void main( String[] args) {
      new WindowTest( new Frame());
}I want to add the ability to iconify this window object. Does anyone know how I can add this functionality to the WindowTest class? Can someone point me in the right direction??
Thank you in advance.

If you are using 1.4 you might look at the API docs for setExtendedState method for Frame. You can give it an iconified state.
Possibly you could use an undecorated frame and this method instead of using Window directly.

Similar Messages

  • Upgrading to FF 27 created huge (~1 GB/hr) memory usage for iconified windows on Mac 10.8

    Here is what I know about the problem:
    - Two different Macs (10.8.x, 10.9.x) with 32 GB RAM ran out of system swap due to the size of the Firefox process growing to over 20 GB, and both machines had virtually idle CPUs with no Firefox usage whatsoever - they were unattended
    - It occurred immediately after upgrading from Firefox 26 to 27.0.1
    - The set of pages, tabs, windows was the same before and after upgrading
    - There does not seem to be a single identifiable URL that causes the problem, but opening a window with this URL and then iconifying it causes memory to be leaked at a substantial rate (at least on one OS X 10.8.5 machine)
    - http://msdn.microsoft.com/en-us/magazine/cc163744.aspx
    - I normally have ~25 tabs distributed across ~8 windows, all of which but one are iconified
    - Memory is consumed at the staggering rate of ~1 GB/hour while the offensive window is iconified
    - Memory is not leaked per-se - about:memory confirms that heap-unclassified memory is growing rapidly, but as soon as the offending window is opened and no longer iconified, the memory usage immediately drops back to the normal ~1 GB or so - this is also verifiable in Activity Monitor.app, etc
    - The problem occurs in safe mode, but regardless the only plugins installed are Shockwave Flash, QuickTime, and Java Applet
    - I have killed Firefox repeatedly and can recreate the same memory usage pattern
    - I have at least one Mac, however, on which trying to reproduce this does nothing
    - I've already spent hours trying to determine even the initial cause of this

    Another user was talking about this issue on the forum and created a bug report.
    * [https://bugzilla.mozilla.org/show_bug.cgi?id=973776 Bug 973776 - Memory leak in Firefox 27.0.1 ]
    You can create another bug report or add your details into this report.

  • Script for Window tiling in openbox

    I wanted to use a tiling window manager but didn't want to leave openbox. So I started using PyTyle and PyTyle2 but they both took up more RAM than I could afford to let them use in my lowly desktop. So I wrote a script to do my tiling for me using wmctrl and xwininfo. And here are the results:
    GRID mode:
    BOTTOM MASTER mode:
    TOP MASTER mode:
    LEFT MASTER mode (also the default) :
    RIGHT MASTER mode:
    MAX mode:
    HORIZONTAL SPLIT mode:
    VERTICAL SPLIT  mode :
    The entire thing is just one bash script that I named wmtiler.sh
    The script itself is rather poorly written as I don't have much experience in bash.
    #!/bin/bash
    # use wmctrl and xwininfo to tile windows
    #currently supports the "LEFT_MASTER" mode (default),
    # "RIGHT_MASTER" mode (-r) ,
    # "TOP_MASTER" mode (-t),
    #"BOTTOM_MASTER" mode (-b) ,
    #"GRID" mode (-g),
    #"MAX" mode (-m) ,
    # "VERTICAL_SPLIT" mode (-v) and
    #"HORIZONTAL_SPLIT" mode (-h)
    #NOTE: wmctrl sets the properties of the window itself i.e. the window manager's borders
    #and title bars are not taken into account while setting the coordinates. So for best results
    #set the window manager to display all windows undecorated
    #or manually set the title bar height here
    #List of things to do:
    # 1. Get the values of the TOP_MARGIN, BOTTOM_MARGIN, LEFT_MARGIN and RIGHT_MARGIN from the window manager
    # 2. Get the MASTER_WIDTH for the default LEFT_MASTER, RIGHT_MASTER layouts as a parameter , set a default if not provided
    # 3. Get the MASTER_HEIGHT for the default TOP_MASTER, BOTTOM_MASTER layouts as a parameter , set a default if not provided
    # 4. Get the NUMBER_OF_ROWS for the grid mode as a parameter, set a default if not provided
    # 5. Get the TITLE_BAR_HEIGHT from the window manager
    # 6. Restructure the code to use functions
    # 7. Provide mechanisms to increase/decrease the MASTER area
    # 8. Provide mechanisms to increase/decrease the number of windows in the MASTER area
    #List of bugs
    # 1. If called from a key combination, there may not be a :ACTIVE: window and in which case the results are not as desired.
    # 2. The title bar plays havoc with the height of windows
    #need to find a way to get these from the window manager
    TOP_MARGIN=18
    BOTTOM_MARGIN=18
    LEFT_MARGIN=0
    RIGHT_MARGIN=0
    TITLE_BAR_HEIGHT=17 #works best if all the windows are border less and this is set to zero
    #we are now using xwininfo to get these
    #HEIGHT=1080
    #WIDTH=1920
    #either set these in a file or calculate them from the screen properties
    MASTER_WIDTH=1344
    MASTER_HEIGHT=600
    #set the number of rows we want for the grid mode
    NUMBER_OF_ROWS=2
    #looks nice :)
    USELESS_GAPS=1
    #see what the user wants to do
    case $1 in
    "-g")
    MODE="GRID"
    "-m")
    MODE="MAX"
    "-v")
    MODE="VERTICAL_SPLIT"
    "-h")
    MODE="HORIZONTAL_SPLIT"
    "-t")
    MODE="TOP_MASTER"
    "-b")
    MODE="BOTTOM_MASTER"
    "-r")
    MODE="RIGHT_MASTER"
    MODE="LEFT_MASTER"
    esac
    #get the desktop parameters
    HEIGHT=`xwininfo -root | grep 'Height:' | awk '{print $2}'`
    WIDTH=`xwininfo -root | grep 'Width:' | awk '{print $2}'`
    #get the window parameters
    #get the current desktop
    CURR_DESK=` wmctrl -d | grep '* DG:'| awk '{print $1}'`
    #get the total number of windows.
    #NOTE: we are not directly using grep to get the windows from the current desktop as it may serve up some false positives
    TOTAL_WINDOWS=`wmctrl -lx | wc -l`
    #counter
    i=1
    #Assume that there are no windows in the current desktop
    WINDOWS_IN_DESK=0
    while [ $i -le $TOTAL_WINDOWS ] ; do
    CURR_LINE=`wmctrl -lx | head -n $i | tail -n 1`
    WIN_DESK=`echo $CURR_LINE | awk '{print $2}'`
    if [ $WIN_DESK -eq $CURR_DESK ] ; then
    #save the various window properties as supplied by wmctrl . Un comment rest if necessary. Include more if necessary
    WIN_XID[$WINDOWS_IN_DESK]=`echo $CURR_LINE | awk '{print $1}'`
    # WIN_XOFF[$WINDOWS_IN_DESK]=`echo $CURR_LINE | awk '{print $2}'`
    # WIN_YOFF[$WINDOWS_IN_DESK]=`echo $CURR_LINE | awk '{print $3}'`
    # WIN_WIDTH[$WINDOWS_IN_DESK]=`echo $CURR_LINE | awk '{print $4}'`
    # WIN_HEIGHT[$WINDOWS_IN_DESK]=`echo $CURR_LINE | awk '{print $5}'`
    #see if the window is "IsViewable" or "IsUnMapped" i.e minimized
    MAP_STATE=`xwininfo -id ${WIN_XID[$WINDOWS_IN_DESK]} | grep "Map State:" | awk '{print $3}'`
    #we don't want the minimized windows to be considered while allocating the space
    if [ "$MAP_STATE" == "IsViewable" ]; then
    WINDOWS_IN_DESK=$((WINDOWS_IN_DESK+1))
    fi
    fi
    i=$((i+1))
    done
    #get the xid of the active window.
    ACTIVE_WIN=`xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}'`
    #set the selected layout
    #NOTE: these would look better if they were individual functions :)
    case $MODE in
    "LEFT_MASTER")
    #define the properties of the master area
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    #set the width to the default MASTER_WIDTH
    W=$MASTER_WIDTH
    H=$(( HEIGHT -TOP_MARGIN - BOTTOM_MARGIN -TITLE_BAR_HEIGHT -USELESS_GAPS))
    #set the active window to the "master "area
    wmctrl -r :ACTIVE: -e "0,$X,$Y,$W,$H"
    #now that the master window has been set all further windows would have to start from here
    X=$((MASTER_WIDTH+USELESS_GAPS))
    #get whatever width is left
    W=$((WIDTH - MASTER_WIDTH -USELESS_GAPS))
    #the height would be equally shared by the rest of the windows
    H=$((H/(WINDOWS_IN_DESK - 1) - TITLE_BAR_HEIGHT -USELESS_GAPS ))
    i=0
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    #avoid setting the attributes of the active window again
    if [[ "${WIN_XID[$i]}" -ne "$ACTIVE_WIN" ]] ; then
    #set the attributes
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    #set the Y co-ordinate for the next window.
    Y=$((Y+H+TITLE_BAR_HEIGHT+USELESS_GAPS))
    fi
    #preselect the next window
    i=$((i+1))
    done
    "RIGHT_MASTER")
    #define the properties of the master area
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    #get whatever width is left
    W=$((WIDTH - MASTER_WIDTH -USELESS_GAPS))
    #the height would be equally shared by the non master windows
    H=$(((HEIGHT -TOP_MARGIN -BOTTOM_MARGIN )/(WINDOWS_IN_DESK-1) -TITLE_BAR_HEIGHT -USELESS_GAPS))
    i=0
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    #avoid setting the attributes of the active window
    if [[ "${WIN_XID[$i]}" -ne "$ACTIVE_WIN" ]] ; then
    #set the attributes
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    #set the Y co-ordinate for the next window.
    Y=$((Y+H+TITLE_BAR_HEIGHT+USELESS_GAPS))
    fi
    #preselect the next window
    i=$((i+1))
    done
    #set the co-ordinates for the MASTER_WINDOW
    X=$((W+USELESS_GAPS))
    Y=$TOP_MARGIN
    W=$MASTER_WIDTH
    H=$(( HEIGHT -TOP_MARGIN - BOTTOM_MARGIN -TITLE_BAR_HEIGHT -USELESS_GAPS))
    #set the active window to the "master "area
    wmctrl -r :ACTIVE: -e "0,$X,$Y,$W,$H"
    "TOP_MASTER")
    #define the properties of the master area
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    #set the width taking into acount the margins
    W=$((WIDTH-LEFT_MARGIN-RIGHT_MARGIN))
    H=$MASTER_HEIGHT
    #set the active window to the "master "area
    wmctrl -r :ACTIVE: -e "0,$X,$Y,$W,$H"
    #set the y co-ordinate
    Y=$((Y+H+USELESS_GAPS+TITLE_BAR_HEIGHT))
    #Distribute the width amon the remaining windows
    W=$((W/(WINDOWS_IN_DESK-1)))
    #set the new height
    H=$((HEIGHT-MASTER_HEIGHT-TOP_MARGIN-BOTTOM_MARGIN-TITLE_BAR_HEIGHT-USELESS_GAPS))
    i=0
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    #avoid setting the attributes of the active window again
    if [[ "${WIN_XID[$i]}" -ne "$ACTIVE_WIN" ]] ; then
    #set the attributes
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    #set the X co-ordinate for the next window.
    X=$((X+W+USELESS_GAPS))
    fi
    #preselect the next window
    i=$((i+1))
    done
    "BOTTOM_MASTER")
    #define the properties of the master area
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    #Distribute the width among the non master windows
    W=$(((WIDTH-LEFT_MARGIN-RIGHT_MARGIN)/(WINDOWS_IN_DESK-1)))
    #set the new height
    H=$((HEIGHT-MASTER_HEIGHT-TOP_MARGIN-BOTTOM_MARGIN-TITLE_BAR_HEIGHT-USELESS_GAPS))
    i=0
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    #avoid setting the attributes of the active window again
    if [[ "${WIN_XID[$i]}" -ne "$ACTIVE_WIN" ]] ; then
    #set the attributes
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    #set the X co-ordinate for the next window.
    X=$((X+W+USELESS_GAPS))
    fi
    #preselect the next window
    i=$((i+1))
    done
    #set the co-ordinates
    X=$LEFT_MARGIN
    Y=$((Y+H+USELESS_GAPS+TITLE_BAR_HEIGHT))
    W=$((WIDTH-LEFT_MARGIN-RIGHT_MARGIN))
    H=$MASTER_HEIGHT
    #set the active window to the "master "area
    wmctrl -r :ACTIVE: -e "0,$X,$Y,$W,$H"
    "GRID")
    #find the number of windows in the top row and in each subsequent row except for the bottom row.
    NORMAL_ROW_WINDOWS=$((WINDOWS_IN_DESK/NUMBER_OF_ROWS))
    #the bottom row ould have as many windows as the top row and any left over
    BOTTOM_ROW_WINDOWS=$((NORMAL_ROW_WINDOWS + WINDOWS_IN_DESK%NUMBER_OF_ROWS))
    WINDOWS_NOT_IN_BOTTOM_ROW=$((WINDOWS_IN_DESK-BOTTOM_ROW_WINDOWS))
    #set the co-ordinates for the top row
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    #the height of each window would remain the same regardless of which row it is in
    H=$(((HEIGHT-TOP_MARGIN-BOTTOM_MARGIN)/NUMBER_OF_ROWS - TITLE_BAR_HEIGHT))
    #Find the width of each window in the top row, this would be the same for each row except for the bottom row which may contain more windows
    NORMAL_ROW_WIDTH=$((((WIDTH-LEFT_MARGIN-RIGHT_MARGIN)/NORMAL_ROW_WINDOWS)-USELESS_GAPS*NORMAL_ROW_WINDOWS))
    BOTTOM_ROW_WIDTH=$((((WIDTH-LEFT_MARGIN-RIGHT_MARGIN)/BOTTOM_ROW_WINDOWS)-USELESS_GAPS*NORMAL_ROW_WINDOWS))
    #start counting from zero
    i=0
    #we havent processed any windows yet
    CURRENT_ROW_WINDOWS=0
    #we will be processing the 1st row
    CURRENT_ROW=1
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    if [[ "$CURRENT_ROW" -lt "$NUMBER_OF_ROWS" ]]; then
    if [[ "$CURRENT_ROW_WINDOWS" -eq "NORMAL_ROW_WINDOWS " ]]; then
    CURRENT_ROW=$((CURRENT_ROW+1))
    if [[ "$CURRENT_ROW" -eq "$NUMBER_OF_ROWS" ]] ; then
    X=$LEFT_MARGIN
    Y=$((Y+H+TITLE_BAR_HEIGHT+USELESS_GAPS))
    W=$BOTTOM_ROW_WIDTH
    else
    CURRENT_ROW_WINDOWS=0
    fi
    fi
    if [[ "$CURRENT_ROW_WINDOWS" -eq "0" ]] ; then
    X=$LEFT_MARGIN
    W=$NORMAL_ROW_WIDTH
    if [[ "$CURRENT_ROW" -ne "1" ]]; then
    Y=$((Y+H+TITLE_BAR_HEIGHT+USELESS_GAPS))
    fi
    fi
    fi
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    X=$((X+W+USELESS_GAPS))
    CURRENT_ROW_WINDOWS=$((CURRENT_ROW_WINDOWS+1))
    i=$((i+1))
    done
    "MAX")
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    H=$((HEIGHT-TOP_MARGIN-BOTTOM_MARGIN))
    W=$((WIDTH-LEFT_MARGIN-RIGHT_MARGIN))
    i=0
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    #avoid setting the attributes of the active window
    if [[ "${WIN_XID[$i]}" -ne "$ACTIVE_WIN" ]] ; then
    #set the attributes
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    fi
    #preselect the next window
    i=$((i+1))
    done
    #now that all the windows have been set set the master on top
    wmctrl -r :ACTIVE: -e "0,$X,$Y,$W,$H"
    "VERTICAL_SPLIT")
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    H=$((HEIGHT-TOP_MARGIN-BOTTOM_MARGIN))
    W=$(((WIDTH-LEFT_MARGIN-RIGHT_MARGIN)/WINDOWS_IN_DESK - USELESS_GAPS))
    i=0
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    #preselect the next window
    X=$((X+W+USELESS_GAPS))
    i=$((i+1))
    done
    "HORIZONTAL_SPLIT")
    X=$LEFT_MARGIN
    Y=$TOP_MARGIN
    H=$(((HEIGHT-TOP_MARGIN-BOTTOM_MARGIN)/WINDOWS_IN_DESK -TITLE_BAR_HEIGHT -USELESS_GAPS))
    W=$((WIDTH-LEFT_MARGIN-RIGHT_MARGIN))
    i=0
    while [ "$i" -le "$WINDOWS_IN_DESK" ] ; do
    wmctrl -i -r ${WIN_XID[$i]} -e "0,$X,$Y,$W,$H"
    #preselect the next window
    Y=$((Y+H+TITLE_BAR_HEIGHT+USELESS_GAPS))
    i=$((i+1))
    done
    esac
    #say bye
    exit 0
    I call the script using the openbox key bindings for example:
    <keybind key="W-g">
    <action name="Execute">
    <command>/home/default/bin/wmtiler.sh -g</command>
    </action>
    </keybind>
    The advantage this holds, in my case, is that it provides me with on demand automatic tiling with a momentary spike in CPU usage but no sustained RAM usage.
    This should work on all window managers in which wmctrl works.
    Of course  there are plenty of things still to do and many bugs to fix, some of which are documented in the script itself
    Nothing would make me happier if somebody else found this useful.

    Hmmm.... iconified windows should be totally ignored. Could you post the output of xwininfo for the iconified window? for example;
    Get tet a list of windows open by issuing the wmctrl -lxG command
    [default@arch_desktop ~]$ wmctrl -lxG
    0x01400001 -1 4 0 1911 26 Conky.Conky arch_desktop conky
    0x01a00024 0 1346 52 576 254 surf.surf arch_desktop 24Online Client
    0x0200066a 1 1345 54 569 483 terminal.Terminal arch_desktop Terminal - default@arch_desktop:~
    0x02001231 1 1345 538 569 483 terminal.Terminal arch_desktop Terminal - default@arch_desktop:~
    0x02200004 -1 0 971 1920 109 avant-window-navigator.Avant-window-navigator arch_desktop avant-window-navigator
    0x01200039 1 0 18 1344 1026 chromium.Chromium arch_desktop Post a reply / Arch Linux Forums - Chromium
    0x0200279f 0 2 52 933 431 terminal.Terminal arch_desktop Terminal - default@arch_desktop:~
    and taking the window x id of the minimized surf window and issuing the xwininfo command:
    [default@arch_desktop ~]$ xwininfo -id 0x01a00024
    xwininfo: Window id: 0x1a00024 "24Online Client"
    Absolute upper-left X: 1345
    Absolute upper-left Y: 34
    Relative upper-left X: 1
    Relative upper-left Y: 18
    Width: 576
    Height: 254
    Depth: 24
    Visual: 0x21
    Visual Class: TrueColor
    Border width: 0
    Class: InputOutput
    Colormap: 0x20 (installed)
    Bit Gravity State: NorthWestGravity
    Window Gravity State: NorthWestGravity
    Backing Store State: NotUseful
    Save Under State: no
    Map State: IsUnMapped
    Override Redirect State: no
    Corners: +1345+34 --1+34 --1-792 +1345-792
    -geometry 576x254--2+16
    As you can see, for me , the "Map State:" is  "IsUnMapped" for the iconified windows and this set of commands is exactly what I am doing to ignore iconified windows. What I need to know is that is there some other type of map state that I need to ignore.
    As for the feature requests I already had it in my mind to do the first three points that you mentioned. Since the script is intentionally designed not to run as a background process, there has to be some sort of a backing store like maybe a simple text file in which to save the state and read it from there on the next command invocation. The advantage would be it would take a momentary spike in CPU utilization and no sustained RAM utilization like I mentioned before. Disadvantage being the user would have to issue a command to actually get the tiling done.
    Regarding your fourth point, did you mean setting the window to 50% width automatically on moving it to the screen edge like it is done in KWIn and Win7? If you want it to be done automatically then that would involve tracking the movement of the mouse and windows on the screen continuously. This is something I'd rather do in some other, tinier faster, script and call this script from that on specific events.
    However, if you are willing to press a key while focused on a window and have it resized to max height and 50% of screen width either on the right side or on the left side, depending on the key combination, while leaving the other windows unaffected, then that can be arranged very simply. 

  • Java never detects window maximized event?

    Hello All,
    My initial problem was in trying to bring a window back to the front if a user selects the menu item that originally launched that window. I had to add extra code to handle the case where the window was minimized (iconified). Once I did that, all worked as expected, except if I maximized the window, then iconified it, then selected the menu item to redisplay it, it came up, but at the size and position it was before I maximized it. However, if I restored the iconified window by double clicking on it, it came up in its maximized state.
    Here is my basic code to redisplay the window:
    myFrame.setVisible(true);
    int state = myFrame.getExtendedState();
    if ((state & JFrame.ICONIFIED) == JFrame.ICONIFIED) {
        myFrame.setExtendedState(state & ~JFrame.ICONIFIED);
    myFrame.toFront();After investigating some more, it seems like Java never knows that the window was maximized. That is, state & JFrame.MAXIMIZED_BOTH never equals JFrame.MAXIMIZED_BOTH. Neither bits for horizontal or vertical maximized are set either. I also tried adding a WindowState listener, and the windowStateChanged method never gets called when the window is maximized. Also, the line
    myFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); does nothing.
    I am using Java 1.4.1_02 on SunOS 5.8.
    Please help! I am baffled by this behavior!
    Barb

    Hello All,
    My initial problem was in trying to bring a window back to the front if a user selects the menu item that originally launched that window. I had to add extra code to handle the case where the window was minimized (iconified). Once I did that, all worked as expected, except if I maximized the window, then iconified it, then selected the menu item to redisplay it, it came up, but at the size and position it was before I maximized it. However, if I restored the iconified window by double clicking on it, it came up in its maximized state.
    Here is my basic code to redisplay the window:
    myFrame.setVisible(true);
    int state = myFrame.getExtendedState();
    if ((state & JFrame.ICONIFIED) == JFrame.ICONIFIED) {
        myFrame.setExtendedState(state & ~JFrame.ICONIFIED);
    myFrame.toFront();After investigating some more, it seems like Java never knows that the window was maximized. That is, state & JFrame.MAXIMIZED_BOTH never equals JFrame.MAXIMIZED_BOTH. Neither bits for horizontal or vertical maximized are set either. I also tried adding a WindowState listener, and the windowStateChanged method never gets called when the window is maximized. Also, the line
    myFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); does nothing.
    I am using Java 1.4.1_02 on SunOS 5.8.
    Please help! I am baffled by this behavior!
    Barb

  • Icon for JInternalFrame

    When I iconify my JInternalFrames, they get this not-so-hot looking
    default icon which isn't suitable for my application.
    Question:
    How can I choose my own icon for JInternalFrames?
    (I still want to be able to iconify windows - just replace the default
    icon with icons of my own.)

    JInternalFrames normally get the same icon which their
    parent (JDesktopPane) has.
    We have one application with JInternalFrames and their
    icon remain the same when they get minimzed.
    Your icons change when you minimize the
    InternalFrames?I get the default icon, which you too have - but I dont want it!
    I want to replace it with my own...

  • Run big problem!!

    Hi everybody!
    I' ve a big problem with the runnig process, I mean, everytime I decide to run a project, the result is always a simple small and iconified window!!!!!!, I've tried to run different kind of projects,but, as usual, j dev displays always the same thing!!!
    Maybe I made some mistakes...i don't know!!!
    Regards and Thanks in advance!!!!!!!!
    Simona

    Thanks Frank,
    Sorry,I 'd be more precise when I ask for help!!
    Yes, I 'm programming in Swing, but the interesting thing is
    that the frame size are already set, and beside that when I try to open that small window after running process, there's nothing inside!!!!!
    I can't do nothing!!!!
    regard
    Simona

  • Alt-tab behaviour in PekWM

    Hey guys,
    I was wondering if there is a way to toggle between both open and iconified windows using the NextWindow or NextWindowMRU shortcut in Pekwm. Currently, it doesn't work with iconified windows and the only way to get to them is via a panel or the Goto menu (Mod4-Shift-I), which requires two hands
    That's really the only thing keeping me from using Pekwm... and it's annoying me like heck. I vaguely remember seeing a feature request somewhere on the 'net for that behaviour but my googling skills aren't worth much
    And ideas?

    No one?

  • Unwanted focus

    Hi all you wonderful java people.
    Help is much needed and would be greatly appreciated.
    I have produced a program which puts up a window with a message on it, and takes it down again. I don't want this window to ever get the focus, it is just supposed to appear and disapear again.
    I use a simple JWindow, called message.
    As long as this window is the only one active in the application, it does exactly what I want it to.
    However, this means that to stop the program I have to use ctrl/alt/del. It would be nice to have a control window with start and stop buttons.
    If I have another window active in the program, then that window, and the message window, are no longer neccessarily on top. This means that the message window is only visible if I deliberately bring the application windows to the front, which defeats the whole purpose, it is supposed to remind me of stuff I forget!
    I can call toFront(), or isVisible(), on the message window and then the message window is visible on top of the other windows, even if the control window is not visible, but, and it is a big but, then the window gets the focus. And, worse still, much worse, the window the user is trying to use during all this does not get the focus back again. So, say I am trying to edit a document, from the moment of the first appearance of the message window, the computer can't be used to edit the document, until I click on the window I am trying to use; and then the message window takes the focus away again the next time it appears. This is exactly the opposite of what I am trying to achive, the message window is supposed to pop up and go away again, periodically, causing no more disturbance than just its appearance.
    I have tried setting the window.setFocusable( false ) but this makes not a bit of differnece, the behaviour is unchanged.
    I have tried all kinds of other things too, some more desperate than others!
    I've tried setting the single label child window of the message window to window.setFocusable( false )
    I have tried making the message window from different components, such a dialog frames, but this does not help.
    Amongst other things I have tried making and displaying a third window when the control window is first hidden, but this just produces a slew of bizarre and not useful results. If the third window is shown in a timer governing the display of the message window, the third window appears and disapears with the message window!?! If I get it to be shown at other parts of the program, it appears continuously, but cannot be persuaded not to take the focus from the window in use for editing or whatever.
    In desperation I am now getting ready to create two separate java programs which will have to communicate with each other by signals, just to get the behaviour I want. This seems silly and very sledgehammer nut.
    Please can someone show me a simple way to do this, I shall be very grateful.
    You can name your price in dukes! ( up to 30, that is )

    Hi Tim, thanks for your input
    the call to myWindow.setFocusableWindowState(false) doesn't help, and always on top can only be implemented with native code, there is no setAlwaysOnTop() in the standard interface, unless it is a secret of some kind!
    The solution, in case it helps anyone, is to call toFront() on the iconified window, and then the window that isn't iconified will always be on top, but won't take the focus. Needless to say this was discovered almost accidentally, and it is tremendously useful if you are ever needing this specific functionality.
    best wishes to all
    Andrew

  • "Multiseat" gaming with multi-pointer X

    Hello Arch gaming community,
    recently I've discovered a decent way to play multiplayer games in multiseat (or pseudo split-screen) manner. It really works - I use it to play Myth II: Soulblighter (on Wine) with my brother
    Short explanation:
    In recent versions of Xorg (>= 1.7), there's a nice feature - it lets you plug another mouse and make it control a second pointer on the screen. Plug another keyboard, assign it to this pointer, and you can independently work with two windows at a time (each pointer getting it's own focus). Now, if you connect a second physical display and configure it to be a separate X screen belonging to the same X server, you can send your second pointer to that screen, virtually allowing both sets to be used independently. Now, run some game on first screen, then another instance on another, and you can play it multiplayer with your friend
    What makes this approach better than a "true" multiseat:
    Configuring a proper multiseat system (where each "seat" get's it's own login screen) is not easy, to start with. Often it won't let you use hardware acceleration on both displays unless they're connected to two separate video cards. Mutli-pointer approach lets you use both screens with hardware acceleration with just one dual-head graphics card (like most laptops have). Besides, it's much less painful to set up.
    The downsides:
    The multi-pointer feature of Xorg is still fairly new, and is not supported by any window manager that I know. Thankfully, it doesn't have to be explicitly supported by a WM in order to be used with it, but most WMs tend to get confused by it. Also, sometimes keyboard focus is not automatically assigned for the second pointer, and you have to explicitly assign it via command-line for the keyobard input to work.
    So, how to do it?
    The basic steps are:
    Prepare an alternative xorg configuration file for both displays (if you don't use both already)
    Start another X server with "xinit /usr/bin/xterm -- :1 vt8 -config [your dual screen xorg config file]" (so that when something goes bad, your main desktop won't suffer)
    Set up a secondary pointer with xinput utility
    Launch two instances of some game, one on each screen
    Use xinput with "set-cp" option to assign a second pointer to the window that will be operated by it
    Play!
    You'll have to repeat all steps (except the first one) each time you want to play in this configuration. As you can see, it requires some tedious typing each time, so right now I'm writing scripts that automate the setup.
    Here's one that lets you choose a mouse and keyobard and assign a second pointer to them (uses zenity, but can be adapted to use CLI only):
    #/bin/bash
    # vim: si ts=4 sw=4
    shopt -s extglob
    IFS=$'\n' DEVICE_LIST=( $(xinput list --short) )
    for (( I=0; I<${#DEVICE_LIST[@]}; I++ )); do
    IFS=$'\t' INFO=( ${DEVICE_LIST[$I]} )
    [ "${INFO[2]:1:1}" = "s" ] || continue
    NAME="${INFO[0]:6}"
    NAME="${NAME%%*([[:blank:]])}"
    ID="${INFO[1]#id=}"
    [[ "$NAME" != *XTEST* ]] || continue
    case "${INFO[2]:8:1}" in
    "p" )
    POINTERS+=( "$ID"$'\t'"$NAME" )
    "k" )
    KEYBOARDS+=( "$ID"$'\t'"$NAME" )
    esac
    done
    POINTER="$( IFS=$'\t' zenity --title="Select device" --list --text="Choose a pointer" --column="Id" --column="Name" ${POINTERS[@]} )"
    KEYBOARD="$( IFS=$'\t' zenity --title="Select device" --list --text="Choose a keyboard" --column="Id" --column="Name" ${KEYBOARDS[@]} )"
    [ -n "$POINTER" ] && [ -n "$KEYBOARD" ] || exit 1
    MASTER_NAME="second"
    xinput create-master "$MASTER_NAME"
    xinput reattach "$POINTER" "$MASTER_NAME pointer"
    xinput reattach "$KEYBOARD" "$MASTER_NAME keyboard"
    Don't ask me for more detailed instructions - I'll provide them when I have time.
    Now I'm looking for suggestions where I could place them. Maybe a wiki page would be a good idea? I think it would also be easier to join efforts there. What do you think?

    Yes, most of WMs get confused by multiple pointers, because they don't recognize mutliple focuses. That's one of the reasons why I run games in a dedicated X server with a bare-bones TWM setup. I launch it with:
    xinit ./xinitrc.dual -- :1 vt8 -config xorg.conf.dual
    xinitrc.dual:
    twm -f twmrc &
    DISPLAY=:1.1 xterm &
    xterm
    twmrc (compacted):
    NoDefaults
    NoIconManagers
    NoTitleFocus
    NoTitleHighlight
    NoHighlight
    RandomPlacement
    UsePPosition "on"
    OpaqueMove
    DontMoveOff
    NoTitle
    BorderWidth 0
    NoMenuShadows
    # Bindings
    Button1 = m4 : window|icon : f.move
    Button3 = m4 : window : f.resize
    Button1 = : icon : f.deiconify
    "1" = m4 : all : f.warptoscreen "0"
    "2" = m4 : all : f.warptoscreen "1"
    "f" = m4 : all : f.focus
    "Tab" = m4 : all : f.circleup
    "Tab" = m4|s : all : f.circledown
    "n" = m4 : window : f.iconify
    In this config there are no window decorations, and "Super" (the windows-logo key) is the general window-handling modifier.
    Bindings explained:
    Super+LMB - drag windows around
    Super+RMB - resize windows
    Super+1/2 - warp pointer to screen 0 or 1
    Super+f - lock/unlock focus
    Super[+Shift]+Tab - cycle between windows (more precisely, cycle their stacking order)
    Super+n - iconify (minimize) window; iconified windows are restored by clicking on icons.
    Why do I see two entries for the USB keyboard ? (ID8 / ID9)
    It seems that some devices report themselves that way. Maybe they have some functions that should be logically separated, or something like that. Then, I think it's best to keep them under the same master device to avoid confusion. I've updated my zenity script to allow selecting more than one device:
    #/bin/bash
    # vim: si ts=4 sw=4
    shopt -s extglob
    IFS=$'\n' DEVICE_LIST=( $(xinput list --short) )
    for (( I=0; I<${#DEVICE_LIST[@]}; I++ )); do
    IFS=$'\t' INFO=( ${DEVICE_LIST[$I]} )
    [ "${INFO[2]:1:1}" = "s" ] || continue
    NAME="${INFO[0]:6}"
    NAME="${NAME%%*([[:blank:]])}"
    ID="${INFO[1]#id=}"
    [[ "$NAME" != *XTEST* ]] || continue
    case "${INFO[2]:8:1}" in
    "p" )
    POINTERS+=( "$ID"$'\t'"$NAME" )
    "k" )
    KEYBOARDS+=( "$ID"$'\t'"$NAME" )
    esac
    done
    MASTER_NAME="$( zenity --title="Enter name" --entry --text="Enter name for new master" )"
    [ -n "$MASTER_NAME" ] || exit 1
    POINTER="$( IFS=$'\t' zenity --title="Select device" --list --multiple --text="Choose a pointer" --column="Id" --column="Name" ${POINTERS[@]} )"
    [ -n "$POINTER" ] || exit 1
    KEYBOARD="$( IFS=$'\t' zenity --title="Select device" --list --multiple --text="Choose a keyboard" --column="Id" --column="Name" ${KEYBOARDS[@]} )"
    [ -n "$KEYBOARD" ] || exit 1
    xinput create-master "$MASTER_NAME"
    IFS="|"
    for ID in $POINTER; do
    xinput reattach "$ID" "$MASTER_NAME pointer"
    done
    for ID in $KEYBOARD; do
    xinput reattach "$ID" "$MASTER_NAME keyboard"
    done
    @Darksoul71
    This should be all you need. You can adapt my xorg.conf.dual (it's in one of my previous posts), but the way of configuring multiple screens can differ between display drivers, so you'll have to find out how to do it in your case.
    EDIT: Forgot to mention:
    @Darksoul71
    As to you keyboard problem - do you set the client pointer for the second instance's window?
    Last edited by Rad3k (2010-09-29 22:06:08)

  • XFCE4 and Minimization to Taskbar

    I am running XFCE4 on two different machines, two different distros. On one distro (VectorLinux), when I minimize a window, it "disappears" into the taskbar and that is that, until I click the taskbar entry to bring it back. However, on Arch, when I minimize a window, it places an icon (iconfied window) onto my desktop, much like Windows 3.1 used to. This seems a pointless waste of desktop since you have a taskbar entry anyway.
    Is there a way to configure XFCE4 so that when you minimize a window, it just collapses into the task bar? I know that it *can* do it, since this is how my VectorLinux copy of it works, but that might be a custom VectorLinux hack of XFCE4.
    Thanks!

    mac57 wrote:Thanks mic64, that was it. I *am* using Rox as my desktop, and there was an option, clearly labelled "iconified windows" for turning this on and off. I did not even look there, assuming that window management was the province of the window manager, not the desktop! Silly me! Thanks again.
    It is, because that is not exactly window management.

  • Position of iconified JInternalFrame window

    Hi,
    I am attempting to "memorize" the position of a JInternalFrame window when it is iconified. However, if I use the standard getX(), getY(), getWidth() and getHeight() calls, it returns the original position of the JInternalFrame, as if it was deiconified. Is there any other way to get this information?
    Regards,
    Herman

    Hi,
    iframe.addInternalFrameListener(new InternalFrameListener()
                   @Override
                   public void internalFrameActivated(InternalFrameEvent arg0) {
                   @Override
                   public void internalFrameClosed(InternalFrameEvent arg0) {
                   @Override
                   public void internalFrameClosing(InternalFrameEvent arg0) {
                   @Override
                   public void internalFrameDeactivated(InternalFrameEvent arg0) {
                   @Override
                   public void internalFrameDeiconified(InternalFrameEvent arg0) {
                   @Override
                   public void internalFrameIconified(InternalFrameEvent arg0) {
                        int x = iframe.getX();
                        int y = iframe.getY();                    
                        System.out.println(x + "  " + y);
                   @Override
                   public void internalFrameOpened(InternalFrameEvent arg0) {
              });Thanks

  • How to prevent window iconified

    Hi!
    I am wandering how to prevent window
    iconified (this - button on the right-top-
    corner on the window).
    DO_NOTHING_ON_CLOSE works for X button,
    any method to stop iconify!
    null

    You can use the JFrame method "public void processWindowEvent(WindowEvent e)" and when the WindowEvent ID is WINDOW_ICONIFIED, WINDOW_CLOSING or WINDOW_DEACTIVATING or some other event type that you're interested in, you can set the window visible again. Be careful though, if you don't program a way out of this the window will always be on top and you won't be able to perform any other window functions.
    Hope this helps.
    Steve

  • Minimizing(Iconifying) all JFrames when main window is minimized?

    I have a main windows that is a JApplet. It has many subwindows that are JFrames. I want to make it so that all the open JFrames minimize when I minimize the main JApplet and deiconify when the main JApplet is deiconified.

    Knocking this up!

  • How can I make Reader the active window when opening documents?

    I am having trouble with this because right now documents open in the background and Adobe Reader does not become the active window.  This requires an extra click on Adobe to bring the opened document to the foreground.
    Nowhere to be found in Preferences.
    My system is Linux RedHat 2.16.0
    Adobe Reader 9.3.1
    Thanks a bunch.

    Sir,
    Inspect the following methods (all available to, say, a JFrame) - they might help you out:
    setVisible
    setState (to (de)iconify)
    toFront (request to bring to front)
    requestFocus

  • Iconed labels and iconified JFrame

    Hello everybody,
    I have a problem with a strange behaviour of a JFrame.
    In order:
    1. I initialize a JFrame with a JSplitPane
    2. The left component is a JPanel containing 64 JLabels, each with an Icon in it.
    When the frame is coming up, everything is displayed proper. But when I iconify the frame and deiconify later nothing is to see, but a blank frame. The labels will be redisplayed after clicking on the position, where the splitpane-divider should be.
    I'm using jdk1.4
    Can anybody helpme?
    Thanks

    hi,
    hope you've used the frame's getContentPane() method for adding the splitpane, if yes, then that might be some kind of a bug, anyways, add a window listener overriding the windowDeiconified(WindowEvent) method & call the frame's repaint() method,
    hope this helps you,
    reagrds,
    Afroze.

Maybe you are looking for