java -Dfri.gui.awt.resourcemanager.showRestricted=true ...or programmatically
System.setProperty("fri.gui.awt.resourcemanager.showRestricted", "true");
fri.gui.awt.resourcemanager.showRestricted |
When true, the user will not be able to change
texts, tooltips, languages or menu shortcuts / accelerators / mnemonics.
Nevertheless he/she will be able to choose a language, using one of the
dialogs or a built-in language menu. |
fri.gui.awt.resourcemanager.customizeKey |
The key that brings up the customize dialog for
the focused component. It is written e.g. as "Ctrl+Alt+Shift-F7", the order
of modifiers (Ctrl+Alt+Shift) is not significant, but the key code must be
the last and separated by "-". |
fri.gui.awt.resourcemanager.chooseKey |
The key that brings up the component choice dialog.
Notation is the same as for customizeKey. |
import fri.gui.swing.resourcemanager.JResourceManagingEventQueue;As you can guess the AWT installation works like this:
public class MyFrame extends JFrame
{
{ // instance initializer
JResourceManagingEventQueue.install();
// ignores all calls except the first
}
public MyFrame() {
...
}
import fri.gui.awt.resourcemanager.ResourceManagingEventQueue;(Actually the installation can be done anywhere, but i had problems when doing it in the application main, or within a static initializer.)
public class MyFrame extends Frame
{
{
ResourceManagingEventQueue.install();
}
public MyFrame() {
...
}
JResourceManagingEventQueue.addComponents(this, new Object [] { popup });
// "this" is MyFrame instance
import fri.gui.swing.resourcemanager.ResourceManager;
public class MyFrame extends JFrame
{
...
getContentPane().add(p1, BorderLayout.NORTH);
getContentPane().add(p2, BorderLayout.CENTER);
getContentPane().add(p3, BorderLayout.SOUTH);
new JResourceManager(this);
...
new JResourceManager(this, new Object { popup1, popup2 });
public class HelpTextArea extends JTextArea implements ResourceProvidingTextComponent
{
...
}
public class MyComboBox extends JComboBox implements ResourceIgnoringContainer
{
...
}
import fri.gui.swing.resourcemanager.JLanguageMenu;All language menu items can be customized themselves without influencing their functionality (which means you can customize "English" to "Englisch").
...
menubar.add(new JLanguageMenu());
...
import fri.gui.swing.resourcemanager.JResourceDialogActionListener;
public class MyFrame extends JFrame
{
{
JResourceManagingEventQueue.install();
}
public MyFrame() {
...
ActionListener callback = new JResourceDialogActionListener(this);
JButton b = new JButton("Customize");
b.addActionListener(callback);
toolbar.add(b);
JMenuItem mi = new JMenuItem("Customize");
mi.addActionListener(callback);
menu.add(mi);
...
import fri.gui.awt.resourcemanager.ResourceDialogActionListener;
...
ResourceManager rmgr = new ResourceManager(this); // loops component tree
...
ActionListener callback = new ResourceDialogActionListener(rmgr);
b.addActionListener(callback);
...
rootpane.layeredpane.contentpane.panelAfter a program modification this could look like the following (a new panel was added):
rootpane.layeredpane.contentpane.panel.button_New_Frame
rootpane.layeredpane.contentpane.panel.button_New_Dialog
rootpane.layeredpane.contentpane.panel.panelThe resource names have changed. Persistent resources cannot be assigned anymore to those new hierarchical names.
rootpane.layeredpane.contentpane.panel.panel.button_New_Frame
rootpane.layeredpane.contentpane.panel.panel.button_New_Dialog
import fri.gui.awt.geometrymanager.GeometryManager;The GeometryManager is a small separate package and is not associated with the resource managing event queue in any way.
public class MyFrame extends JFrame
{
...
getContentPane().add(p1, BorderLayout.NORTH);
getContentPane().add(p2, BorderLayout.CENTER);
getContentPane().add(p3, BorderLayout.SOUTH);
new GeometryManager(this).show(); // must store before exit happens
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});