博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Deployed component GUIs and figures have different look and feel than MATLAB desktop
阅读量:6271 次
发布时间:2019-06-22

本文共 3333 字,大约阅读时间需要 11 分钟。

原文: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

转载于:https://www.cnblogs.com/cumtb3S/p/5344156.html

你可能感兴趣的文章
接口与抽象类的使用选择
查看>>
if __name__ == '__main__'
查看>>
CF 375D. Tree and Queries【莫队 | dsu on tree】
查看>>
Maven最佳实践 划分模块 配置多模块项目 pom modules
查看>>
Hadoop学习笔记——WordCount
查看>>
Unity应用架构设计(4)——设计可复用的SubView和SubViewModel(Part 1)
查看>>
Java-Spring-获取Request,Response对象
查看>>
opencv项目报错_pFirstBlock==pHead解决办法
查看>>
MySQL日志
查看>>
Oracle性能优化之Oracle里的执行计划
查看>>
电脑如何连接远程服务器?听语音
查看>>
使用Xcode 查看objective-C的汇编代码
查看>>
Vue.js——60分钟快速入门
查看>>
设计模式 - 模板方法模式(template method pattern) 具体解释
查看>>
mysql判断一个字符串是否包含某子串 【转】
查看>>
a bad dream
查看>>
FD_CLOEXEC用法及原因_转
查看>>
element UI 的学习一,路由跳转
查看>>
RabbitMQ三种Exchange模式(fanout,direct,topic)的性能比较
查看>>
Spring JavaBean属性值的注入方式( 属性注入, 特殊字符注入 <![CDATA[ 带有特殊字符的值 ]]> , 构造器注入 )...
查看>>