Hi everybody,
I'm working from within matlab and want to display images fullscreen
(no-titlebar, scrollbars ect) on my secondary monitor.
I found this piece of matlab code written by Pithawat Vachiramon:
function fullscreen(image,device_number)
ge = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
gds = ge.getScreenDevices();
height = gds(device_number).getDisplayMode().getHeight();
width = gds(device_number).getDisplayMode().getWidth();
if ~isa(image,'uint8')
error('Image matrix must be of UINT8 type');
elseif ~isequal(size(image,3),3)
error('Image must be NxMx3 RGB');
elseif ~isequal(size(image,1),height)
error(['Image must have verticle resolution of ' num2str(height)]);
elseif ~isequal(size(image,2),width)
error(['Image must have horizontal resolution of ' num2str(width)]);
end
global frame_java;
global icon_java;
global device_number_java;
if ~isequal(device_number_java, device_number)
try frame_java.dispose(); end
frame_java = [];
device_number_java = device_number;
end
if ~isequal(class(frame_java), 'javax.swing.JFrame')
frame_java =
javax.swing.JFrame(gds(device_number).getDefaultConfiguration());
frame_java.setUndecorated(true);
icon_java = javax.swing.ImageIcon(im2java(image));
label = javax.swing.JLabel(icon_java);
frame_java.getContentPane.add(label);
gds(device_number).setFullScreenWindow(frame_java);
else
icon_java.setImage(im2java(image));
end
frame_java.pack
frame_java.repaint
frame_java.show
This clearly uses Java's 2D API. However it doesnt work. I can get it to
display an image on my primary monitor but not on the secondary monitor.
gds = ge.getScreenDevices(); should give me an array of attached
devices and it seems to do that as with two monitors i get an array of two.
However once I parse these through to the height and width check I get
resolution of my primary device returned for both values of gds.
If I use gds=ge.getDefaultScreenDevice(); the size of the array is 1 as
it should be and also the video resolution then corresponds with which
monitor i have set as default in windows. Any ideas on how to overcome
this problem and make sure that my loaded image is displayed on the
secondary monitor ?
Cheers,
Peter Zoon
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".