home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-07-30 | 3.3 KB | 91 lines |
-
- package borland.samples.intl.gui;
-
- import java.awt.*;
- import java.awt.event.*;
- import java.util.*;
- import borland.jbcl.layout.*;
- import borland.jbcl.control.*;
-
- import borland.samples.intl.application.*;
- import borland.samples.intl.beans.event.*;
-
- public class ShipToPanel extends BevelPanel implements LocaleChangeListener {
- private AppDataModule appDataModule = AppDataModule.getDataModule();
-
- BevelPanel bevelPanel1 = new BevelPanel();
- BorderLayout borderLayout1 = new BorderLayout();
- InterchangeableCustomerInfoPanel customerInfoPanel;
- BorderLayout borderLayout2 = new BorderLayout();
- CheckboxControl useSameAddressCheckbox = new CheckboxControl();
- ResourceBundle textRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.TextRes");
- ResourceBundle guiRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.GuiRes");
-
- public ShipToPanel() {
- try {
- jbInit();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void jbInit() throws Exception{
- useSameAddressCheckbox.setChecked(true);
- useSameAddressCheckbox.setLabel(textRes.getString("Use_same_address"));
- useSameAddressCheckbox.addItemListener(new ShipToPanel_useSameAddressCheckbox_itemListenerAdapter(this));
- this.setLayout(borderLayout1);
- this.add(useSameAddressCheckbox, BorderLayout.NORTH);
- customerInfoPanel = (InterchangeableCustomerInfoPanel) guiRes.getObject("ShipToCustomerInfoPanel");
- this.add((Panel) customerInfoPanel, BorderLayout.CENTER);
-
- customerInfoPanel.setReadOnly(true);
- customerInfoPanel.setDataSet(appDataModule.getCustomerDataSet());
- LocaleChangeManager.getLocaleChangeManager().addLocaleChangeListener(this);
- }
-
- void useSameAddressCheckbox_itemStateChanged(ItemEvent e) {
- if (useSameAddressCheckbox.isChecked()) {
- customerInfoPanel.setReadOnly(true);
- customerInfoPanel.setDataSet(appDataModule.getCustomerDataSet());
- } else {
- customerInfoPanel.setReadOnly(false);
- customerInfoPanel.setDataSet(appDataModule.getOrderDataSet());
- }
- }
-
- public void localeChanged(LocaleChangeEvent e) {
- textRes = ResourceBundle.getBundle("borland.samples.intl.gui.resources.TextRes", e.getLocale());
- guiRes = ResourceBundle.getBundle("borland.samples.intl.gui.resources.GuiRes", e.getLocale());
- useSameAddressCheckbox.setLabel(textRes.getString("Use_same_address"));
- this.remove((Panel) customerInfoPanel);
- customerInfoPanel = (InterchangeableCustomerInfoPanel) guiRes.getObject("ShipToCustomerInfoPanel");
- this.add((Panel) customerInfoPanel, BorderLayout.CENTER);
- if (useSameAddressCheckbox.isChecked()) {
- customerInfoPanel.setReadOnly(true);
- customerInfoPanel.setDataSet(appDataModule.getCustomerDataSet());
- } else {
- customerInfoPanel.setReadOnly(false);
- customerInfoPanel.setDataSet(appDataModule.getOrderDataSet());
- }
- }
-
- }
-
- class ShipToPanel_useSameAddressCheckbox_itemListenerAdapter implements java.awt.event.ItemListener {
- ShipToPanel adaptee;
-
- ShipToPanel_useSameAddressCheckbox_itemListenerAdapter(ShipToPanel adaptee) {
- this.adaptee = adaptee;
- }
-
- public void itemStateChanged(ItemEvent e) {
- adaptee.useSameAddressCheckbox_itemStateChanged(e);
- }
- }
-
-
-
-
-
-