GuiTranslationExample.java
/*
* @author Hermann Wöhrmann
*
* Description:
*
* Version Date Comments
* 1.01.01 07.11.2004 created
*
*/
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import javax.swing.*;
import javax.swing.border.*;
//import speed.jg.*;
class GuiTranslationExampleGUI extends GUIObject
{
protected GuiTranslationExampleGUI()
{ JFrame guiTranslationExample = new JFrame();
guiTranslationExample.setBounds(64, 48, 640, 480);
guiTranslationExample.getContentPane().setLayout(new BorderLayout());
guiTranslationExample.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
guiTranslationExample.setTitle("Multilingual Application");
{ JMenuBar mbExamples = new JMenuBar();
mbExamples.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.WHITE, Color.BLUE));
{ JMenu mnFile = new JMenu();
mnFile.setText("File");
mnFile.setMnemonic('f');
{ JMenuItem fmNew = new JMenuItem();
fmNew.setText("New");
fmNew.setMnemonic('n');
fmNew.setAccelerator(KeyStroke.getKeyStroke('N', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
fmNew.setName("fmNew");
super.add(fmNew);
mnFile.add(fmNew);
}
{ JMenuItem fmOpen = new JMenuItem();
fmOpen.setText("Open ...");
fmOpen.setMnemonic('o');
fmOpen.setAccelerator(KeyStroke.getKeyStroke('O', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
fmOpen.setName("fmOpen");
super.add(fmOpen);
mnFile.add(fmOpen);
}
{ JMenuItem fmClose = new JMenuItem();
fmClose.setText("Close");
fmClose.setMnemonic('c');
fmClose.setAccelerator(KeyStroke.getKeyStroke('W', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
fmClose.setName("fmClose");
super.add(fmClose);
mnFile.add(fmClose);
}
{ JSeparator fmSep1 = new JSeparator();
fmSep1.setName("fmSep1");
super.add(fmSep1);
mnFile.add(fmSep1);
}
{ JMenuItem fmSave = new JMenuItem();
fmSave.setText("Save");
fmSave.setMnemonic('s');
fmSave.setAccelerator(KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
fmSave.setName("fmSave");
super.add(fmSave);
mnFile.add(fmSave);
}
{ JMenuItem fmSaveAs = new JMenuItem();
fmSaveAs.setText("Save As ...");
fmSaveAs.setMnemonic('a');
fmSaveAs.setName("fmSaveAs");
super.add(fmSaveAs);
mnFile.add(fmSaveAs);
}
{ JSeparator fmSep2 = new JSeparator();
fmSep2.setName("fmSep2");
super.add(fmSep2);
mnFile.add(fmSep2);
}
{ JMenuItem fmPageSetup = new JMenuItem();
fmPageSetup.setText("Page Setup");
fmPageSetup.setMnemonic('u');
fmPageSetup.setName("fmPageSetup");
super.add(fmPageSetup);
mnFile.add(fmPageSetup);
}
{ JMenuItem fmPrint = new JMenuItem();
fmPrint.setText("Print ...");
fmPrint.setMnemonic('p');
fmPrint.setAccelerator(KeyStroke.getKeyStroke('P', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
fmPrint.setName("fmPrint");
super.add(fmPrint);
mnFile.add(fmPrint);
}
{ JSeparator fmSep3 = new JSeparator();
fmSep3.setName("fmSep3");
super.add(fmSep3);
mnFile.add(fmSep3);
}
{ JMenuItem fmPreferences = new JMenuItem();
fmPreferences.setText("Preferences");
fmPreferences.setMnemonic('r');
fmPreferences.setName("fmPreferences");
super.add(fmPreferences);
mnFile.add(fmPreferences);
}
{ JSeparator fmSep4 = new JSeparator();
fmSep4.setName("fmSep4");
super.add(fmSep4);
mnFile.add(fmSep4);
}
{ JMenuItem fmExit = new JMenuItem();
fmExit.setText("Exit");
fmExit.setMnemonic('x');
fmExit.setName("fmExit");
super.add(fmExit);
mnFile.add(fmExit);
}
mnFile.setName("mnFile");
super.add(mnFile);
mbExamples.add(mnFile);
}
{ JMenu mnEdit = new JMenu();
mnEdit.setText("Edit");
mnEdit.setMnemonic('e');
{ JMenuItem emUndo = new JMenuItem();
emUndo.setText("Undo");
emUndo.setMnemonic('u');
emUndo.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Undo16.gif")));
emUndo.setAccelerator(KeyStroke.getKeyStroke('Z', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emUndo.setName("emUndo");
super.add(emUndo);
mnEdit.add(emUndo);
}
{ JMenuItem emRedo = new JMenuItem();
emRedo.setText("Redo");
emRedo.setMnemonic('r');
emRedo.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Redo16.gif")));
emRedo.setAccelerator(KeyStroke.getKeyStroke('Y', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emRedo.setName("emRedo");
super.add(emRedo);
mnEdit.add(emRedo);
}
{ JSeparator emSep1 = new JSeparator();
emSep1.setName("emSep1");
super.add(emSep1);
mnEdit.add(emSep1);
}
{ JMenuItem emCut = new JMenuItem();
emCut.setText("Cut");
emCut.setMnemonic('t');
emCut.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Cut16.gif")));
emCut.setAccelerator(KeyStroke.getKeyStroke('X', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emCut.setName("emCut");
super.add(emCut);
mnEdit.add(emCut);
}
{ JMenuItem emCopy = new JMenuItem();
emCopy.setText("Copy");
emCopy.setMnemonic('c');
emCopy.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Copy16.gif")));
emCopy.setAccelerator(KeyStroke.getKeyStroke('C', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emCopy.setName("emCopy");
super.add(emCopy);
mnEdit.add(emCopy);
}
{ JMenuItem emPaste = new JMenuItem();
emPaste.setText("Paste");
emPaste.setMnemonic('p');
emPaste.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Paste16.gif")));
emPaste.setAccelerator(KeyStroke.getKeyStroke('V', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emPaste.setName("emPaste");
super.add(emPaste);
mnEdit.add(emPaste);
}
{ JSeparator emSep2 = new JSeparator();
emSep2.setName("emSep2");
super.add(emSep2);
mnEdit.add(emSep2);
}
{ JMenuItem emFind = new JMenuItem();
emFind.setText("Find");
emFind.setMnemonic('f');
emFind.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Find16.gif")));
emFind.setAccelerator(KeyStroke.getKeyStroke('F', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emFind.setName("emFind");
super.add(emFind);
mnEdit.add(emFind);
}
{ JMenuItem emFindAgain = new JMenuItem();
emFindAgain.setText("Find Again");
emFindAgain.setMnemonic('d');
emFindAgain.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Find16.gif")));
emFindAgain.setAccelerator(KeyStroke.getKeyStroke('G', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emFindAgain.setName("emFindAgain");
super.add(emFindAgain);
mnEdit.add(emFindAgain);
}
{ JSeparator emSep3 = new JSeparator();
emSep3.setName("emSep3");
super.add(emSep3);
mnEdit.add(emSep3);
}
{ JMenuItem emSelectAll = new JMenuItem();
emSelectAll.setText(" Select All");
emSelectAll.setMnemonic('a');
emSelectAll.setAccelerator(KeyStroke.getKeyStroke('A', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
emSelectAll.setName("emSelectAll");
super.add(emSelectAll);
mnEdit.add(emSelectAll);
}
mnEdit.setName("mnEdit");
super.add(mnEdit);
mbExamples.add(mnEdit);
}
{ JMenu mnTranslate = new JMenu();
mnTranslate.setText("Translate");
mnTranslate.setMnemonic('t');
{ JRadioButtonMenuItem tmEnglish = new JRadioButtonMenuItem();
tmEnglish.setText("English");
tmEnglish.setSelected(true);
super.getButtonGroup("cmTranslate").add(tmEnglish);
tmEnglish.setMnemonic('e');
tmEnglish.setName("tmEnglish");
super.add(tmEnglish);
mnTranslate.add(tmEnglish);
}
{ JRadioButtonMenuItem tmGerman = new JRadioButtonMenuItem();
tmGerman.setText("German");
super.getButtonGroup("cmTranslate").add(tmGerman);
tmGerman.setMnemonic('g');
tmGerman.setName("tmGerman");
super.add(tmGerman);
mnTranslate.add(tmGerman);
}
mnTranslate.setName("mnTranslate");
super.add(mnTranslate);
mbExamples.add(mnTranslate);
}
{ Component mnFiller = Box.createHorizontalGlue();
mnFiller.setName("mnFiller");
super.add(mnFiller);
mbExamples.add(mnFiller);
}
{ JMenu mnHelp = new JMenu();
mnHelp.setText("Help");
mnHelp.setMnemonic('h');
{ JMenuItem hmContents = new JMenuItem();
hmContents.setText("Contents");
hmContents.setMnemonic('c');
hmContents.setName("hmContents");
super.add(hmContents);
mnHelp.add(hmContents);
}
{ JMenuItem hmTutorial = new JMenuItem();
hmTutorial.setText("Tutorial");
hmTutorial.setMnemonic('t');
hmTutorial.setName("hmTutorial");
super.add(hmTutorial);
mnHelp.add(hmTutorial);
}
{ JMenuItem hmIndex = new JMenuItem();
hmIndex.setText("Index");
hmIndex.setMnemonic('i');
hmIndex.setName("hmIndex");
super.add(hmIndex);
mnHelp.add(hmIndex);
}
{ JMenuItem hmSearch = new JMenuItem();
hmSearch.setText("Search");
hmSearch.setMnemonic('s');
hmSearch.setName("hmSearch");
super.add(hmSearch);
mnHelp.add(hmSearch);
}
{ JSeparator hmSep1 = new JSeparator();
hmSep1.setName("hmSep1");
super.add(hmSep1);
mnHelp.add(hmSep1);
}
{ JMenuItem hmAbout = new JMenuItem();
hmAbout.setText("About Application");
hmAbout.setMnemonic('a');
hmAbout.setName("hmAbout");
super.add(hmAbout);
mnHelp.add(hmAbout);
}
mnHelp.setName("mnHelp");
super.add(mnHelp);
mbExamples.add(mnHelp);
}
mbExamples.setName("mbExamples");
super.add(mbExamples);
guiTranslationExample.setJMenuBar(mbExamples);
}
{ JToolBar MenuToolBar = new JToolBar();
MenuToolBar.setFloatable(true);
MenuToolBar.setOrientation(JToolBar.HORIZONTAL);
{ JButton tbNew = new JButton();
tbNew.setToolTipText("New");
tbNew.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/New24.gif")));
tbNew.setName("tbNew");
super.add(tbNew);
MenuToolBar.add(tbNew);
}
{ JToolBar.Separator tbSep1 = new JToolBar.Separator();
tbSep1.setName("tbSep1");
super.add(tbSep1);
MenuToolBar.add(tbSep1);
}
{ JButton tbOpen = new JButton();
tbOpen.setToolTipText("Open");
tbOpen.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Open24.gif")));
tbOpen.setName("tbOpen");
super.add(tbOpen);
MenuToolBar.add(tbOpen);
}
{ JButton tbSave = new JButton();
tbSave.setToolTipText("Save");
tbSave.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Save24.gif")));
tbSave.setName("tbSave");
super.add(tbSave);
MenuToolBar.add(tbSave);
}
{ JButton tbClose = new JButton();
tbClose.setToolTipText("Close");
tbClose.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Export24.gif")));
tbClose.setName("tbClose");
super.add(tbClose);
MenuToolBar.add(tbClose);
}
{ JToolBar.Separator tbSep2 = new JToolBar.Separator();
tbSep2.setName("tbSep2");
super.add(tbSep2);
MenuToolBar.add(tbSep2);
}
{ JButton tbCut = new JButton();
tbCut.setToolTipText("Cut");
tbCut.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Cut24.gif")));
tbCut.setName("tbCut");
super.add(tbCut);
MenuToolBar.add(tbCut);
}
{ JButton tbCopy = new JButton();
tbCopy.setToolTipText("Copy");
tbCopy.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Copy24.gif")));
tbCopy.setName("tbCopy");
super.add(tbCopy);
MenuToolBar.add(tbCopy);
}
{ JButton tbPaste = new JButton();
tbPaste.setToolTipText("Paste");
tbPaste.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Paste24.gif")));
tbPaste.setName("tbPaste");
super.add(tbPaste);
MenuToolBar.add(tbPaste);
}
{ JToolBar.Separator tbSep3 = new JToolBar.Separator();
tbSep3.setName("tbSep3");
super.add(tbSep3);
MenuToolBar.add(tbSep3);
}
{ JButton tbUndo = new JButton();
tbUndo.setToolTipText("Undo");
tbUndo.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Undo24.gif")));
tbUndo.setName("tbUndo");
super.add(tbUndo);
MenuToolBar.add(tbUndo);
}
{ JButton tbRedo = new JButton();
tbRedo.setToolTipText("Redo");
tbRedo.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Redo24.gif")));
tbRedo.setName("tbRedo");
super.add(tbRedo);
MenuToolBar.add(tbRedo);
}
MenuToolBar.setName("MenuToolBar");
super.add(MenuToolBar);
guiTranslationExample.getContentPane().add(MenuToolBar, BorderLayout.NORTH);
}
{ JSplitPane spEdit = new JSplitPane();
spEdit.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
spEdit.setOneTouchExpandable(true);
spEdit.setOrientation(JSplitPane.VERTICAL_SPLIT);
{ JPanel pnEdit = new JPanel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), null, "5", null, null, null, null);
}
};
pnEdit.setLayout(new BorderLayout());
{ JPanel pnFieldEdit = new JPanel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "1", null, null, null, null, null);
}
};
pnFieldEdit.setBackground(new Color(248, 248, 255));
pnFieldEdit.setLayout(new BoxLayout(pnFieldEdit, BoxLayout.Y_AXIS));
{ JPanel pnCustomerID = new JPanel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "1", null, null, null, null, null);
}
};
pnCustomerID.setBackground(new Color(240, 240, 255));
pnCustomerID.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
pnCustomerID.setMinimumSize(new Dimension(640, 24));
pnCustomerID.setMaximumSize(new Dimension(9999, 24));
pnCustomerID.setPreferredSize(new Dimension(0, 24));
pnCustomerID.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.WHITE, Color.GRAY));
{ JLabel lbCustomerID = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", null, null, null, null, null);
}
};
lbCustomerID.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbCustomerID.setText("Customer ID");
lbCustomerID.setName("lbCustomerID");
super.add(lbCustomerID);
pnCustomerID.add(lbCustomerID);
}
{ JTextField tfCustomerID = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", null, null, null, null, null);
}
};
tfCustomerID.setName("tfCustomerID");
super.add(tfCustomerID);
pnCustomerID.add(tfCustomerID);
}
{ JLabel lbCustomerIDF1 = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "3", null, null, null, null, null);
}
};
lbCustomerIDF1.setName("lbCustomerIDF1");
super.add(lbCustomerIDF1);
pnCustomerID.add(lbCustomerIDF1);
}
{ JLabel lbState = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", null, null, null, null, null);
}
};
lbState.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbState.setText("State");
lbState.setName("lbState");
super.add(lbState);
pnCustomerID.add(lbState);
}
{ JComboBox cbState = new JComboBox()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "1", null, null, null, "-1");
}
};
cbState.addItem("France");
cbState.addItem("Germany");
cbState.addItem("USA");
cbState.addItem("...");
cbState.setSelectedIndex(2);
cbState.setName("cbState");
super.add(cbState);
pnCustomerID.add(cbState);
}
pnCustomerID.setName("pnCustomerID");
super.add(pnCustomerID);
pnFieldEdit.add(pnCustomerID);
}
{ JPanel pnCustomerData = new JPanel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "1", null, null, null, null, null);
}
};
pnCustomerData.setBackground(new Color(255, 255, 240));
pnCustomerData.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
pnCustomerData.setMinimumSize(new Dimension(640, 84));
pnCustomerData.setMaximumSize(new Dimension(9999, 84));
pnCustomerData.setPreferredSize(new Dimension(0, 84));
pnCustomerData.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.WHITE, Color.GRAY));
{ JLabel lbName = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
lbName.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbName.setText("Name");
lbName.setVerticalAlignment(SwingConstants.TOP);
lbName.setName("lbName");
super.add(lbName);
pnCustomerData.add(lbName);
}
{ JTextField tfName = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", "5", null, null, null);
}
};
tfName.setName("tfName");
super.add(tfName);
pnCustomerData.add(tfName);
}
{ JLabel lbStreet = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
lbStreet.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbStreet.setText("Street");
lbStreet.setVerticalAlignment(SwingConstants.TOP);
lbStreet.setName("lbStreet");
super.add(lbStreet);
pnCustomerData.add(lbStreet);
}
{ JTextField tfStreet = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", "5", null, null, null);
}
};
tfStreet.setName("tfStreet");
super.add(tfStreet);
pnCustomerData.add(tfStreet);
}
{ JLabel lbZip = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
lbZip.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbZip.setText("Zip");
lbZip.setVerticalAlignment(SwingConstants.TOP);
lbZip.setName("lbZip");
super.add(lbZip);
pnCustomerData.add(lbZip);
}
{ JTextField tfZip = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
tfZip.setName("tfZip");
super.add(tfZip);
pnCustomerData.add(tfZip);
}
{ JLabel lbCity = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
lbCity.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbCity.setText("City");
lbCity.setVerticalAlignment(SwingConstants.TOP);
lbCity.setName("lbCity");
super.add(lbCity);
pnCustomerData.add(lbCity);
}
{ JTextField tfCity = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "2", "4", "1", null, null, null);
}
};
tfCity.setName("tfCity");
super.add(tfCity);
pnCustomerData.add(tfCity);
}
{ JLabel lbPhone = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
lbPhone.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbPhone.setText("Phone");
lbPhone.setVerticalAlignment(SwingConstants.TOP);
lbPhone.setName("lbPhone");
super.add(lbPhone);
pnCustomerData.add(lbPhone);
}
{ JTextField tfPhone = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
tfPhone.setName("tfPhone");
super.add(tfPhone);
pnCustomerData.add(tfPhone);
}
{ JLabel lbMobile = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
lbMobile.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbMobile.setText("Mobile");
lbMobile.setVerticalAlignment(SwingConstants.TOP);
lbMobile.setName("lbMobile");
super.add(lbMobile);
pnCustomerData.add(lbMobile);
}
{ JTextField tfMobile = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
tfMobile.setName("tfMobile");
super.add(tfMobile);
pnCustomerData.add(tfMobile);
}
{ JLabel lbFax = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
lbFax.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbFax.setText("Fax");
lbFax.setVerticalAlignment(SwingConstants.TOP);
lbFax.setName("lbFax");
super.add(lbFax);
pnCustomerData.add(lbFax);
}
{ JTextField tfFax = new JTextField()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "4", null, null, null, null);
}
};
tfFax.setName("tfFax");
super.add(tfFax);
pnCustomerData.add(tfFax);
}
pnCustomerData.setName("pnCustomerData");
super.add(pnCustomerData);
pnFieldEdit.add(pnCustomerData);
}
{ JPanel pnCustomerRemarks = new JPanel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "1", null, null, null, null, null);
}
};
pnCustomerRemarks.setBackground(new Color(240, 240, 240));
pnCustomerRemarks.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
pnCustomerRemarks.setMinimumSize(new Dimension(640, 84));
pnCustomerRemarks.setMaximumSize(new Dimension(9999, 84));
pnCustomerRemarks.setPreferredSize(new Dimension(0, 84));
pnCustomerRemarks.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.WHITE, Color.GRAY));
{ JLabel lbRemarks = new JLabel()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "1", null, null, null, null);
}
};
lbRemarks.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
lbRemarks.setText("Remarks");
lbRemarks.setVerticalAlignment(SwingConstants.TOP);
lbRemarks.setName("lbRemarks");
super.add(lbRemarks);
pnCustomerRemarks.add(lbRemarks);
}
{ JTextArea taRemarks = new JTextArea();
taRemarks.setName("taRemarks");
super.add(taRemarks);
JScrollPane spRemarks = new JScrollPane(taRemarks)
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "6", "1", "5", null, null, null);
}
};
spRemarks.setName("spRemarks");
super.add(spRemarks);
pnCustomerRemarks.add(spRemarks);
}
pnCustomerRemarks.setName("pnCustomerRemarks");
super.add(pnCustomerRemarks);
pnFieldEdit.add(pnCustomerRemarks);
}
pnFieldEdit.setName("pnFieldEdit");
super.add(pnFieldEdit);
JScrollPane spFieldEdit = new JScrollPane(pnFieldEdit);
spFieldEdit.setName("spFieldEdit");
super.add(spFieldEdit);
pnEdit.add(spFieldEdit, BorderLayout.CENTER);
}
{ JPanel pnEditBtn = new JPanel();
pnEditBtn.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
pnEditBtn.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.WHITE, Color.BLUE));
{ JButton btnUndo = new JButton()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "5", null, null, null, null, null);
}
};
btnUndo.setText("Undo");
btnUndo.setMargin(new Insets(2, 0, 2, 0));
btnUndo.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Undo16.gif")));
btnUndo.setName("btnUndo");
super.add(btnUndo);
pnEditBtn.add(btnUndo);
}
{ JButton btnRedo = new JButton()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "5", null, null, null, null, null);
}
};
btnRedo.setText("Redo");
btnRedo.setMargin(new Insets(2, 0, 2, 0));
btnRedo.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Redo16.gif")));
btnRedo.setName("btnRedo");
super.add(btnRedo);
pnEditBtn.add(btnRedo);
}
{ JButton btnSave = new JButton()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "5", null, null, null, null, null);
}
};
btnSave.setText("Save");
btnSave.setMargin(new Insets(2, 0, 2, 0));
btnSave.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Save16.gif")));
btnSave.setName("btnSave");
super.add(btnSave);
pnEditBtn.add(btnSave);
}
{ JButton btnExit = new JButton()
{ public Dimension getPreferredSize()
{ Dimension preferred = super.getPreferredSize();
return GUIObject.getPreferredSize(preferred, getParent(), "5", null, null, null, null, null);
}
};
btnExit.setText("Exit");
btnExit.setMargin(new Insets(2, 0, 2, 0));
btnExit.setIcon(new ImageIcon(GUIObject.getImageResource("/toolbarButtonGraphics/general/Export16.gif")));
btnExit.setName("btnExit");
super.add(btnExit);
pnEditBtn.add(btnExit);
}
pnEditBtn.setName("pnEditBtn");
super.add(pnEditBtn);
pnEdit.add(pnEditBtn, BorderLayout.SOUTH);
}
pnEdit.setName("pnEdit");
super.add(pnEdit);
spEdit.setLeftComponent(pnEdit);
}
{ JTabbedPane tpOutput = new JTabbedPane();
tpOutput.setTabPlacement(SwingConstants.BOTTOM);
{ JTextArea taHints = new JTextArea();
taHints.setName("taHints");
super.add(taHints);
JScrollPane spHints = new JScrollPane(taHints);
spHints.setName("spHints");
super.add(spHints);
tpOutput.addTab("Hints", null, spHints);
}
{ JTextArea taErrors = new JTextArea();
taErrors.setName("taErrors");
super.add(taErrors);
JScrollPane spErrors = new JScrollPane(taErrors);
spErrors.setName("spErrors");
super.add(spErrors);
tpOutput.addTab("Errors", null, spErrors);
}
tpOutput.setName("tpOutput");
super.add(tpOutput);
spEdit.setRightComponent(tpOutput);
}
spEdit.setDividerLocation(0.7);
spEdit.setResizeWeight(0.7);
spEdit.setName("spEdit");
super.add(spEdit);
guiTranslationExample.getContentPane().add(spEdit, BorderLayout.CENTER);
}
guiTranslationExample.setName("guiTranslationExample");
super.add(guiTranslationExample);
}
}
//==============================================================================
// GUI Handler Class
//
// Access to the model ...
//------------------------------------------------------------------------------
public class GuiTranslationExample extends GuiTranslationExampleController
{
public GuiTranslationExample()
{ super(new GuiTranslationExampleGUI());
guiTranslationExample.show();
}
//==============================================================================
// ActionListener event handling ...
//------------------------------------------------------------------------------
void handleFmExitActionPerformedEvent(ActionEvent e) throws Exception
{ System.exit(0);
}
//==============================================================================
// ItemListener event handling ...
//------------------------------------------------------------------------------
void handleTmEnglishItemStateChangedEvent(ItemEvent e) throws Exception
{ if (e.getStateChange() == ItemEvent.SELECTED)
{ // guiTranslationExample.getName() is the name of the JFrame
// and consequently the name of the top-level container of the GUI.
// We assign this name to the to be translated GUIObject as identifier.
GuiTranslator.translateFor(guiTranslationExample.getName(), gui, "en");
}
}
void handleTmGermanItemStateChangedEvent(ItemEvent e) throws Exception
{ if (e.getStateChange() == ItemEvent.SELECTED)
{ GuiTranslator.translateFor(guiTranslationExample.getName(), gui, "de");
}
}
//==============================================================================
// Execute this GuiTranslationExample Program ...
//------------------------------------------------------------------------------
public static void main(String[] args) throws Exception
{ GuiTranslator.initialize("GuiTranslationRepository.xml");
GuiTranslationExample guiTranslationExample = new GuiTranslationExample();
}
}