01: /*
02: * Created on 12/10/2004
03: *
04: * ============================================================================
05: * GNU Lesser General Public License
06: * ============================================================================
07: *
08: * Swing Components - visit http://sf.net/projects/gfd
09: *
10: * Copyright (C) 2004 Igor Regis da Silva Simões
11: *
12: * This library is free software; you can redistribute it and/or
13: * modify it under the terms of the GNU Lesser General Public
14: * License as published by the Free Software Foundation; either
15: * version 2.1 of the License, or (at your option) any later version.
16: *
17: * This library is distributed in the hope that it will be useful,
18: * but WITHOUT ANY WARRANTY; without even the implied warranty of
19: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20: * Lesser General Public License for more details.
21: *
22: * You should have received a copy of the GNU Lesser General Public
23: * License along with this library; if not, write to the Free Software
24: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
25: */
26: package br.com.gfpshare.beans;
27:
28: import javax.swing.JInternalFrame;
29: import javax.swing.JLabel;
30: import javax.swing.JMenu;
31: import javax.swing.JMenuBar;
32:
33: /**
34: * @author Igor Regis da Silva Simoes
35: */
36: public class IMenuBar extends JMenuBar {
37: private BotoesInternalFrame botoesFrame = new BotoesInternalFrame(
38: null);
39:
40: private JLabel icone = new JLabel();
41:
42: /**
43: *
44: */
45: public IMenuBar() {
46: super ();
47: botoesFrame.setVisible(false);
48: add(botoesFrame);
49: }
50:
51: /**
52: * @see javax.swing.JMenuBar#add(javax.swing.JMenu)
53: */
54: @Override
55: public JMenu add(JMenu c) {
56: remove(botoesFrame);
57: c = super .add(c);
58: add(botoesFrame);
59: return c;
60: }
61:
62: /**
63: * Exibe ou oculta os botões de internal frame na barra de menu
64: * @param b boolean
65: */
66: public void setBotoesFrameVisible(boolean b) {
67: botoesFrame.setVisible(b);
68: }
69:
70: /**
71: * @param f
72: */
73: public void setFrame(JInternalFrame f) {
74: if (f != null) {
75: icone.setIcon(f.getFrameIcon());
76: if (!(getComponent(0) instanceof JLabel))
77: add(icone, 0);
78: icone.repaint();
79: } else if ((getComponent(0) instanceof JLabel))
80: remove(0);
81: botoesFrame.setFrame(f);
82: }
83: }
|