public class AboutTutorialMDI extends AbstractMDIApplication { public AboutTutorialMDI() { super("MDISimpleExample"); ApplicationDesc desc = getApplicationDesc(); desc.setApplicationName("MyApplication"); desc.setVersion("0.1"); desc.setBuildDate("2023/10/05"); } }
public class AboutTutorialMDI extends AbstractMDIApplication { public AboutTutorialMDI() { super("MDISimpleExample"); ApplicationDesc desc = getApplicationDesc(); desc.setApplicationName(null); desc.setAlternateText("My customized description"); } }
public class MyConfiguration implements Configuration { private static MyConfiguration conf = null; public String version = null; public String date = null; public static MyConfiguration getInstance() { if (conf == null) { conf = new MyConfiguration(); } return conf; } _ public MyConfiguration() { InputStream stream = this.getClass().getResourceAsStream("properties.properties"); PropertyResourceBundle bundle = new PropertyResourceBundle(stream); version = bundle.getString("version"); date = bundle.getString("date"); stream.close(); } _ public void setupApplicationDesc(ApplicationDesc appDesc) { appDesc.setVersion(version); appDesc.setBuildDate(date); } }
ApplicationDesc
from the content of the URL properties fileApplicationDesc
from the content of the properties file of the specified name which is in the same package as the configuration classpublic class MyApplication extends AbstractMDIApplication { private Preferences pref = null; public MyApplication() { super("My Application"); conf = AppliConfiguration.getInstance(); conf.setupApplicationDesc(getApplicationDesc()); ... }For the configuration:
public class AppliConfiguration implements Configuration { private static AppliConfiguration conf = null; private AppliConfiguration() { } public static AppliConfiguration getInstance() { if (conf == null) { conf = new AppliConfiguration(); } return conf; } @Override public void setupApplicationDesc(ApplicationDesc appDesc) { MDIConfigUtils.setupApplicationDesc(this, "app.properties", appDesc); } ... }and for the properties file:
version=0.1 date=08/10/2023 name=My Application desc=This is an Application with a Description
Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences