How I can get a JFrame to open in the middle of the screen?
Okay, I have been looking for an answer on how I can make a JFrame open in the center of the screen like the JOptionpane's "null" argument does. Maybe, I am putting the wrong words in the search but I can't find any help on this.
Thanks
***Sample***
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class JFrameProb extends JFrame
private JLabel someText;
private JLabel someText2;
private JLabel someText3;
public JFrameProb()
super("Why is this always going to the Corner?");
setLayout( new FlowLayout() );
someText = new JLabel("This Window Popped open in the top-left Corner...");
add(someText);
someText2 = new JLabel("Is there a way to open in the Center of the Screen?");
add(someText2);
someText3 = new JLabel("I know JOptionPane does.");
add(someText3);
}
JosAH,
I tried using your code but it errored out:
C:\Program Files\Java\jdk1.5.0\PimpThatHo\PimpNameGetter.java:78: cannot find symbol
symbol : variable Centralizer
location: class PimpNameGetter.TextFieldHandler
Centralizer.centralize(comboBox);
^
1 error
Process completed.
So I made a java file for the Cebtralizer Class but it gave me this:
--------------------Configuration: <Default>--------------------
C:\Program Files\Java\jdk1.5.0\PimpThatHo\Centralizer.java:3: cannot find symbol
symbol : class Component
location: class Centralizer
public static void centralize(Component c) {
^
C:\Program Files\Java\jdk1.5.0\PimpThatHo\Centralizer.java:5: cannot find symbol
symbol : class Dimension
location: class Centralizer
Dimension screenSize= Toolkit.getDefaultToolkit().getScreenSize();
^
C:\Program Files\Java\jdk1.5.0\PimpThatHo\Centralizer.java:5: cannot find symbol
symbol : variable Toolkit
location: class Centralizer
Dimension screenSize= Toolkit.getDefaultToolkit().getScreenSize();
^
C:\Program Files\Java\jdk1.5.0\PimpThatHo\Centralizer.java:6: cannot find symbol
symbol : class Dimension
location: class Centralizer
Dimension compSize= c.getPreferredSize();
^
4 errors
Process completed.
I know I am missing packages but I don't know which ones.
Roman03_
Similar Messages
-
Does anyone know how I can get my old one unlocked?
If you have the computer to which the iPhone was last synched, you can restore the iPhone on that computer. That will remove the lock. If not, then you have absolutely no choice but to place the phone into recover mode (search Google for instructoins) and restore the phone as a NEW device.
-
Hi. I have purchased Lego Indiana Jones for my Macbook Pro. On trying to install it, it is telling me it encountering an error. Does anyone know how I can get around this? Cheers
I have this problem too the error message for me is error 36
(It works on my Macbook but not my Macbook pro)
Any help you could give would be great -
I have Lightroom 4 installed. I cannot download my CR2 files from the Canon 5D Mark III camera. I have downloaded Lightroom 5 thinking it was an update but it appears I have to pay for the program. Any ideas how I can get lightroom 4 to accept my CR2 files ?
The Canon 5D Mk 111 was supported from LR 4.1, see the link below. Just update LR to the latest version. See link below
Camera Raw plug-in | Supported cameras
Adobe - Lightroom : For Windows
Adobe - Lightroom : For Macintosh -
Since updating to iOS08 all my books have disappeared from iBooks, including some I haven't read yet. Any ideas how I can get them back?
Hi Raymond,
I am having the same issue. But I can't seem to be able to find my books & PDF's. How did you find them? I am trying to locate them on my iPad.
Thanks,
Lori -
I've downloaded the Creative Cloud, once completed the creative cloud window pos up with spinning whell in center then the entire window disapears. How do I get it to remain open so that I can download programs needed
right click the executable > click 'run as administrator'.
-
The message icon on my iphone indicates that there is an unopened text message, but when i go into it, it just opens up a blank message, and there is no option to delete it. Any suggestions how i can get rid of this message, and prevent my phone from always opening up in the blank message whenever i go into my messages, rather than just opening as my inbox?
Many thanksHard restart.. While the phone is powered in, hold the power and home button. Hold them down and keep them held down. the phone will eventually shut itself off and reopen. keep held down till you see the appl elogo, then release. This will not delete anything off your phone, it will just force all apps to stop their current process. If you just turn the phone on and off, it will just pick up where it left off. Good luck
-
Elements 13 - a jpg file always opens in B & W raw and I cannot get it to open in colour. Same file opens OK in colour in Elements 9. Any suggestions how I can get it to open in colour in Elements 13?
Thanks for your reply - I just open the file with "Open" in the File menu - all my own jpg files open fine in colour. This is someone else's photo given to me and it does not matter how I open it "Open", "Open in raw" or "Open with ..." it always opens in B & W raw in the raw dialogue box. In Elements 9, which I also have on my PC it opens fine as jpg in colour so I can edit it there, but I am just wondering why I am getting this problem in elements 13. If I open it in any other programme such as Windows Photo viewer or Office 2010 viewer it opens fine in colour.
Not sure what you mean by "basic settings" menu.
Thanks for the reply -
I just reinstalled iTunes, and it will not open, as it says iTunes library itl. was created from an earlier version. Any idea what this means, and how I can get itunes to open?
Many thanks.
That suggests that another application has stashed old QuickTime componentry in your system files.
So just in case we'll go looking for older QuickTime componentry in the most common locations for it to be stashed.
First we'll need to change some view settings.
In your Start menu, open Computer.
In your Organise menu, select Folder Options.
In the View tab, make sure that "Show hidden files and folders" is selected, and Hide extensions for known file types is unchecked.
Click OK.
Now in Computer, open your C:\ drive (or whichever drive you have your operating system installed on).
Open the "Windows" folder.
If you have a 32-bit version of Windows, open the "System32" folder.
If you have a 64-bit version of Windows, open the "SysWOW64" folder.
What files and folders can you see in there with QuickTime in the title? (In a standard installation of Quicktime you should be seeing precisely two files... QuickTime.qts and QuickTimeVR.qtx ... and no QuickTime folders whatsoever.) -
Does anyone know how I can solve this. My cat managed to move iphoto tab to the middle of the screen and now I cannot open it and get this message.
You cannot open the application iphoto because it may be damaged or incomplete
Any help appreciatedYou need a more technically saavy cat, for a start.
To re-install iPhoto
1. Put the iPhoto.app in the trash (Drag it from your Applications Folder to the trash)
2a: On 10.5: Go to HD/Library/Receipts and remove any pkg file there with iPhoto in the name.
2b: On 10.6: Those receipts may be found as follows: In the Finder use the Go menu and select Go To Folder. In the resulting window type
/var/db/receipts/
2c: on 10.7 or later they're at
/private/var/db/receipts
A Finder Window will open at that location and you can remove the iPhoto pkg files.
3. Re-install.
If you purchased an iLife Disk, then iPhoto is on it.
If iPhoto was installed on your Mac when you go it then it’s on the System Restore disks that came with your Mac. Insert the first one and opt to ‘Install Bundled Applications Only.
If you purchased it on the App Store or have a Recent Mac you can find it in your Purchases List. -
How can i get rid of the small box in the middle of my screen
How do i go about getting rid of the box in the middle of my screen that offers stuff like webify and to sign up to you guys. i really hate that box being there.
one more question " how do i go about getting the rid of the restore session box everytime i close my home page, i dont want to restore at times i just want to close my home page and when i open it up be at my home page.Ok, I fixed it, thank you but I still have another question I set google to be my main screen but now I have about 3 search bars one in the middle of the screen and to on top. My question to you is how can I get rid of the middle search bar on the google screen and just have the two on top?
-
How do I get CurrentVersion.fcpevent to open in 10.1.1
HI,
I backed up files a while back of my FCPX files to a server. I have a project i need to reopen and edit. In the latsest version of FCPX, it will not convert open or import. How do I get this project to open up and allow me to edit or update the file?You can't open that file. Assuming the event that it is part of was created in an earlier version, the event needs to be in a folder named Final Cut Events. Any projects associated with that event need to be in a folder named Final Cut Projects. When FCP X 10.1 is opened, if you go to Update Projects and Events and then navigate to the drive where these folders live, it should create a new library for them.
Russ -
Hi there,
I bought My Iphone 4s from Iran, I need to make an Apple Id but Iran is not in the registered countries?! I dont know what to choose? Also From Iran we do not have Credit card facility for payment option?!! Any idea how I can get FREE APPS on my New Phon?!!
Please let me know how I can get this sorted as soon as possible!! Thank you very muchYou can create an Apple ID without a credit card, see this article:
Create an iTunes App Store account without a credit card
Check this post about iPhones from Iran:
Re: Why Apple does not support from Iran? And why not open a store in Iran? -
I recently changed from a Mac Pro to an iMac. Despite using Migration Assistant, a large chunk of my recent emails and nearly all of my wife's emails have disappeared in transit. Strangely, emails from my distant past are still there. Time Machine is no help; the messages may be on my backup disc but they're behind an invisible icon. Any ideas as to how I can get them back?
Quit Mail. Force quit if necessary.
Back up all data. That means you know you can restore the Mail database, no matter what happens.
Triple-click the text on the line below to select it:
~/Library/Mail/V2/MailData/Envelope Index
Copy the selected text to the Clipboard (command-C). In the Finder, select
Go ▹ Go to Folder
from the menu bar. Paste into the box that opens (command-V), then press return.
A Finder window will open with a file selected. Move the selected file to the Desktop, leaving the window open. Other files in the folder may have names that begin with "Envelope Index". Move those files, if any, to the Trash.
Log out and log back in. Relaunch Mail. It should prompt you to re-import your messages. You may get a warning that the index is corrupt and that Mail has to quit. Click OK.
Test. If Mail now works as expected, you can delete the file you moved to the Desktop. Otherwise, post your results. -
How do i get iphoto to NOT open automatically when i plug in my devices for updating in iTunes ??
Just so i understand. It happens when i connect my Ipad or Iphone, which i want to stop. I'm cool with it opening when I connect my camera tho. Can i customize it that way (just to open for my camera, and NOT my i-devices) ?
thx for the help
Maybe you are looking for
-
Error while applying patchset 11.1.0.7 to 11.1.0.6
Hi, I am a new DBA and would appreciate any help on this. I am in the process of upgrading my database from 10.2.0.4 to 11.1.0.7. I installed 11.1.0.6 and was applying the 11.1.0.7 patch. I installed the 11g patchset successfully and was working on '
-
Spool - PDF - Binary - EMail as an attachment
Hi all, I have a classical report output that I need to send as a PDF attachment in an e-mail. I am converting the spool to PDF using FM CONVERT_ABAPSPOOLJOB_2_PDF. I have a bespoke e-mail framework that recognizes the data only in Binary format. And
-
Hi all, Iam facing a limitation with Foreign JMS server. We are tyring to migrate from Message Bridge to Foreign JMS server. Our current setup is We have 3 MQ queues which are bridged to one JMS destination(que
-
Installing Web Premium CS4 Student Edition on Laptop After Windows 7 Upgrade Question
I hope that this hasn't been asked before but my question is the following: I want to upgrade my laptop computer from Windows XP to Windows 7. But I hear that all programs get uninstalled after installing Windows 7 on a Windows XP machine. I would
-
FAQ: Can I share on the web without sharing to Facebook?
FAQ: Can I share on the web without sharing to Facebook? Answer: Yes, GroupPix has a web-sharing feature built in. However, only the owner of the GroupPix Event can control whether it's shared or not. If you go into the GroupPix Event settings, and s