How to find primary monitor

Hi,
I need to find whether frame is on Primary monitor or not. How to find out?
Regards
Ketan

I am not really sure but I just did some tests and on my machine it looks as if the primary monitor is the one whose bounds start at 0,0.
Of course I only tested with an "extended desktop" setting, where my desktop is spanned across 2 monitors. But in the case where both monitors show the same stuff it shouldn't really matter, right?
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridLayout;
import java.awt.Rectangle;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class PrimaryMonitor
  public static void main(String[] args)
    GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] screenDevices = graphicsEnvironment.getScreenDevices();
    for(GraphicsDevice screenDevice : screenDevices)
      System.out.println(screenDevice + ", ID=" + screenDevice.getIDstring());
      GraphicsConfiguration screenConfiguration = screenDevice.getDefaultConfiguration();
      Rectangle screenBounds = screenConfiguration.getBounds();
      System.out.println(screenBounds);
      JFrame frame = new JFrame(screenDevice.getIDstring());
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setLayout(new GridLayout(0, 1));
      frame.add(new JLabel(screenDevice.getIDstring()));
      frame.add(new JLabel("" + screenBounds));
      if(screenBounds.x == 0)
        frame.add(new JLabel("Primary?"));
      frame.setBounds(screenBounds.x, screenBounds.y, 600, 200);
      frame.setVisible(true);
}

Similar Messages

  • How to find Primary Key for a particular SAP Databse Table?

    Hi Guys,
                  How to find Primary Key and foreign key  for Particular SAP Databse table ?for Ex : EKKO , EKPO , EKKN , EKBE , EKBEH  , EKET and EKETH.
    Thanks,
    Srinivas.

    Use transaction SE11 to display the table. Put the cursor on the field you want to display the check table and click 'Foreign key' push button (a key with an bottom point arrow), then it will show the check table of the foreign of a field.
    Or by just simple double click on the field, a pop-up window of all the attribute (including the foreign key and the check table if exists) will show too.
    <i><b>Please reward point for helpful answer.</b></i>
    Minami

  • How to find primary constraint column

    How can i get the column names of the primary keys if i know the CONSTRAINT_NAME, and CONSTRAINT_TYPE = "P" in the user constraints of the table name.
    thanx in advance
    utsab

    Hi,
    Have you tried using the table USER_CONS_COLUMNS ?
    This has information about columns in constraint definitions.
    Hope this helps.
    Sujatha.

  • How to find primary key?

    I am trying to impliment a load using JDBC wherein I read the table name, some column names, and associated
    column data from a file (delimited or XML). The primary key columns are in the column names / data BUT I don't
    know which columns they are (based on the file I'm reading). Even if this information was in the file, I would need to
    verify the table I'm targeting does in fact have that primary key. I can insert the records fine BUT to use the records
    to update I need to determine from the database which are the primary key columns (by name).
    Essentially I'm trying to do the following:
    insert record into table
    if fails because of duplicate primary key
    determine the primary key of the current table
    retrieve the already existing record
    modify the retrieved record using my load data
    update the already existing record in the database
    My primary concern, now, is Oracle although I'm hoping to impliment this in as portable a fashion as possible.
    Thanks.
    R.Parr
    TemporalArts
    608.833.4578
    null

    You can check the DBA_CONSTRAINTS view for that: http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_1037.htm#i1576022

  • When using 2 monitors, Finder always displays on primary monitor even after dragging to 2nd monitor.

    How can I set Finder to display to 2nd monitor.  I drag it to the second monitor, but it still display on primary monitor when next opened.

    Thank you for your reply. No other program behaves this way, even PhotoShop CS4. It is related to how the program handles OS events.
    It is probably a problem with the Windows WM_GETMINMAXINFO and WM_SIZE handlers. My guess is that program stores the maximized size (and it always fills the screen at start-up) and it query to see if it is dragged to a larger screen.
    Of course, this theory doesn't address the disappearing program behavior when maximized on the secondary monitor. Since I don't have another OS, I cannot check if it is Vista related or Windows related. Because of the difference in architecture, I'd be surprised if it happened on a Mac, too.

  • How to find out the primary key of oracle apps tables

    Hii,,
    My Question is How to find the primary key in the apps table...Is there any Query or other way to find out???
    for eg.
    I want to find out the primary key of the AP_INVOICES_ALL table...just tell me how can i get the primary key of this table.
    I am currently using toad for the query..
    Please guide me...

    you can define the primary key when you create table
    or add the primary key after the table creation by 'ALTER TABLE ... ADD constraint pk_nme primary key (col1, col2)';
    you could use below sql to check the detail of primary key:
    1) check out the table definition directly:
    select dbms_metadata.get_ddl('TABLE','EMP') FROM DUAL;
    2) check out the columns of primary key:
    select * from user_constraints where constraint_type='P' AND table_NAME='EMP';
    select * from user_cons_columns where CONSTRAINT_NAME='PK_EMP';And BTW, it is madam, not sir. :)
    Edited by: PhoenixBai on Dec 17, 2010 1:07 PM

  • How to find out the primary and failover DNS name

    Hi;
    This sounds very stupid, but could some one please tell me how to find out the name/dns name of the primary and failover server without using the CDS console.
    any help is appreciated

    Is this what you want?
    $ /usr/lib/ldap/ldap_cachemgr -g
    cachemgr configuration:
    server debug level 0
    server log file "/var/ldap/cachemgr.log"
    number of calls to ldapcachemgr 12729
    cachemgr cache data statistics:
    Configuration refresh information:
    Previous refresh time: 2005/08/07 23:54:59
    Next refresh time: 2005/08/08 00:55:00
    Server information:
    Previous refresh time: 2005/08/14 15:15:00
    Next refresh time: 2005/08/15 03:15:00
    server: ldap1.example.com, status: UP
    server: ldap2.example.com, status: UP
    server: ldap3.example.com, status: UP
    Cache data information:
    Maximum cache entries: 256
    Number of cache entries: 0
    Gary

  • How i can Find primary key combination?

    Hi,
    I have small doubt how i can find primary key combination for a record in siebel application.( For example Opportunity list applet or Account list applet or etc.. what is the primary key combination and how i can find that combination for a particular record)
    Thanks & Regards

    Hi
    From the applet Identify the Business Component (BC)
    From the BC idnetify the table, and the property user key sesuence will give you the proper combination. Column conflic_id is used for handling remote synchronization.
    For BC based on S_PARTY, such as COntact, the table mentionned in User PRop will give your the main table used in this case.
    Best Regards
    EvtLogLvl

  • How to find what are all the rules and events are monitoring for specific server in SCOM 2007

    how to find what are all the rules and events are monitoring for specific server in SCOM 2007.
    I need to know what are all the events, services, and rules are monitored for the specific server.
    Kindly help me friends.

    how to find what are all the rules and events are monitoring for specific server in SCOM 2007.
    I need to know what are all the events, services, and rules are monitored for the specific server.
    Kindly help me friends.
    Thanks for the question Sandoss. This is something that we all come across at sometime.
    Thanks & regards, Sumit Agrawal
    The lack of this feature is an inexcusable oversight for an enterprise management product.  They have some serious lightweights making design decisions on the SCOM team. 5 thumbs down. 
    BTW the answer is probably LOTS of stuff. Literally 100's of workflows are running on any server. 
    The following OpsMgr DB query will list all running monitors on a server. Change the name of @srv. I think this works pretty well.  I'd like some feedback if something is missing.
    DECLARE @srv varchar(30)
    SET @srv = 'your name here'
    SELECT mon.displayName as monitor, bme.FullName,bme.DisplayName as object,
    case
        when s.HealthState = 1 then 'healthy'
        when s.HealthState = 2 then 'Warning'
        when s.HealthState = 3 then 'Critical'
        else 'N/A'
    end as Health
    FROM state AS s WITH (NOLOCK)
    left join BaseManagedEntity as bme WITH (NOLOCK) on s.basemanagedentityid = bme.basemanagedentityid
    left join dbo.MonitorView Mon WITH (NOLOCK) on Mon.ID = s.monitorid
    where
    bme.FullName like '%' + @srv + '%'
    and s.HealthState <> 0
    and mon.IsInternalRollupMonitor = 0
    and mon.IsExternalRollupMonitor = 0
    order by bme.DisplayName, mon.displayName

  • How to find the right primary key for DSO from Business Content

    According to best practice design, it is reccomended to make a  DSO where all fields from Business COntent Datasources are transferred.
    But, how to find the right primary indeks ?
    Any good suggestions ?
    For many of the Business Content dataflows there are not DSOs present, so ther e is no tip to get from the dokumentations as gfar as I have found.
    best Regards
    Ingrid

    Hi Ingrid,
    Your question will be perfect in case if you are going for a Custom cube.
    You will not have any problem when you create a Datasource in R/3 level even if it is been built on a single table or on view.
    Only point that you want to know how to design my Key fields in ODS.
    This will be purely depends at what level that you want to bring the data.
    Egg:-
    If you run the data source in RSA3 and check for Each GL if you have 10 liine items and you want all the 10 line items to be transfered to BW.
    In this case you need to check what is the unique combination of fields that is making this lineitems to exists as 10.then include all those fields into Your ODS Key Fields.
    This way you can have 10 records for that perticular GL in both sides, by which u will make sure that the data is been completely transfered.
    If in case if you clude your own Key fields then you will get the correct Total in report for each GL but you can't see all those 10 line items.
    For any case you need to figureout how many records that you want to take into BW based on that check the fields that makes it unique and then add them to ODS Keyfields that will solve your requirement.
    I think this will clear your doubt.
    Best Regards,
    VNK.

  • How can I view itunes visualizer on my second monitor whilst still using my primary monitor

    it's a nightmare! I have a windows laptop, i drag the itunes widow over to the 2nd monitor switch to visualizer press full screen and it works on my second monitor but my primary monitor goes black so i can't do anything! please help!

    There's nothing you can do.
    iTunes is one window only.

  • How to find out the size of files transferred over the SQL * Net?

    I am trying to test the Advanced Compress (AC) for 11g Data Guard. When the AC is turned on, the archived log files are supposed to be compressed on the primary database server and sent over SQL*Net, then decompressed on the standby db server. We will see the file sizes are the same on both primary and standby servers. I want to verify that the AC works by monitoring how much data are sent over SQL*Net. Per Oracle, AC uses 35% less of the bandwith. That means the size of the files transferred should be at least 65% of the original size.
    Is there a way to find out the size through Oracle utilities? If not, how to find out by OS utilities? OS is Solaris 5.10.
    Thanks.

    I'm not sure this can be done via SQL*Net, but a network packet sniffer between the two servers should be able to help - you might want to contact your network team.
    HTH
    Srini

  • Windows (7/8/8.1) moves everything to primary monitor after they are powered off.

    When using multiple monitors Windows moves all open windows and apps to the primary monitor after they have either gone to sleep or been powered off. I have been looking for 2 months now trying to find a solution. My current setup is running Windows 8.1
    with an AMD Radeon R9 285X and the drivers are current. However I just switched from Windows 7 a month ago, and I changed from an NVidia card 3 months ago, all with the same result.
    This is getting ridiculous Microsoft. This issue has been reported since 2009 and I have not seen a proper fix yet.  Please don't bother telling me to update the drivers, I've done that, with both cards and in both OSs. The only solutions I've read
    about involve using questionable hardware measures in order to fix a "feature" Microsoft is imposing on people. With more and more industries moving to multiple monitor setups this seems like a poor decision on Microsoft's part. Somehow, forcing
    people to leave their monitors on constantly in order to make them work properly seems a violation of energy star compliance.
    The following are just some of the threads that relate to this topic in one way or another, all run my Microsoft and none with a proper fix, only MS saying its a feature, or update the drivers, or some other none helpful answer.
    http://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/multi-monitor-problem-on-windows-7/ecefb1e5-22c9-4014-a2ad-dbf56570b25c
    https://social.technet.microsoft.com/Forums/windows/en-US/8a9b5aa7-fe33-4e6d-b39b-8ac80a21fdc2/disable-monitor-off-detection-how?forum=w7itprogeneral
    https://social.technet.microsoft.com/Forums/windows/en-US/579e675f-9246-4205-bfd8-5bfcd1bdf4e6/auto-detect-unplugged-monitor-where-to-turn-off?forum=w7itproinstall

    Hi,
    As mentioned in this link (and this has been already mentioned in the link posted above)
    http://windows.microsoft.com/en-US/windows-vista/Understanding-multiple-monitors
    When you disconnect the additional monitor, the original display settings are restored to your primary display. In addition, all open files and program windows are moved to the primary display. The next time  that you connect the same monitor, Windows
    automatically applies the display settings that you used the last time that you connected this monitor. (same in OS Windows 7\8\8.1)
    According to your description, the monitor is automatically disconnected when it has either gone to sleep or been powered off that causes the annoying issue, If possible, I suggest you check whether there's a "source detection settings"
    (or something like this) for the monitor,  set the monitor always active as a alternative solution.
    Yolanda Zhu
    TechNet Community Support

  • Changing Primary Monitor

    Hi All,
    I have a G5 Dual 2.5ghz running OSX10.5.2 that came with an ATI Radeon 9800XT video card. I am using 2 monitors, a 17" Apple studio display (DVI connector) and a Dell 24" LCD (DVI-I? connector - it plugs into the ADC port). The Apple display comes up as the primary display with the menu bar and such. The Dell comes up as the secondary display. I want to use the Dell as my primary monitor. How can I tell OSX to make the Dell my primary monitor? I can't seem to find a control for this in Display Preferences. Please advise. Thanks

    Welcome to Apple Discussions!
    In Apple menu -> System preferences -> Displays, locate the white bar on top of the icon representing one display and drag it to the icon representing the other display. This switches which monitor is primary.

  • Xorg Automatically Detects The Wrong 'Primary' Monitor

    Running KDE on an HP dv9910us with the nVidia binary drivers.
    lspci for the video card is:
    00:12.0 VGA compatible controller: NVIDIA Corporation C67 [GeForce 7150M / nForce 630M] (rev a2)
    I have an external monitor that it will detect and configure as the primary monitor on every boot. The fix is simple, I launch the nVidia X Server Settings and check 'Make this the primary display for the X screen' and things switch over just fine, however this needs done at every boot.
    I'm sure I could export the X configuration file and that would take care of it, but I would prefer to leave the system to auto-configure each time (it feels right to have it this way). Is there a way to ensure that it will detect the built into the laptop screen as the default?
    Instinct is telling me that it is choosing the larger display as the default:
    Internal screen: 1440x900
    External screen: 1920x1080
    Any thoughts would be appreciated.

    I finally found what appears to be the solution:
    https://bbs.archlinux.org/viewtopic.php?id=120173
    Not sure how I was unable to find that before hand.
    Also, there were many files in xorg.conf.d:
    -rw-r--r-- 1 root root 1761 Sep  9 13:12 10-monitor.conf
    -rw-r--r-- 1 root root  193 May  5 23:56 10-monitor.conf~
    -rw-r--r-- 1 root root  192 May  5 23:56 10-monitor.conf.broken
    -rw-r--r-- 1 root root 1772 May  5 23:42 10-monitor.conf.bak-2012050502
    -rw-r--r-- 1 root root 1959 May  5 23:39 10-monitor.conf.bak-20120505
    -rw-r--r-- 1 root root 1696 Apr 20 13:36 10-monitor.conf.backup
    -rw-r--r-- 1 root root 1696 Feb 11  2012 10-monitor.conf.PERFECT.bak
    -rw-r--r-- 1 root root 1727 Feb  6  2012 10-monitor.conf.working-twinview
    How does this directory work? Will all of these files be used for configuration, or just the ones ending in .conf?

Maybe you are looking for