~ubuntu-branches/ubuntu/utopic/freemind/utopic

« back to all changes in this revision

Viewing changes to freemind/freemind/controller/FreeMindToolBar.java

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-01-03 14:19:19 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100103141919-m5az7dkicy21hqop
Tags: 0.9.0~rc6+dfsg-1ubuntu1
* Merge from Debian unstable (LP: #182927), remaining changes:
  - debian/copyright: add license/copyright for
    freemind/freemind/main/ExampleFileFilter.java

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*FreeMind - A Program for creating and viewing Mindmaps
 
2
*Copyright (C) 2000-2006 Joerg Mueller, Daniel Polansky, Christian Foltin, Dimitri Polivaev and others.
 
3
*
 
4
*See COPYING for Details
 
5
*
 
6
*This program is free software; you can redistribute it and/or
 
7
*modify it under the terms of the GNU General Public License
 
8
*as published by the Free Software Foundation; either version 2
 
9
*of the License, or (at your option) any later version.
 
10
*
 
11
*This program is distributed in the hope that it will be useful,
 
12
*but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
*GNU General Public License for more details.
 
15
*
 
16
*You should have received a copy of the GNU General Public License
 
17
*along with this program; if not, write to the Free Software
 
18
*Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
19
*/
 
20
/*
 
21
 * Created on 28.03.2004
 
22
 *
 
23
 */
 
24
package freemind.controller;
 
25
 
 
26
import java.awt.Insets;
 
27
 
 
28
import javax.swing.Action;
 
29
import javax.swing.JButton;
 
30
import javax.swing.JToolBar;
 
31
 
 
32
import freemind.main.Tools;
 
33
 
 
34
/**
 
35
 * @author Stefan Zechmeister
 
36
 */
 
37
public class FreeMindToolBar extends JToolBar {
 
38
        private static Insets nullInsets = new Insets(0,0,0,0);
 
39
 
 
40
        /**
 
41
         * 
 
42
         */
 
43
        public FreeMindToolBar() {
 
44
                this("", JToolBar.HORIZONTAL);
 
45
        }
 
46
 
 
47
        /**
 
48
         */
 
49
        public FreeMindToolBar(int arg0) {
 
50
                this("", arg0);
 
51
        }
 
52
 
 
53
        /**
 
54
         */
 
55
        public FreeMindToolBar(String arg0) {
 
56
                this(arg0, JToolBar.HORIZONTAL);
 
57
        }
 
58
 
 
59
        /**
 
60
         */
 
61
        public FreeMindToolBar(String arg0, int arg1) {
 
62
                super(arg0, arg1);
 
63
                this.setMargin(nullInsets);
 
64
                setFloatable(false);
 
65
        }
 
66
 
 
67
        /* (non-Javadoc)
 
68
         * @see javax.swing.JToolBar#add(javax.swing.Action)
 
69
         */
 
70
        public JButton add(Action arg0) {
 
71
                final Object actionName = arg0.getValue(Action.NAME);
 
72
                arg0.putValue(Action.SHORT_DESCRIPTION, Tools.removeMnemonic(actionName.toString()));
 
73
                JButton returnValue = super.add(arg0);
 
74
                returnValue.setName(actionName.toString());
 
75
                returnValue.setText("");
 
76
                returnValue.setMargin(nullInsets);
 
77
                returnValue.setFocusable(false);
 
78
 
 
79
                // fc, 20.6.2004: try to make the toolbar looking good under Mac OS X.
 
80
                if (System.getProperty("os.name").startsWith("Mac OS")) {
 
81
                        returnValue.setBorderPainted     (false);
 
82
                }
 
83
                returnValue.setContentAreaFilled (false);
 
84
                
 
85
                return returnValue;
 
86
        }
 
87
 
 
88
}