1 42 43 package org.jfree.ui.tabbedui; 44 45 import java.awt.BorderLayout ; 46 import java.beans.PropertyChangeEvent ; 47 import java.beans.PropertyChangeListener ; 48 49 import javax.swing.JApplet ; 50 import javax.swing.JPanel ; 51 52 57 public class TabbedApplet extends JApplet { 58 59 62 private class MenuBarChangeListener implements PropertyChangeListener { 63 66 public MenuBarChangeListener() { 67 } 68 69 75 public void propertyChange(final PropertyChangeEvent evt) { 76 if (evt.getPropertyName().equals(AbstractTabbedUI.JMENUBAR_PROPERTY)) { 77 setJMenuBar(getTabbedUI().getJMenuBar()); 78 } 79 } 80 } 81 82 83 private AbstractTabbedUI tabbedUI; 84 85 88 public TabbedApplet() { 89 } 90 91 92 97 protected final AbstractTabbedUI getTabbedUI() 98 { 99 return tabbedUI; 100 } 101 106 public void init(final AbstractTabbedUI tabbedUI) { 107 108 this.tabbedUI = tabbedUI; 109 this.tabbedUI.addPropertyChangeListener 110 (AbstractTabbedUI.JMENUBAR_PROPERTY, new MenuBarChangeListener()); 111 112 final JPanel panel = new JPanel (); 113 panel.setLayout(new BorderLayout ()); 114 panel.add(tabbedUI, BorderLayout.CENTER); 115 setContentPane(panel); 116 setJMenuBar(tabbedUI.getJMenuBar()); 117 } 118 119 } 120 | Popular Tags |