• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

DeployedcomponentGUIsandfigureshavedifferentlookandfeelthanMATLABdesktop

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

原文:http://www.mathworks.com/support/bugreports/1293244

Description

Deployed GUIs and figures look and feel different compared to undeployed MATLAB desktop versions.

Deployed applications are using the cross platform look and feel by default, while the undeployed figures and GUIs use the platform specific look and feel.

 Workaround

 To work around this issue, manually set the look and feel to the default platform specific version. If you're using workaround 2 or 3, depending on the platform you're deploying to, use one of the look and feel codes below and apply it with the workaround. This is not necessary if you're using workaround 1.

For Windows

com.sun.java.swing.plaf.windows.WindowsLookAndFeel

For Linux

com.jgoodies.looks.plastic.Plastic3DLookAndFeel

For Mac

com.apple.laf.AquaLookAndFeel

Workaround 1: Applied before deploying, on the MATLAB installation

This workaround is applied to the MATLAB installation on the development machine before packaging. Any subsequent deployment projects will pick up the change.

Download the startup.zip file attached below and unzip it to get the startup.m file. Place it in a directory that's on the MATLAB path, such as:

C:\Program Files\MATLAB\R2015b\toolbox\local

or

C:\Users\username\Documents\MATLAB

See the documentation on startup for more information.

If you already have a startup.m file, copy the contents of the below file and add it to the beginning of your startup.m file instead.

Workaround 2: Applied before deploying, on the MATLAB code to be deployed

This workaround is applied to the MATLAB code that is being deployed, before packaging. It only affects that particular deployment project.

To set the look and feel, add the following line with the appropriate look and feel name to your MATLAB file once prior to creating graphics or figures.

javax.swing.UIManager.setLookAndFeel('look_and_feel_code')

where look_and_feel_code is the platform specific look and feel code listed at the top.

If you're deploying platform-independent Java packages, Python modules or Production Server archives, use the ispcisunix, or ismac MATLAB code to determine the platform and apply the correct look and feel.

The above Java code can fail if Java Swing is not loaded. Call usejava('swing') to check whether it is enabled or not.

Workaround 3: Applied after deploying

This workaround is for the target machine where the MATLAB runtime is installed and it can be applied after deployment. It requires no MATLAB code change and affects all deployed components that utilize the runtime.

Create a text file called java.opts (no .txt extension) with the following contents on one line:

-Dswing.defaultlaf=look_and_feel_code

where look_and_feel_code is the platform specific look and feel code listed at the top.

Place the java.opts file in the following directory of the MATLAB runtime installation:

mcrroot\bin\arch

where mcrroot is the MATLAB runtime installation location, and the arch is the runtime architecture. For example,

C:\Program Files\MATLAB\MATLAB runtime\v90\bin\win64

Alternatively, the java.opts file can also be placed in the startup directory of the deployed component if that directory is known.

Attachments

http://www.mathworks.com/support/bugreports/license/accept_license/6705?fname=startup.zip&geck_id=1293244


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
matlab中xlsread函数的bug发布时间:2022-07-18
下一篇:
MATLAB 代码自动生成(二)program will not fit into available memory.run placement ...发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap