MorenaCapabilities library example
MorenaCapabilities library allows these new features:
- Pops up pure Java user interface windows to allow users to set the required scanning capabilities (options in Sane).
- It remembers the last used interface (Twain/Sane), last used hardware, last used capabilities and their values.
Morena Capabilities Example contains three buttons
- Select source = selects new source: Twain (MS Windows, MAC OS X) or Sane (Linux, MAC OS X)
- Custom dialog window = pops up a dialog window.
The window will display the last used capabilities with the last used values. It contains "Select capabilities" button through which users can select
their preferable capabilities. All capabilities supported by the source will be offered.
By default, the library will restart the source after the image preview; because of frequent source's bugs. Users can switch this feature off by
selecting "Preferences" button. The restart can take longer in case of some sources. Users can set up the preferred waiting time before the source
starts up again.
- Repeat scan = acquires the image from the last used source setting the last used capabilities.
This is the often required "One button scanning" solution.
International support
MorenaCapabilities library is designed to pop up it's User Interface with the preferable language. To introduce your language, follow this scenario:
- Duplicate messages.properties file located in the resources directory of the morena.jar file.
- Rename the new duplicated file according to your locale's language and country. For more information see documentation to the
ResourceBundle.getBundle method. E.g in our country - Slovakia - the name of the file have to be messages_sk_SK.properties. The language and country
codes are available e.g. here.
- Translate messages to your language. Use Latin-1 or Unicode-encoded characters only. You can use Java's native2ascii utility to convert your
native-encoded characters to the required encoding. See our messages_sk_SK.properties to check, how can such a file look like.
- You need to include the new properties file to the classpath of your project. You have more possibilities, how to do it.
- You can add it to resources directory of the morena.jar file. If you plan to use morena.jar in the applet, you will also need to sign the
jar file again.
- You can create your own resources directory. (It is necessary to use resources directory, because Morena looks for messages in the
resources directory of it's classpath.) Move your property file to this directory. Add the directory to the classpath of your project.
- Set up your required locale's language and country as a -D system properties of the VM arguments, when you run your project. E.g. to use
locales in Slovakia, use -Duser.language=sk -Duser.country=SK.
Technical notes
- MorenaCapabilities library stores necessary information to the properties files located in the .morena directory of the user's home
directory.
- It is possible to turn on a debug mode by setting -Dmorena.capabilities.debug=true system property.
Please, notice, that this library is in beta version and can be changed. We appreciate your experiences with using this library.