Remove titlebar from MATLAB GUI for full screen display

前端 未结 1 1524
既然无缘
既然无缘 2020-12-06 23:11

I have created a MATLAB GUI, which I would like to display so that it fills the whole screen. Currently, the titlebar is showing at the very top. Is there a way to hide this

相关标签:
1条回答
  • 2020-12-06 23:22

    I don't know if this will work for OSX, but on Windows I was able to use the Java code from this MATLAB newsgroup thread to create a full screen window with no title, edges, etc. and display an image in the middle. Here's how I made the window:

    img = imread('peppers.png');  %# A sample image to display
    jimg = im2java(img);
    frame = javax.swing.JFrame;
    frame.setUndecorated(true);
    icon = javax.swing.ImageIcon(jimg);
    label = javax.swing.JLabel(icon);
    frame.getContentPane.add(label);
    frame.pack;
    screenSize = get(0,'ScreenSize');  %# Get the screen size from the root object
    frame.setSize(screenSize(3),screenSize(4));
    frame.setLocation(0,0);
    frame.show;
    

    And you can hide the frame again by doing this:

    frame.hide;
    

    Not sure how this would work in general for displaying a typical MATLAB GUI. I'll have to play around with it more and find out.

    0 讨论(0)
提交回复
热议问题