@@ -32,14 +32,15 @@ public class JavaImageViewer {
32
32
private BufferedImage ResizeImage (File image , int orientation ) {
33
33
34
34
int scrwidth = MyVariables .getScreenWidth ();
35
- int scrheight = MyVariables .getScreenHeight ();
35
+ int scrheight = MyVariables .getScreenHeight ()-50 ;
36
+ Rectangle screenBounds = Utils .getScreenBounds ();
36
37
try {
37
38
BufferedImage img = ImageIO .read (new File (image .getPath ().replace ("\\ " , "/" )));
38
39
if (orientation > 1 ) {
39
40
resizedImg = ImageFunctions .rotate (img , orientation );
40
- resizedImg = ImageFunctions .scaleImageToContainer (resizedImg , scrwidth , scrheight );
41
+ resizedImg = ImageFunctions .scaleImageToContainer (resizedImg , screenBounds . width , screenBounds . height );
41
42
} else { // No rotation necessary
42
- resizedImg = ImageFunctions .scaleImageToContainer (img , scrwidth , scrheight );
43
+ resizedImg = ImageFunctions .scaleImageToContainer (img , screenBounds . width , screenBounds . height );
43
44
}
44
45
} catch (IOException iex ) {
45
46
logger .error ("error in resizing the image {}" , iex );
@@ -283,21 +284,19 @@ public void actionPerformed(ActionEvent actionEvent) {
283
284
284
285
285
286
287
+ Rectangle screenBounds = Utils .getScreenBounds ();
286
288
287
289
thePanel .add (InfoPanel , BorderLayout .PAGE_START );
288
290
ImageIcon icon = new ImageIcon (resizedImg );
289
291
ImgLabel .setIcon (icon );
290
292
thePanel .add (ImgLabel , BorderLayout .CENTER );
291
293
thePanel .add (buttonPanel , BorderLayout .PAGE_END );
292
294
//thePanel.setPreferredSize(new Dimension(panelWidth, panelHeight));
293
- thePanel .setPreferredSize (new Dimension (MyVariables . getScreenWidth (), MyVariables . getScreenHeight () - 30 ));
295
+ thePanel .setPreferredSize (new Dimension (screenBounds . width , screenBounds . height - 30 ));
294
296
frame .add (thePanel );
295
297
296
- //if (!frameborder) {
297
- frame .setExtendedState (JFrame .MAXIMIZED_BOTH );
298
- //frame.setUndecorated(true) will create a borderless window. Only use in slideshow where we have buttons anyway.
299
- frame .setUndecorated (true );
300
- //}
298
+
299
+ frame .setLocation (0 ,0 );
301
300
frame .pack ();
302
301
frame .setVisible (true );
303
302
0 commit comments