Centering Applications, spawning windows and other GUI stuff

Hi, possibly a silly question, but leave me alone I'm new :o)
How do I get my application to center on the screen ? At the moment it opens upin the top left hand corner of the screen.
Also whilst I'm on the topic my app with goes from screen to screen, that is when you click a button it makes turns that window "off" and opens the new destination window with setVisible(true/false), however when ever I move to the new window it always opens in the default location, is there a way in whivh the opened window appears in the location of the old one, for example, invoke the app, move the window around the screen, clikc a refresh button which will close and then re-open the same window and for the new scren to be in the new location, at the moment it will re-open in the top left hand corner of the screen as per usual

Hi,
You could just create a class that does it for you. See the code below for an example class that centers itself on any screen.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MyFrame extends JFrame
  public MyFrame()
    this( null );
  public MyFrame( String title )
    super( title );
  public void setVisible( boolean flag )
    if( flag )
      // Show should center on screen
      this.show();
    else
      // Hide should just call parent to perform function.
      super.setVisible( flag );
  public void show()
    //  Center this window to the main window.
    Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension thisDim = this.getSize();
    Point thisLoc = new Point();
    thisLoc.x = (screenDim.width / 2) - (thisDim.width / 2);
    thisLoc.y = (screenDim.height / 2) - (thisDim.height / 2);
    this.setLocation( thisLoc );
    //  Display window now.
    super.show();
}Enjoy,
Manfred.

Similar Messages

  • I am facing problems while openin an application in facebook and other places.when i go to the application,an error shows and firefox closes autmatically either i send error reports or dont.....plz help

    i am facing problems while openin an application in facebook and other places.when i go to the application,an error shows and firefox closes autmatically either i send error reports or dont.....plz help

    Notes:
    1) Please use the code tags when posting code or JNLP/HTML. It helps to retain indentation and avoids asterisks and plus sings being interpreted as formatting marks. To do that, select the code/JNLP etc. and click the CODE button seen on the Plain Text tab of the message posting form.
    2) That launch file is invalid. You might check it (and the project in general) using JaNeLA.
    3) The only place that SimpleSerial class could be, that the JRE would find, is in the root of aeon.jar. Is it actually there?

  • In need of help didn't install find my iPhone on my iPhone 5 and it got stolen from me at a dd's but I had my id and other important stuff in it I need to find it because I can't risk getting my identity stolen what can I do.

    In need of help didn't install find my iPhone on my iPhone 5 and it got stolen from me at a dd's but I had my id and other important stuff in it I need to find it because I can't risk getting my identity stolen what can I do.

    You don't have to install the Find My iPhone app - you need to switch the feature on in the settings on the phone.
    If you go here: https://www.icloud.com/#find does your phone show up?
    ~Lyssa

  • I am having trouble with my mac book air. I think I have a virus because everytime i click on a link it openes up popup windows and other things. How do I reset teh computer?

    I am having trouble with my mac book air. I think I have a virus because everytime i click on a link it openes up popup windows and other things. How do I reset teh computer?

    Please post a screenshot that shows what you mean. Be careful not to include any private information.
    Start a reply to this message. Click the camera icon in the toolbar of the editing window and select the image file to upload it. You can also include text in the reply.

  • Microsoft Rights Management Sharing Application for Windows and the connection with AD RMS

    Hi,
    I have installed AD RMS and now installed on end users Microsoft Rights Management Sharing Application for Windows.
    When I choose protect a document in any end user machine, does it connect with AD RMS server to get a certificate and encrypt the content, or does not use at all AD RMS services? What about when choosing to protect  with an AD RMS template distributed
    to end users?
    Thanks 

    Hi Ardi -
    The first time a user creates or consumes protected content, they must contact the RMS server to "bootstrap".  In this process, the user obtains certificates to identity them within the context of RMS.
    Once a user has bootstrapped, he or she can create protected protected content without access to the RMS server.
    To open protected content, a user must connect to the AD RMS server to obtain a "use license".
    Does that help?
    Micah LaNasa
    Synergy Advisors
    synergyadvisors.biz

  • Keeping speakers and other magnetic stuff near iMac.

    So I'm a bit of an old schooler and I think everyone remembers the time when magnets used to damage the CRT and other sutff like that, today not quite that much at lest that i what I think. So i have a question i have a Philips TV that i use it as monitor for my PC and i have a question are the little speakers in the TV able to do any damage to the iMac i have a gap between then that is like 3 fingers wide. Ticture down to describe the scenario better.
    The red circle is the TV Speaker.
    Thanks a lot

    You dont have to worry about that any more. For example you have speakers in the bottom of your imac that are very similar to the ones in that tv.

  • IR Error: OUT of Memory. Close other applications or windows and try again.

    Hi,
    We recently moved from an 9.3.3 to 11.1.2.3. and working on IR reports. While running few reports we get this error and the client system has GB or ram and the server is allocated 4 GB or ram for IR reports.
    I see the file it is trying to retrieve is about 800 Mega something like that ..... Not able to decide where to check next ...
    Any thought will be appreciated.
    Thank you.

    There are many different conditions in which this error may appear:
    (1) Upon opening a legacy non-Unicode BQY file in a Unicode compatible version of Interactive Reporting.
    (2) When processing a query multiple times against a BLOB.
    (3) When querying against Red Brick version 6.3 with ODBC/ODBC setting and there is  processing to convert string column to integer type (before IR 9.3.0).
    (4) When processing with DB2 9.1 against a bigint data type.
    (5) Repeated opening, processing, closing, and re-opening of BQY documents with 'not equal' joins and high volumes
    Sometimes this is due to excessive data which brings the size of the BQY file up around one gigabyte uncompressed in size (for processing may take twice as actual RAM, plus the memory space space for the plugin, and the typical memory limit on a 32-bit system is 2 gigabytes).
    There have been a number of unpublished bugs which can result in the same error.
    Solution
    To avoid excessive BQY size exceeding memory availability:
    (a) Ensure that your computer has at least 2Gb of free RAM before he runs IR Studio.
    (b) Put a limit to the number of rows that can be pulled down: Right click on Request label of Query section and put a value in Return First xxx Rows (and check the check box).
    (c) Do not pull down more than 750 MB of data (remember it may be duplicated while processing).
    (d) Place limits or aggregations in Query section (as opposed to Result section) to limit data entering the BQY

  • GNU screen, spawn windows and issue specific command to each

    Hello folks.
    I want gnu screen to spawn some windows, let's say, so I've put these lines in .screenrc:
    screen -t foo
    screen -t bar
    now I'd like to change the directories for foo and bar. I've tried multiple commands like:
    screen -X at foo screen -X stuff 'cd /tmp^M'
    screen -X at bar screen -X stuff 'cd ~/projects^M'
    and some other variations. At best, it gives the error message: "key: screen: invalid option -X .", at worst it doesn't start at all.
    Regards.

    problem solved. for others in need, put in .screenrc:
    screen -t foo
    at foo stuff 'cd /tmp^M'
    where "^M" is generated by pressing sequentially ctrl+v,ctrl+m

  • Application switching/windows and titlebar problem

    Hi,
    Apologies if this isn't the best place to post this, but it's a problem that relates to switching between applications in OS X, and I haven't yet found an answer through Director forums.
    So... I am working on a (cross-platform) Director project that has to link to and open Word DOCs. I have a problem in OS X whereby when a DOC is opened, the Mac does not seem to be switching properly into Word. What happens is: click thumbnail (running handler to open DOC, using Buddy API xtra); Word starts to open the DOC; DOC window appears in front of projector Window, but the Mac titlebar seems to 'stick' in the projector. I can edit the DOC, use keyboard commands to save etc., but no menus are visible due to the 'ProjectorName.osx' title bar. I can switch to Word with Apple-tab, but not by clicking in the Word window(s).
    A few extra notes:
    • The projector resizes the screen to 800x600, but even with this feature disabled the problem persists.
    • There appears to be a very strong link between creating a Full Screen projector and whether the problem manifests itself or not. All projectors created with Full Screen checked now have the problem (along with a few non-Full Screen). Unfortunately I need to lose any title/menu bar, therefore need to use Full Screen projectors.
    • The problem has just arisen; essentially identical projectors (ie. differences are only in graphics) have run OK.
    • We have used a couple of different xtras to open the files, for reasons unconnected with this issue. However we have been using BuddyAPI for a while, so I am reasonably sure that the problem is not related to this.
    • Ensuring that unnecessary apps are closed, to ensure plenty of free memory, makes no difference.
    Paul

    > now my oracle is up but not able to login in sap.
    Your system is hosed up.
    > one is : oraclesri102isql*plus service is not getting started.
    That service is not important for a SAP system.
    Chintan,
    it is not supported to make changes to a domain structure after you installed the system (see the given note). That's why your SAP system is not coming up, all filesystem-, registry and user permissions are invalid.
    The only way to resurrect your system is to reinstall it.
    Configure first the operating system (as standalone or in a domain) - and then install the SAP system, not vice versa.
    Markus

  • ICloud won't stay signed out and other fun stuff

    Okay so I am on a MacBook Pro using Yosemite and my machine has several problems. The first is that my iCloud will not correctly sign in. When going to Preferences>iCloud the screen is greyed out and I can not change any settings. As prompted at the top of the screen I enter my password to verify my id. I do this and press enter and nothing happens. I have then tried logging out, which seems successful at first, but if i try to log back in it says 'Can not log back in at this time'. If I then leave system preference and reopen it and go back to iCloud settings, I find that some how i am now logged in and the problem restarts with the greyed out screen.
    The next problem is that when ever I restart my computer certain applications, when opened, return to where they were a couple of months ago. If I open safari several tabs reopen, and if I open lock lizard (a pdf viewer) certain documents open. Applications that i have removed from my dock even reappear  in the dock. It is as if my hole computer jumps back to a certain point several months ago every time I restart my computer.
    So these are the problems I am having, and so far the great google has not helped me. I hope I have not be vague.

    This should fix the issue:
    Special thanks to Roger Wilmut for providing the detailed instructions below.
    https://discussions.apple.com/people/Roger%20Wilmut1
    1. Shut down Mail.  Next, deselect "iCloud Mail" in the iCloud preferences pane in System Preferences FIRST.  If not, it will automatically pre-populate the wrong p9X.mail.me.com server names again overwriting all your work.
    2. Now restart Mail and go to preferences.  If "iCloud" mail is still showing, select it and click on the "-" at the bottom to remove it.
    3. Now follow the instructions here:http://www.wilmut.webspace.virginmedia.com/notes/icloudmail.html (disregard that this is for Snow Leopard, it DOES work on Lion) paying attention to the use of the "option" key when needed to avoid Mail automatically "creating" the account and closing out the preferences window.
    4. Ensure the correct server names of "imap.mail.me.com and smtp.mail.me.com" are still there and close Mail preferences and now select "get mail".  It may prompt one last time for your iCloud password, enter it and you are done.
    Good Luck.

  • Can't see anything in Print and New File window and others..

    Hello,
    I just bought a new computer with Windows 7. I downloaded the Illustrator CS5 trial to check it out before I purchase it. It installed fine and I can open files but when I open the print menu, the print window opens in a long vertical rectangle, completely empty. If I press enter though, the file will print. When I go to new,  I have the same problem as well as with other menu options like document setup.
    Is there any way to fix this? I tried running it under XP compatibility but that didn't make a difference.
    THANK YOU!

    If you installed iWork from the disk, did you run the updates?
    If you copied the app over from the old Mac you would also need a copy of the iWork '08 folder which is in Macintosh HD/Library/Application Support

  • VBscript to find specific list of installed software on windows XP, windows & and others

    Hi All,
    I need a vbscript which will find following list of softwares on my system, and if it is there then it will give detials of that software like version, install date, etc.
    1.  IE details (like v10)
    2.  PAC File details which is use for internet browsing
    3. Java JRE details
    Also my concern is that it must run on all versions of windows OS from XP to 8.1
    As I am new to vb script so please help me out.
    Thanks.

    i used following code and it gives all software installed but i need only above mentioned software
    Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
    strComputer = "."
    strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
    strEntry1a = "DisplayName"
    strEntry1b = "QuietDisplayName"
    strEntry2 = "InstallDate"
    strEntry3 = "VersionMajor"
    strEntry4 = "VersionMinor"
    strEntry5 = "EstimatedSize"
    Set objReg = GetObject("winmgmts://" & strComputer & _
     "/root/default:StdRegProv")
    objReg.EnumKey HKLM, strKey, arrSubkeys
    WScript.Echo "Installed Applications" & VbCrLf
    For Each strSubkey In arrSubkeys
      intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
       strEntry1a, strValue1)
      If intRet1 <> 0 Then
        objReg.GetStringValue HKLM, strKey & strSubkey, _
         strEntry1b, strValue1
      End If
      If strValue1 <> "" Then
        WScript.Echo VbCrLf & "Display Name: " & strValue1
      End If
      objReg.GetStringValue HKLM, strKey & strSubkey, _
       strEntry2, strValue2
      If strValue2 <> "" Then
        WScript.Echo "Install Date: " & strValue2
      End If
      objReg.GetDWORDValue HKLM, strKey & strSubkey, _
       strEntry3, intValue3
      objReg.GetDWORDValue HKLM, strKey & strSubkey, _
       strEntry4, intValue4
      If intValue3 <> "" Then
         WScript.Echo "Version: " & intValue3 & "." & intValue4
      End If
      objReg.GetDWORDValue HKLM, strKey & strSubkey, _
       strEntry5, intValue5
      If intValue5 <> "" Then
        WScript.Echo "Estimated Size: " & Round(intValue5/1024, 3) & " megabytes"
      End If
    Next

  • New to Apple, questions about using Windows, and other things

    Hello all,
    Today is my first day as an Apple owner. It's funny because I'm also a MCSE, MCSA, and MCP.
    I purchased a 24" iMac, 2.8GHz, 4GB RAM, and 1TB Hard Drive.
    I want to use Windows on my Mac so that I don't have to keep switching over to my PC. My main reason for using Windows is so that I can continue to enjoy my PC Games... mostly racing and D&D games.
    So my question is... how does Windows run on bootcamp? Can I still use all of my USB controllers (like my steering wheels, joysticks, etc?)
    I really havent even turned on my iMac... been too amazed at just looking at it for the first day (and also rearranging my home office).
    I really just want to know from those of you who have PCs AND Macs, if you still find yourself having to go back to your PC because of incompatibilities or performance issues on the iMac?

    Using BootCamp, your Windows experience is no different than if running it on a similarly configured PC. If you went with a VM running under Mac OS X (like VMWare or Parallels), there are a number of differences. However, using BootCamp you have a Mac-branded PC.
    I'd point out that people have been dual-booting operating systems in this fashion for decades. Windows has no obvious in-built support for doing so, but other operating systems (like Linux, FreeBSD, etc.) have always very clearly and explicitly supported dual-booting (on Macs and regular PCs) from the get go.

  • Apple Bluetooth Headset - Paring with Windows and Other Questions

    Love my new Apple Bluetooth Headset, works great. My first one did have a problem with poor range but this one is a lot better. I've been wanting to use the headset as a mic. Windows XP finds the headset find but I can't tell if it's connecting or not. How do I tell the Headset what device to connect to? It's paired to my iPhone too so it picks up on my iPhone every time I try to connect.
    Basically how do scroll through on the Headset what devices to connect to? Usually Bluetooth Headsets can be paired with multiple devices and you do certain button combinations to scroll through the paired devices.

    unlike some of the sony ericssons, the apple headset can only be paired with one phone at a time. that doesn't stop you from repairing it when need be, however...

  • Windows 8.1 settings window and other apps automatica​lly minimize/c​annot be selected.

    Whenever I try and change my settings by going through the usual charms menu-> Change PC Settings, the instant the settings window comes up it disappears. I try bringing it up from the taskbar and the same thing happens: it seems to maximize then just disappears. I can't switch to it, only close it. This applies to any app in Windows including Sports, News, etc.
    Thanks in advance!
    I'm running on Windows 8.1 and have a  HP ENVY dv6-7214nr.

    Hi Marhorie4,
    This is the command you should try to enter
    powershell -ExecutionPolicy Unrestricted Add-AppxPackage -DisableDevelopmentMode -Register
    $EnvystemRoot\ImmersiveControlPanel\AppxManifest.x​m
    The restore point was  safety precaution, so it something when wrong you would have a good restore point to return to. As you have one that was before the issue started, I would keep and use that one.
    Here is a link to a Window.microsoft.com answer to assist you.  Cannot use Windows 8 apps or get to PC Settings!
    If the issue remains, I would do a   Refresh Your PC to Resolve Problems (Windows 8).  This will reinstall the original OS.
    Now try doing your update again.
    Updating Windows 8 to 8.1
    If this has not helped I would do a full factory recovery.  Here is a link to System Recovery / Backup / Restore.  There are links on the page to guide you through doing a recovery and restoring your files if you opted to do the backup.
    You may also consider contacting HP support for further assistance. They can remotely access your system to help find and fix issues.
    Please call our technical support at 800-474-6836. If you live outside of the US/Canada Region, please click the link below to get the support number for your region. Phone Assist Worldwide
    Good Luck!
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

Maybe you are looking for

  • While defining a columnar table, what is the purpose of column store type

    Hi folks I have two questions related to columnar table definition. 1. What is the purpose of column store type. While defining a columnar table, what is the purpose of column store type (STRING ,CS_FIXEDSTRING,CS_INT etc) , when I define a table usi

  • Projected photos too dark

    We had a large audience (150+). Running iPhoto Slideshow we turned on the digital projector, but found that the projected photos were way darker than those displayed on the Powerbook screen. What could we have done to render the projected photos the

  • Infotype 0057 - Invisible fields - Check on amount/number

    Hi guys, I am using the infotype 57 to use the field P0057-MGART only. So in the table V_T588M I have put all the other fields in invisible mode. Anyway, a check is still activated: when I try to save a new record, I have the error message "Enter amo

  • Where is link to download latest help file?

    Sorry for my lack of familiarity with this website, but I cannot find the location to download the latest PDF help file. I've been successful in the past, but can't locate it today. Thanks for any help you can provide.

  • Objects hidden (missing) in the Hierarchy list of SE80

    Hi Experts, The situation is, I have seen many times in my programs that, out of all the objects declared in the ABAP program some are found missing in the objects hierarchy list. Example, there will be a selection screen delcared and the program is