01: /*
02: * Copyright 2006 Ethan Nicholas. All rights reserved.
03: * Use is subject to license terms.
04: */
05: package jaxx.runtime.swing;
06:
07: import java.awt.*;
08: import java.beans.*;
09: import javax.swing.*;
10:
11: public class TabInfoPropertyChangeListener implements
12: PropertyChangeListener {
13: private JTabbedPane tabs;
14: private int tabIndex;
15:
16: public TabInfoPropertyChangeListener(JTabbedPane tabs, int tabIndex) {
17: this .tabs = tabs;
18: this .tabIndex = tabIndex;
19: }
20:
21: public void propertyChange(PropertyChangeEvent e) {
22: String name = e.getPropertyName();
23: if (name.equals(TabInfo.TITLE_PROPERTY))
24: tabs.setTitleAt(tabIndex, (String) e.getNewValue());
25: else if (name.equals(TabInfo.TOOL_TIP_TEXT_PROPERTY))
26: tabs.setToolTipTextAt(tabIndex, (String) e.getNewValue());
27: else if (name.equals(TabInfo.FOREGROUND_PROPERTY))
28: tabs.setForegroundAt(tabIndex, (Color) e.getNewValue());
29: else if (name.equals(TabInfo.BACKGROUND_PROPERTY))
30: tabs.setBackgroundAt(tabIndex, (Color) e.getNewValue());
31: else if (name.equals(TabInfo.MNEMONIC_PROPERTY))
32: tabs.setMnemonicAt(tabIndex, ((Integer) e.getNewValue())
33: .intValue());
34: else if (name.equals(TabInfo.DISPLAYED_MNEMONIC_INDEX_PROPERTY))
35: tabs.setDisplayedMnemonicIndexAt(tabIndex, ((Integer) e
36: .getNewValue()).intValue());
37: else if (name.equals(TabInfo.ICON_PROPERTY))
38: tabs.setIconAt(tabIndex, (Icon) e.getNewValue());
39: else if (name.equals(TabInfo.DISABLED_ICON_PROPERTY))
40: tabs.setDisabledIconAt(tabIndex, (Icon) e.getNewValue());
41: }
42: }
|