Making a Form appear on the center on the screen

Hi
How can i make a form in java to appear at the center of the screen no matter what the resolution of the scrren is .
Thanks

I know of 2 ways:
1. [The clean way]
http://forum.java.sun.com/thread.jsp?forum=57&thread=537866 EvilEdna's post {most thorough}
OR
http://forum.java.sun.com/thread.jsp?forum=31&thread=552229 My post (reply #1) {less thorough but still good}
2. [The dirty way]
frame.setLocationRelativeTo(null); {dirty!}

Similar Messages

  • My App Store opens with a white empty box covering the center of the screen making the screen unusable.  How do I get rid of it?

    Whenever I open the App Store there is a white box covering the center of the screen making the store screen unusable.  How do I fix it?

    Try This...
    Close All Open Apps... Sign Out of your Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...

  • How do I get a Dialog to appear in the center of the screen?

    How do I get a Dialog to appear in the center of the screen?

    You can get the screen size by using Dimension java.awt.Toolkit.getScreenSize().
    Once you get the Dimension, Before using API setVisible(true), You have to do the calculations to put your dialog in the center.

  • Making parameter form appears

    Dear All,
    i have a problem regarding showing parameter form that made by report developer when i call the report from my form
    first i use winXP sp3, database 10g ,developer suite 10g
    the problem is as follow:
    the report run perfectly from report builder and the parameter form appears but when i call the report from the form the report appears without parameter form screen and this make report empty
    notice1 :  i call any other report it is appears successfully
    in a short way (how can i make report parameter form appears when i call it from a form )
    i call the report through the following procedure
    procedure open_my_report (p_repname varchare2) is
    report id  report object;
    reportserverjob varchar2(100);
    report_status varchar2(20);
    begin
    report_id := find_report_object('myreport');
    set_report_object_property(report_id,REPORT_FILENAME,'c:\developersuitehome_1\reports\'||p_repname||'.rep');
    set_report_object_property(report_id,REPORT_EXECUTION_MODE,BATCH);
    set_report_object_property(report_id,REPORT_COMM_MODE,ASYNCHRONOUS);
    set_report_object_property(report_id,REPORT_DESTYPE,FILE);
    set_report_object_property(report_id,REPORT_DESNAME,'c:\reports\'||p_repname||'.pdf');
    set_report_object_property(report_id,REPORT_DESFORMAT,'pdf');
    set_report_object_property(report_id,REPORT_SERVER,'rep_raysoft');
    reportserverjob := run_report_object(report_id);
    if rep_status = 'FINISHED' then
    copy_report_object_output (reportserverjob,'c/'||prepname||'.pdf');
    host('c/'||prepname||'.pdf',no_screen);
    message('report '||p_repname||' completed successfully');
    else
    message('error when running '||p_repname||' report .');
    end if;
    end;
    notice2: i try to activate the parameter form by adding this line in the procedure
    set_report_object_property(report_id,REPORT_OTHER,'paramform=yes');
    but it desn't make any differance
    so i will be so apreciated if anyone can help me
    thanks
    regards
    yasser elbighily

    Dear All,
    thanks for your attention
    really i modify my code to be appear as follow
    PROCEDURE OPEN_MY_REPORT (p_repname Varchar2) IS
    v_report_id Report_Object;
    vc_ReportServerJob VARCHAR2(100); /* unique id for each Report request */
    vc_rep_status VARCHAR2(100); /* status of the Report job */
    v_reportservername VARCHAR2(50):='rep_raysoft'; /* THE NAME OF THE REPORT SERVER*/
    vjob_id VARCHAR2(100); /* job_id as number only string*/
    BEGIN
    /* Get a handle to the Report Object itself. */
    v_report_id:= FIND_REPORT_OBJECT('MYREPORT');
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_FILENAME,'C:\DevSuiteHome_1\reports\'||p_repname||'.rep');
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESTYPE,FILE);
    /* Define the report output format and the name of the Reports Server
    as well as a parameter form to be displayedwhen required. */
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESFORMAT,'PDF');
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_SERVER,v_reportservername);
    if p_repname = 'REPCENTERSPREADING' then
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER,'paramform=yes');
    else
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER,'paramform=no');
    end if ;
    vc_ReportServerJob := RUN_REPORT_OBJECT(v_report_id);
    message(vc_ReportServerJob);
    message(vc_ReportServerJob);
    vjob_id := substr(vc_ReportServerJob,length(v_reportservername)+2,length(vc_ReportServerJob));
    message(vjob_id);
    message(vjob_id);
    /* If finished, check the report status . */
    vc_rep_status := REPORT_OBJECT_STATUS(vc_ReportServerJob);
    IF vc_rep_status='FINISHED' THEN
    /* Call the Reports output to be displayed in a separate browser
    window. The URL for relative addressing is valid only when the Reports
    Server resides on the same host as the Forms Server. For accessing a
    remote Reports, you must use the prefix http://hostname:port/ */
    WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'|| vjob_id||'?server=rep_raysoft','_blank');
    ELSE
    message ('Report failed with error message '||vc_rep_status);
    END IF;
    END;
    and it helps me to display the parameter form but i face another problem that is when i enter values for my parameter it gives me the following error
    REP-52007: Parameter form format error.
    note: i test the report directly from report builder and it work successfully without any problem
    so can anyone help me please
    yasser elbighily

  • I have no status bar, no menu bar, no maneuverability at all. There appears to be only the center of the webpage and I have to ctl-alt-del to close firefox. There must be a simple solution to correct this.

    Problem began this am- opened firefox 4 and have lost all the manageability buttons-tabs-toolbars. It appears that all I have is the center of the page and the frames around the edge are out of sight or gone. Can't grab a corner/edge to make screen smaller or scroll up/down. Tried reloading and reinstalling FF4 but still same problem

    I mucked about and solved the issue myself by uninstalling FF4 then installing FF3.16.... it still opened up wrong. I deleted something from Mozilla FF ( I had 3 sets of search engine folders) and then managed to get back online with FF instead of Chrome. Will keep your advice in mind should the problem occur again - I never run anything in full screen mode and dumb me does not even know how to do that with FF. Thanks for the answer.....

  • HT201406 I purchased a new iPad 3. When viewing Facebook photos a white ring in the center of the photo appears randomly. I can move photo around with finger and one ring stays in center of screen even on blank part of screen. Help.

    Has anyone experienced a white ring ( like a Cheerios or life saver candy shape)  frozen in center of screen when viewing Facebook photos? You ca move the picture around with your finger, even minimize it and the ring is in the center of the screen. It is random not on all photos as you swipe through them. Could be on any profile photos. When you click done and go back into photos it disappears on the photo or photos that had it previous , but may sow up again on other photos . Again it's a perfect shaped white ring in center of screen. Only on Facebook.

    Not familiar with that but it is worth trying a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release. The screen will go blank and then power ON again in the normal way.] It is app and data safe!

  • What does the Pink circle segment that appears in the center of  the Tool bar

    My iMac has been freezing up the last couple of weeks. It is locked up right now and I cannot access or change things with the mouse on the screen.
    There is a pink circle segment  in the center of the toolbar at the top of the screen??? Can anybody tell me what that means and whether there is a fix for what is going on with my iMac?

    You apparently have had a hardware failure, most likely, and should take your Mac in to let an Apple Genius diagnose it.

  • How to print the JFrame In The Center Of The Page?

    hi there in the following code iam trying to print a JFrame
    but the frame appear in the printed page at the top left
    and i want it to appear in the top center of the page
    how to do that?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.print.*;
    class PrintUIWindow implements Printable, ActionListener {
        JFrame frameToPrint;
        public int print(Graphics g, PageFormat pf, int page) throws
                                                            PrinterException {
            if (page > 0) {
                return NO_SUCH_PAGE;
            Graphics2D g2d = (Graphics2D)g;
            g2d.translate(pf.getImageableX(), pf.getImageableY()-55);
            frameToPrint.print(g);
            return PAGE_EXISTS;
        public void actionPerformed(ActionEvent e) {
             PrinterJob job = PrinterJob.getPrinterJob();
             job.setPrintable(this);
             boolean ok = job.printDialog();
             if (ok) {
                 try {
                      job.print();
                 } catch (PrinterException ex) {
        public PrintUIWindow(JFrame f) {
            frameToPrint = f;
        public static void main(String args[]) {
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            JFrame f = new JFrame("Print UI Example");
            f.addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {System.exit(0);}
            JLabel label1=new JLabel("Selling Bill",JLabel.CENTER);
            JLabel label2=new JLabel("Customer Name :Mahmoud Saleh       ",JLabel.LEFT);
            JLabel label3=new JLabel("Buying Date :29/8/2008             ",JLabel.LEFT);
            JLabel label4=new JLabel("Book Buyed :Java Printing          ",JLabel.LEFT);
            JLabel label5=new JLabel("Number : 6 Copies                  ",JLabel.LEFT);
            JLabel label6=new JLabel("Total Price :600 $                 ",JLabel.LEFT);
            label1.setFont(new Font("Courier New", Font.BOLD, 13));
            label2.setFont(new Font("Courier New", Font.BOLD, 13));
            label3.setFont(new Font("Courier New", Font.BOLD, 13));
            label4.setFont(new Font("Courier New", Font.BOLD, 13));
            label5.setFont(new Font("Courier New", Font.BOLD, 13));
            label6.setFont(new Font("Courier New", Font.BOLD, 13));
            JButton printButton = new JButton("Print This Window");
            printButton.addActionListener(new PrintUIWindow(f));               
            JPanel panel=new JPanel();
            panel.setLayout(new GridLayout(6,1));
            panel.add(label1);
            panel.add(label2);
            panel.add(label3);
            panel.add(label4);
            panel.add(label5);
            panel.add(label6);
            f.setSize(300,300);       
            f.setLocationRelativeTo(null);       
            f.add(panel,BorderLayout.CENTER);
            f.add(printButton,BorderLayout.SOUTH);
            panel.setBackground(Color.WHITE);
            f.setResizable(false);
            f.setVisible(true);
    }

    First_knight wrote:
    please tell me am i thinking right
    about this method: setImageableArea(.....)
    public void setImageableArea(double x, double y,  double width, double height);
    like I said, I've tried this method and it doesn't seem to do anything.
    the width=the JFrame Width,the height=the JFrame Height right?actually, when printing, 72 points (printing version of pixels) = 1 inch, so to do WYSIWYG, you need width = JFrameWidth * 72.0 / Toolkit.getToolkit().getScreenResolution. Ditto with height
    upper left beginningx(0)---------------------------200--------------------------------600-----------------------------------y(1000)upper right beginningyou need to do something like PageSetup.getImageableX and do Graphics.translate(x,y);
    also, if your page width = 720, that = 10 inches - that's a wide page (unless its in landscape)
    so if i want the JFrame To Be In The Center Of The Page I Would Choose From x=200 ,y=600 depending that frame width is 400Actually, it would be 300 - 700 in your example
    Because when i tried to use:setImageableArea(200, 600,  400, 200);like the above code
    no changes occurs in the printed paperYes. You need to offset the Graphics object

  • How do I get alerts to remain in the center of the screen after unlocking my iPhone in iOS 7?

    The whole point of alerts, according to Apple, is to let you know about important events by remaining in the center of the screen until you acknowledge them. So why, when my iPhone 4s is locked and I receive an alert, does absolutely nothing appear when I unlock my phone? I use OmniFocus2 for everything, but the app isn't useful to me without forcing me to acknowledge the alerts I've set up for my to-do's. I've messed with all the notification options (like removing from lock screen), but I simply cannot believe that the only way Apple would allow their alerts to work properly is by forcing me to keep my phone from auto-locking indefinitely.
    Can anyone help?
    Jackie

    I just came from using a BlackBerry Z10 and just got a iphone 5S. I have to say that this is the most ridiculous issue i am having to deal with as well. I use a password for my lock screen and if im not constantly on my phone i will miss a text msg. theres nothing from the lock screen to show you of a missed text or etc and also i dont care that i can look at notifications pull down. that is useless for the common person who doesn't live on the phone. There's no led to help this issue another major negative for me and this issue as well. So pretty much if i dont check my phone periodically i will miss something for sure. Cant believe this phone is considered the flagship of phones, there are SIMPLE issues with iphones that many other company's have fixed YEARS ago. Seriously would a LED light really hurt that bad to put on?! Get a clue apple!
    --sorry for the rant but i have been looking everywhere online and trying many issues to fix this with no luck.

  • Feature request, option to change the chroma of the center of the color wheel, instead of white

    It currently appears in white because of how or eye sees things, and monitors, RGB.  It would be great to extend kuller to be used like painting pigments, with a neutral gray, and\or black at the center of the color wheel instead of going to white, as paintings would do on paper, extending kuler usefulness even more.
    Thanks for your time,
    kjeld

    Post at Apple Feedback.

  • HT201177 MY MACBOOK PRO IS SHOWN GREEN LINE IN THE CENTER OF THE SCREEN

    MY MACBOOK PRO IS SHOWN GREEN LINE IN THE CENTER OF THE SCREEN

    It is probably a display or display connector issue. To check this, take a screenshot of the display by pressing Command, Shift and 3 keys. Then, open the screenshot created in Desktop, and see if the line appears. If not, it is a display issue.
    If you have not got a MacBook Pro with Retina display, you can repair this yourself. You just need to look for the display connector of your MacBook Pro model in the Internet and install it, and if this does not work, you have to replace the whole display.
    However, if you do not know a lot about computers or your Mac is in warranty, you should take the Mac to an Apple Store or reseller to get it repaired

  • How to put the main windows in the center of the screen

    Hello
    I want that first windows appears in the center of the screen. Anyone can say, look at screen size and calculate it, but I don't know what it be the size of the screen when app will run, it depends of computer.
    Thank in advance !

    var screenBounds:Rectangle = Screen.mainScreen.bounds;
    This will give you information about the screen. You can access the height/width using screenBounds.height and screenBounds.width.

  • 8620 printer automatic feed generates an unwanted line in the center of the page

    When using the automatic paper feed for copying or scanning, a line appears exactly in the center of the page, as the page is printed. This does not occur when using the flat bed scanner.

    Hey @briggsmmb, 
    Welcome to the HP Support Forum!  I understand you're having an ADF copy/scanning quality issue when using your HP Officejet Pro 8620 e-All-in-One Printer.  I would like to assist you with this and may have the troubleshooting steps you need to resolve the issue.  
    HP has an article that directly addresses the copy/scan quality issue you're describing:
    HP Officejet Pro 8600 e-All-in-One and Photosmart 7520 e-All-in-One Printer Series - Vertical Bands,...
    Try Solutions One through Four.  Does this clear up the line from the center of your copies and scans?  
    Please let me know the result of your troubleshooting by responding to this post.  
    Have a great day!   
    E-roq
    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 Kudos Thumbs Up on the right to say “Thanks” for helping!

  • Why are my sub-tools showing in the center of the screen

    hi
    ive purchased adobe indesign cc, and generaly use it at work on my mac (works perfectly). however i recently installed it at home and have come across an unusual bug wich i havent seen replecated anywhere else.
    when clicking and holing on a tool (as one does to access the sub-menu of tools) the sub-menu itself appears in the center of the screen, as opposed to next to the tool bar like it should. Does anyone know how the hell to fix this? has anyone else had this problem at least? I should add that happens only in indesign, this is not an issue with the rest of the cc suite. And yes im using the latest update
    i have attatched a screen shot to better illustrate my issue

    See: Troubleshooting 101: Replace, or "trash" your InDesign preferences
    http://forums.adobe.com/thread/526990

  • HT1349 My ipad will not start up, it has the swirl in the center of the screen and has been there for 30hrs now.

    My ipad will not start up, it has the swirl in the center of the screen and has been there for 30hrs now, what can I do?

    First thing to try is a reboot of your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.

Maybe you are looking for

  • Mandatory Prompt not working in crystal report

    Hi, I do know that there is a option to make the prompt mandatory in the prompt selection window by making "Optional Prompt:False" in crystal 2011.If this is the case then report should not run when values are not entered and OK button is clicked in

  • Question about Mini

    Hi, I've had my Mini for about 10 monthes, and yesterday it decided to die on me. I am still on the one year warranty, but I was wondering when I send my Mini in, will I get the parts referbished or a new Mini or Nano. Thanks

  • How to lock a specific text message so it wont be deleted

    I would like to lock a specific someoen sent me but if i delete the rest of the the thread i wont that line will still be there. I used to do it on androind phone wasnt sure if iphone could do that as well.

  • Setting Query timeout

    Is there anyway to set the ODBC query timeout value? We use SQL Server 7.0? If not, how do you cancel a long running statement to the DB?

  • Problem in deleting queries..........

    Hi, When I trying to delete the query… I am getting message that these query has been used in the work books…. When I am trying to see these workbooks, I couldn’t find these two in the role. When I checked in transport connection it is showing these