2

I am using the Synthetica Black Eye LAF (http://www.jyloo.com/synthetica/) with an application using Java 1.7. It seems that when I have the Synthetica LAF enabled, if I drag the screen onto a second monitor that is larger, and I maximize the window by either double clicking or clicking on the maximize icon, the window takes up the same amount of space as the "Full screen" size on the primary monitor. When I do not have the LAF enabled it does not do this. it is as though it does not realize the dimensions of which screen it is on. Is there any workaround for this?

I have effectively done this: Java Toolkit Getting Second screen size and java & fullscreen over multiple monitors which is nice since now I can set the preferred size to that of the larger monitor, but that doesn't help me with my maximizing problem.

Here is my code:

package mil.innovation.bewear.maintenance.windows;

import de.javasoft.plaf.synthetica.SyntheticaBlackEyeLookAndFeel;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class Windows {

public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel(new SyntheticaBlackEyeLookAndFeel());
    } catch (Exception e) {
         System.out.println("Look and feel not started");
    }

    Dimension dimension;

    GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
    GraphicsDevice biggest;
    if (devices.length > 1) {
        biggest = devices[0];
        for (GraphicsDevice device : devices) {
            if (device.getDefaultConfiguration().getBounds().getSize().getWidth() > biggest.getDefaultConfiguration().getBounds().getSize().getWidth())
                biggest = device;
        }
        dimension = biggest.getDefaultConfiguration().getBounds().getSize();
    } else if (devices.length == 1)
        dimension = devices[0].getDefaultConfiguration().getBounds().getSize();
    else {
        throw new RuntimeException("No Screens detected");
    }

    String filePath = "C:\\Users\\Bewear2\\IdeaProjects\\bewear_windows\\imgNotFound.png";
    JFrame frame = new JFrame("Example");
    JLabel lblPicture = new JLabel();
    lblPicture.setPreferredSize(dimension);
    lblPicture.setSize(dimension);
    BufferedImage image;
    try {
        image = ImageIO.read(new File("imgNotFound.png"));
        lblPicture.setIcon(new ImageIcon(image));
    }catch (IOException ex) {
        System.out.println("Error loading the picture that is supposed to load when loading a picture fails" + ex);
    }
    try {
        image = ImageIO.read(new File(filePath));
        Image bufferedImg = image.getScaledInstance(lblPicture.getWidth(), lblPicture.getHeight(), Image.SCALE_SMOOTH);
        lblPicture.setIcon(new ImageIcon(bufferedImg));
    } catch (IOException ex) {
        System.out.println("Error loading picture " + ex);
    }
    frame.setContentPane(lblPicture);
    frame.pack();
    frame.setVisible(true);
}

}

Community
  • 1
  • 1
CallSign-Filter
  • 1,283
  • 1
  • 9
  • 12
  • Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This is not a code dump, but an example of what you are doing which highlights the problem you are having. This will result in less confusion and better responses – MadProgrammer Jul 13 '15 at 01:13
  • Added, thank you for the suggestion http://stackoverflow.com/users/992484/madprogrammer – CallSign-Filter Jul 13 '15 at 01:29
  • Since the `SyntheticaBlackEyeLookAndFeel` library requires registration and login, I'm not really enthusiastic to try using it. It did you a stripped down version of your code using `SynthLookAndFeel` and had no issues, but I would advise against the use of `setPreferredSize` – MadProgrammer Jul 13 '15 at 01:35
  • Yes it worked for me just fine when I used the System LookAndFeel as well. Thanks for the advice though on the preferred size. I might have to email Synthetica customer support if nobody here can help. (Their LAF is gorgeous) – CallSign-Filter Jul 13 '15 at 01:40

1 Answers1

1

Email from customer support:

this is mainly a known Java Swing issue in multiscreen environments which occurs only when different screen resolutions will be used - see http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6829250. It's targeted to be fixed in V9. However, there was also another issue (#7010721 http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7010721 ) which affects the window size so please make sure that a recent JVM will be used. If the issue still occurs a possible workaround is to enable the native frame decoration (see FAQ Window Decoration #1 http://www.jyloo.com/synthetica/faq/#windowDecoration-1 ) another workaround is to set the system property "synthetica.frame.fullscreen" to true, but this will cover the taskbar of the OS.

CallSign-Filter
  • 1,283
  • 1
  • 9
  • 12