• Post Reply Bookmark Topic Watch Topic
  • New Topic

Identifying default/primary display to position GUI

 
Nate Lockwood
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm on Ubuntu 10.04 64 bit on a notebook with a second display attached. My GUI starts on the secondary monitor (as do some other aps and system windows - Arghhhh) so I want to ensure that it always starts on the primary, notebook, monitor. I'm new to Java especially GUIs but was able to get this to work as desired on this machine.

My question is: Is the test code below the best way to do this? I'd like to create a class that may be used by any other GUIs that I write.

I found that the string "0.0" specifies the notebook monitor and "0.1" would identify the second monitor but I don't know what the first zero stands for and it worries me a little. That is my use of it smells of a hack to me.

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found that the string "0.0" specifies the notebook monitor and "0.1" would identify the second monitor but I don't know what the first zero stands for and it worries me a little.

I am not sure, but I am just thinking out loud here.
It probably maps to rows and columns? Remember, one can have a grid of multiple monitors, and one can even define the placement?
 
Nate Lockwood
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes sense but the "screen", which includes both monitors, has the second monitor above the notebook which directly maps to the physical configuration. Perhaps :0,0 is the coordinate of the lower left. In any case in my setup yoffs is 1024 in "screen" coordinates, the height of the upper display. I modified some of the code that was designed to produce a frame that would fill the physical display. If I have time today I'll play around a bit and see if I can't simplify this.

Any suggestions on a first book for SWING?

Thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any suggestions on a first book for SWING?

I learnt Java using the Core Java series by Horstmann and Cornell. I found it easy to understand and quite helpful.

You can also surf around the Bunkhouse Porch http://www.coderanch.com/forums/f-75/books and the Book Reviews forum http://www.coderanch.com/forums/f-49/Book-Reviews Other people might have different suggestions
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!