Writing a class to open jDialog that can be used over and over

Hi All
I am hoping that some out there can help me with this.
I have a lot of Dialogs that I what to open and close.
I am using the code to do that , and it works fine.
What i would like to do is write a class that I can call and just pass in the name of the dialog that I what to open.
Something like this
private String dialogeName;
dialogeName = Contacts;
So from another class using a button I could do this type of call
some way of passing into this class the Dialog name. I don't know how to do that ether .
Is there some way of getting to this private String dialogeName; from another class ??
Is this posable ??
PLEASE SOMEONE HELP ME .....................
    Contacts dlg = new Contacts();   // Works fine  but to have to call the same code over and over
   // is a pain and the only difference is the name of the dialog.
    dialogeName = Contacts;  // this is what I would like to be able to do
   // dialogeName dlg = new dialogeName();
    Dimension dlgSize = dlg.getPreferredSize();
    Dimension frmSize = getSize();
    Point loc = getLocation();
    dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
                    (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setModal(true);
    dlg.pack();
    dlg.show();Thanks to all that have taken the time to look and to help
Craig

Why not simply create a method that wraps all the redundant stuff?
public JDialog showDialog(JDialog dlg)
    Dimension dlgSize = dlg.getPreferredSize();
    Dimension frmSize = dlg.getSize();
    Point loc = dlg.getLocation();
    dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
                    (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setModal(true);
    dlg.pack();
    dlg.show();
    return dlg;
}Then you could call it with all your various dialog types:
Contacts dlg = (Contacts)showDialog(new Contacts());
OtherDialog dlg2 = (OtherDialog)showDialog(new OtherDialog());Of course in this example Contacts and OtherDialog classes must extend JDialog.

Similar Messages

  • F.13 - limit on number of AR open items that can be cleared in one job?

    I am attempting to use F.13 to automatically clear a remittance paying off approx 1,500 open AR items.  The job appears to finish normally but the open items are not cleared.  Is there a maximum number of open items that can be cleared using F.13 - if so what is the number?  All help appreciated.

    Hi,
    If there is a limit (which I doubt), it certainly not set to 1500 items. I new projects where daily quantity of open items was 3-4 times more and still the clearing worked impeccably. Try running this job in background and see the log. Also, make sure, that the 'test run' is switched off.
    Regards,
    Eli

  • Creating a class library in VS2013 that can be referenced by a VB6 application and newer applications

    I need to create a class library in VS2013 that can be referenced by a VB6 application and newer applications. I heard something about
    COM Interop but have no idea where to start. I am assuming I would develop a class library in VS2013 and then package the assembly for COM. Any good sample projects on this out there?

    Hello,
    >> Any good sample projects on this out there?
    Not suer if you are using C# as the develop language, if it is, i think you would find a lot of articles about this topic with your favorite search engine, here are some related links:
    COM Interop Part 1: C# Client Tutorial
    COM Interop Part 2: C# Server Tutorial
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Need to know of a method / process that can be used to send the same msg to all those appearing in my email listings with the same extension after the "@" sign in their address(es) on my macbook [e.g., with "@gov.ca"; Snow Leopard].

    Need to know of a method / process that can be used to send the same msg to all those appearing in my email listings with the same extension after the "@" sign in their address(es) on my macbook [Snow Leopard].

    If you simply want to send the exact same message to everyone in your address book with emails ending in "@whatever.com", you can do the following:
    Create an email with subject, message and attachments but no addresses
    Open Address Book, All Contacts
    Search in Address Book for @whatever.com
    Select the results and drag them into the To: or Bcc: field of the email. If Bcc: then put your email address in the To: field.
    Send the email
    This will not personalize the emails (such as with "Dear firstname:" at the top of the message) but it will let you send an idential message to everyone who meets your criteria.

  • I cant use my contacts in my iphone. the contacts icon dont open. How can I use it?

    i cant use my contacts in my iphone. the contacts icon dont open. How can I use it?

    Your daughter must have signed into your iCloud account, perhaps when she updated her phone.  You can confirm this by going to Settings>iClloud on her phone and seeing if she is using the same iCloud ID.
    To fix this you would need to migrate her phone to a separate iCloud account.  To do this, start by saving any photo stream photos that she wishes to keep on your phone to her camera roll by opening her my photo stream album, tapping Select, tapping the photos, tapping the share icon (box with upware pointing arrow), then tapping Save to Camera Roll.
    Then go to Settings>iCloud, tap Delete Account and provide the password when prompted to turn off Find My iPhone.  This only deletes the account from her phone, not from iCloud; it won't effect your device(s).  When you delete the account you will be asked if you want to keep or delete the iCloud data from her phone.  If she needs to migrate a copy of the data to her new account, choose Keep; otherwise, choose Delete.  Then sign back in with a separate Apple ID to create her new account and if migrating data to the new account, choose Merge when prompted.
    Once she is on a separate account, if she migrated a copy of the data to her new account you can go to icloud.com from your computer, sign into her new iCloud account and delete your data from her account.

  • If i download windows with bootcamp does that mean i can still use Macintosh and if so how

    if i download windows with bootcamp does that mean i can still use Macintosh and if so how

    Welcome to Apple Support Communities
    If you installed Windows properly, you can still start in OS X and use it whenever you want. However, Boot Camp changes the startup partition to Windows, so you may note that you can't use Mac OS X.
    There are two ways of starting in OS X:
    1. Hold the Option (Alt) key while your computer is starting until you see all the bootable partitions in the screen, and choose your OS X partition.
    2. Hold the X key while your computer is starting.
    If you have a iMac or a Bluetooth keyboard, make sure you hold the key after hearing the startup chime.
    If you want to start in OS X by default, after starting in OS X, open System Preferences > Startup Disk, and choose the OS X partition

  • Third party reporting tools that can be used with WLI 8.1

    All:
    I am working on Weblogic Integration 8.1. I am wondering are there any ready tools that can be used with WebLogic Integration process related tables to get different types of reports out of it.
    Can somebody point me to these tools??
    TIA,
    Prashanth Bhat.

    Are you using ADE to read bought books, library books, or only free books?
    If only free books, I suggest you install the superior free Calibre instead (http://calibre-ebook.com/)
    For bought or library books you do need to install ADE on the new machine.
    You will also need to register it with your Adobe ID; the same one you used on the last machine.
    If you can't remember that ID or the password, ask, and we may be able to help.
    I will give instructions for the latest version of ADE (2.0.1), even though I am afraid it has more problems than the old one it is more 'standard'.
    Goto http://www.adobe.com/uk/products/digital-editions/download.html
    Click on the 'Download Digital Edition 2.0.1 Windows (5.6 MB)'  (you can go direct to http://download.adobe.com/pub/adobe/digitaleditions/ADE_2.0_Installer.exe if you prefer)
    When it has downloaded you must open/run it.  If you are using Internet Explorer, choose the Run option when you start the download.
    It should now go through a fairly standard install procedure, asking if it is ok to run the program, etc etc
    Take the easy 'yes' or equivalent option at each step.
    When it is safely installed, run it.  It should have put an icon on the desktop.
    You now need to authorize ADE. 
    Use ctrl-shift-U which will open up a dialog asking for your Adobe ID and password.
    You should now be able to use it pretty much as you used ADE on your old machine.
    Good luck.  Unfortunately not a very easy process even when all works well, and there are several things that can go wrong.
    Don't hesitate to ask again if you need help.

  • Example of creating  ALV double click event that can be used in ANY Program

    Once you get the hang of OO you can really create useful generalized code that can be used in a huge number of situtations.
    Double click on ALV is often wanted
    Right  here goes to implement a generalized double click action that returns the row, column and column name back to the caller.
    In your CLASS  in the DEFINITION part code as follows.
    CLASS zcl_dog DEFINITION.
    PUBLIC SECTION.
    METHODS:
      constructor
          IMPORTING       z_object type ref to zcl_dog,
                         i_parent     type ref to  cl_gui_custom_container,
    PRIVATE SECTION.
    on_dubbelklik FOR EVENT double_click OF cl_gui_alv_grid
          IMPORTING e_row
                    e_column
                    es_row_no,
    dubbleklik
          IMPORTING
                     e_row  type  LVC_S_ROW
                     e_column   TYPE LVC_S_COL
                     es_row_no  type lvc_s_ROID
                     program type sy-repid.
    code here any extra any methods you need.
    In the CONSTRUCTOR method of the implementation
    CLASS zcl_dog IMPLEMENTATION.
    METHOD constructor.
       CREATE OBJECT grid_container1
           EXPORTING
                   container_name = 'CCONTAINER1'.
        CREATE OBJECT  grid1
            EXPORTING
                  i_parent = grid_container1.
        SET HANDLER z_object->on_user_command for grid1.
        SET HANDLER z_object->on_toolbar for grid1.
        SET HANDLER Z_OBJECT->handle_data_changed_finished FOR grid1.
        SET HANDLER Z_OBJECT->on_dubbelklik FOR grid1.
    endmethod.
    METHOD on_dubbelklik.
    CALL METHOD me->dubbleklik
    exporting
                     e_row  = e_row
                     e_column =  e_column
                     es_row_no = es_row_no
                     program  = sy-repid.
    break-point 1.
    method dubbleklik.
      perform dubbleklik IN PROGRAM (program)
        using
        e_row
        e_column
        es_row_no.
      ENDMETHOD.
    endclass.
    This will now perform a routine called dubbleklik  in your application program whenever you double click a cell in the grid.
    In the application program just code the following
    DATA:  z_object type ref to zcl_dog,  "Instantiate our class
           grid_container1 type ref to cl_gui_custom_container,
    CREATE OBJECT z_object EXPORTING z_object = z_object.
    call ANY method in the class  which eventually displays the grid
    CALL METHOD z_object->build_dynamic_structures
            CHANGING it_fldcat = it_fldcat.
    form dubbleklik using
            e_row   type LVC_S_ROW
            e_column type LVC_S_col
            es_row_no type lvc_s_roid.
    break-point 1.
    endform.
    When you double click a cell you'should be at the break point in your routine in the application program.
    You've got the cell that was clicked so by reading your table you can examine the data and take the appropriate action.
    Cheers
    Jimbo

    I suggest you purchase a case and have a dedicated support engineer work with you directly:
    http://www.sdn.sap.com/irj/boc/gettingstarted
    Or
    http://store.businessobjects.com/store/bobjects/Content/pbPage.CSC_map_countyselector/pgm.67024400?resid=jFmmLgoBAlcAAALO-iYAAAAP&rests=1278687224728
    If this is a bug you'll get a refund, if not post your enhancement request in the Idea Place. Or the Rep will suggest a better way to create your report.

  • What is the most advanced version of ACR that can be used with Photoshop CS5?

    What is the most advanced version of ACR that can be used with Photoshop CS5?
    Will it open RAW files from a Canon 5D Mark III ?

    CS5 can use up to ACR 6.7.1.  CS6 started with ACR 7.0.
    The 5D Mark III was first supported with ACR 6.7.
    ACR 6.7.1 can be downloaded from the Camera Raw Mac and Win links on the Adobe Download page:
    http://www.adobe.com/downloads/updates.html
    References:
    http://helpx.adobe.com/x-productkb/global/camera-raw-compatible-applications.html
    http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html

  • A script that can be used to track text content changes in indesign?

    Is there a possibility a script that can be used to track text content changes in indesign. My Indesign software's version is CS3. As you can see below, I have deleted some texts and added some. I did it in another software.
    I have been searched for a long time. Because of my poor English, I still can't come up with any Object Model related to the script yet.
    Here is some idea of mine:
    Use the script tracking my revising texts. When I  add some new texts, the texts will be underlined. When I delete some texts, the position of the first character of the removed text will be added a small red triangle or something.
    Thanks in advance.

    Hidden dragon, what does that mean?
    I can't comprehend fully what you said.
    Is IDML short for Indeisgn Markup Language?
    I think you are telling me that I can open the Indeisgn document by using the software InCopy. Then I have change some contents. InCopy will help me tracking the revision.
    getZinger. Do I get your point?

  • Some iOS Native extensions that can be useful

    Hi,
    I have made some iOS Native extensions that can be useful.
    You can find it at https://github.com/xperiments?tab=repositories
    ANE7z
    => Adobe AIR iOS Native Extension to decompres 7z files.
    ANEZipFile
    => Adobe AIR iOS Native Extension to zip/unzip files.
    ANEFileSyncInterface
    => A micro http server with FileManagement capabilities Native Extension
    IOSSystemUtils
    => Adobe Air IOS Native Extension to control Brightness / Torch / Badge
    ANEUnRar
    => Adobe Air Native Extension to Obj-C UnRar Lib
    Please give me your comments

    First of all, thank you for creating this extension. However, it doesn't seem to work. Below is my code for decompressing ByteArray (error handling is stripped for simplicity):
                        public function decompress(aData:ByteArray):ByteArray {
                                  // Save data to file
                                  var fileInput:File = File.applicationStorageDirectory.resolvePath("input.7z");
                                  var stream:FileStream = new FileStream();
                                  stream.open(fileInput, FileMode.WRITE);
                                  stream.writeBytes(aData);
                                  stream.close();
                                  var folderOutput:File = File.applicationStorageDirectory.resolvePath("output");
                                  ANE7z.decompress(fileInput, folderOutput);
                                  var files:Array = folderOutput.getDirectoryListing();
                                  for each (var fileOutput:File in files) {
                                            trace("Extracted file: " + fileOutput.nativePath);
                                            if (!fileOutput.isDirectory) {
                                                      var bytes:ByteArray = new ByteArray();
                                                      stream = new FileStream();
                                                      stream.open(fileOutput, FileMode.READ);
                                                      stream.readBytes(bytes);
                                                      stream.close();
                                                      bytes.position = 0;
                                                      return bytes;
                                  return null;
    The problem is folderOutput.getDirectoryListing() always returns an empty array.

  • System Image Restore Fails "No disk that can be used for recovering the system disk can be found"

    Greetings    
                                        - Our critical server image backup Fails on one
    server -
    Two 2008 R2 servers. Both do a nightly "Windows Server Backup" of Bare Metal Recovery, System State, C:, System Reserved partition, to another storage hard drive on the same machine as the source. Active Directory is on the C: The much larger D: data
    partition on each source hard drive is not included.
    Test recovery by disconnecting 500G System drive, booting from 2008R2 Install DVD, recovering to a new 500G SATA hard drive.
    Server A good.
    Server B fails. It finds the backed-up image, & then we can select the date we want. As soon as the image restore is beginning and the timeline appears, it bombs with "The system image restore failed. No disk that can be used for recovering the system
    disk can be found." There is a wordy Details message but none of it seems relevant (we are not using USB etc).
    At some point after this, in one (or two?) of the scenarios below, (I forget exactly where) we also got :
    "The system image restore failed. (0x80042403)"
    The destination drive is Not "Excluded".
    Used   diskpart clean   to remove volumes from destination drive. Recovery still errored.
    Tried a second restore-to drive, same make/model Seagate ST3500418AS, fails.
    Tried the earliest dated B image rather than the most recent, fail.
    The Server B backups show as "Success" each night.
    Copied image from B to the same storage drive on A where the A backup image is kept, and used the A hardware to attempt restore. Now only the latest backup date is available (as would occur normally if we had originally saved the backup to a network location).
    Restore still fails.         It looks like its to do with the image rather than with the hardware.
    Tried unticking "automatically check and update disk error info", still fail.
    Server A  SRP 100MB  C: 50.6GB on Seagate ST3500418AS 465.76GB  Microsoft driver 6.1.7600.16385   write cache off
    Server B  SRP 100MB  C: 102GB  on Seagate ST3500418AS 465.76GB  Microsoft driver 6.1.7600.16385   write cache off
    Restore-to hard drive is also Seagate ST3500418AS.
    http://social.answers.microsoft.com/Forums/en-US/w7repair/thread/e855ee43-186d-4200-a032-23d214d3d524      Some people report success after diskpart clean, but not us.
    http://social.technet.microsoft.com/Forums/en-US/windowsbackup/thread/31595afd-396f-4084-b5fc-f80b6f40dbeb
    "If your destination disk has a lower capacity than the source disk, you need to go into the disk manager and shrink each partition on the source disk before restoring."  Doesnt apply here.
    http://benchmarkreviews.com/index.php?option=com_content&task=view&id=439&Itemid=38&limit=1&limitstart=4
    for 0x80042403 says "The solution is really quite simple: the destination drive is of a lower capacity than the image's source drive." I cant see that here.
    Thank you so much.

    Hello,
    1. While recovering the OS to the new Hard disk, please don't keep the original boot disk attached to the System. There is a Disk signature for each hard disk. The signature will collide if the original boot disk signature is assigned to the new disk.
    You may attach the older disk after recovering the OS. If you want to recover data to the older disk then they should be attached as they were during backup.
    2. Make sure that the new boot disk is attached as the First Boot disk in hardware (IDE/SATA port 0/master) and is the first disk in boot order priority.
    3. In Windows Recovery Env (WinRE) check the Boot disk using: Cmd prompt -> Diskpart.exe -> Select Disk = System. This will show the disk where OS restore will be attempted. If the disk is different than the intended 2 TB disk then swap the disks in
    correct order in the hardware.
    4. Please make sure that the OS is always recovered to the System disk. (Due to an issue: BMR might recover the OS to some other disk if System disk is small in size. Here the OS won't boot. If you belive this is the case, then you should attach the
    bigger sized disk as System disk and/or exclude other disks from recovery). Disk exclusion is provided in System Image Restore/Complete PC Restore UI/cmdline. 
    5. Make sure that Number and Size of disks during restore match the backup config. Apart from boot volumes, some other volumes are also considered critical if there are services/roles installed on them. These disks will be marked critical for recovery and
    should be present with minimum size requirement.
    6. Some other requirements are discussed in following newsgroup threads:
    http://social.technet.microsoft.com/Forums/en-US/windowsbackup/thread/871a0216-fbaf-4a0c-83aa-1e02ae90dbe4
    http://social.technet.microsoft.com/Forums/en-US/windowsbackup/thread/9a082b90-bd7c-46f8-9eb3-9581f9d5efdd
    http://social.technet.microsoft.com/Forums/en-US/windowsbackup/thread/11d8c552-a841-49ac-ab2e-445e6f95e704
    Regards,
    Vikas Ranjan [MSFT]
    ------- This information is provided as-is without any warranties, implicit or explicit.-------

  • Is there a limit to no. of summary fields that can be used in a cross tab?

    Hi,
    While creating a cross tab is there a limitation to number of summarized fields that can be used?
    - The cross tab when uses 184 fields as summary fields leads to Crystal report application to crash at the time of export to excel.
    - Tried with two Datasources: XML and excel
    - If we reduce the number of summary fields used to 102 exactly, export works fine in excel.
    - If 2 cross tabs are used each containing 92 summary fields(in order to show 184) export to excel works fine.
    Please let me know if there is any such limitation which leads to CR application to crash when exporting in excel?
    Thanks
    Regards,
    Nidhi

    I suggest you purchase a case and have a dedicated support engineer work with you directly:
    http://www.sdn.sap.com/irj/boc/gettingstarted
    Or
    http://store.businessobjects.com/store/bobjects/Content/pbPage.CSC_map_countyselector/pgm.67024400?resid=jFmmLgoBAlcAAALO-iYAAAAP&rests=1278687224728
    If this is a bug you'll get a refund, if not post your enhancement request in the Idea Place. Or the Rep will suggest a better way to create your report.

  • When I sync my iphone 4S using iTunes it only syncs 8.5GB of music, not the entore library as specified.  Is there a capcity default limit of the amount of storage that can be used for music and if so how do I change it?

    When I sync my iphone 4S using iTunes it only syncs 8.5GB of music, not the entore library as specified.  Is there a capcity default limit of the amount of storage that can be used for music and if so how do I change it?

    The only limit is that of the device. No restrictions on how much of it you can use for music. Is part of your music library unchecked?
    tt2

  • What format i should use for my external hard drive that can be used interchangeably between mac and pc?

    What format i should use for my external hard drive that can be used interchangeably between mac and pc?

    Usually Fat32/MS-DOS as mentioned, but that has several limitatiuns, like 4GB filesize limit.
    One option is MacDrive for you PCs... allows them to Read/Write HFS+...
    http://www.mediafour.com/products/macdrive/
    More options...
    NTFS-3G Stable Read/Write Driver...
    http://www.ntfs-3g.org/
    MacFUSE: Full Read-Write NTFS for Mac OS X, Among Others...
    http://www.osnews.com/story/16930

Maybe you are looking for

  • HT201250 i'm getting message: can't be opened because you don't have permission to see its contents. and he operation can't be completed because an unexpected error occurred (error code -8003).

    I took my computer in to have the Backup restored onto my computer after having a new harddrive put onto my 1year 1/2 old MacBook Pro. When i got it home there was a new User that i had to logout of to getting into my normal user. Don't know why this

  • Font problem with Reader 9.3

    We have a problem with unusual font displayed for a PDF file created on a Mac with Microsoft Office.  It displays properly on Windows with Adobe Reader 9.3 and on Linux (Fedora 12 and Red Hat Enterprise Linux 5.4) with kpdf and evince.  However, on b

  • Page No Parameter

    Hi, Just a very quick question. I have a form and perform the following conditional display. Condition Type: PL/SQL Function Body Returning a Boolean Expression 1: declare l_return boolean; begin APP_PARMS.CHECK_LOAD('&DISPLAY_USER.',41,l_return); re

  • Reg.HTTPs

    Hi, Scenario is SOAP-XI->SAP. Here my sender is having a Webserver(Tomcat). Webserver was configured with SSL. It will communicate over HTTPS to target components(in our case it XI). So, here my question is Do XI need to install any kind of digital c

  • Getting a warning before credit card debited in iTunes / App Store

    When I first purchased and app via my new iPad on the App store, it asked for confirmation.  Today I purchased an app, the price (white on grey) changed to white on green "Install".  After hitting Install, I expected a warning or confirmation message