OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 17 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17 Rev 182
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 /*
14
 /*
15
 * Créé le 3 avr. 2005
15
 * Créé le 3 avr. 2005
16
 *
16
 *
17
 */
17
 */
18
package org.openconcerto.ui;
18
package org.openconcerto.ui;
19
 
19
 
20
import java.awt.*;
20
import java.awt.*;
21
import javax.swing.JMenu;
21
import javax.swing.JMenu;
22
import javax.swing.JMenuItem;
22
import javax.swing.JMenuItem;
23
import javax.swing.event.MenuEvent;
23
import javax.swing.event.MenuEvent;
24
import javax.swing.event.MenuListener;
24
import javax.swing.event.MenuListener;
25
 
25
 
26
public class IMenuWithArrows extends JMenu
26
public class IMenuWithArrows extends JMenu
27
    implements MenuListener
27
    implements MenuListener
28
{
28
{
29
    private IWindowWithArrow arrowWindow;
29
    private IWindowWithArrow arrowWindow;
30
    public IMenuWithArrows(String s)
30
    public IMenuWithArrows(String s)
31
    {
31
    {
32
        super(s);
32
        super(s);
33
        addMenuListener(this);
33
        addMenuListener(this);
34
        arrowWindow = new IWindowWithArrow(this);
34
        arrowWindow = new IWindowWithArrow(this);
35
    }
35
    }
36
 
36
 
37
    public JMenuItem add(JMenuItem jmenuitem)
37
    public JMenuItem add(JMenuItem jmenuitem)
38
    {
38
    {
39
        arrowWindow.add(jmenuitem);
39
        arrowWindow.add(jmenuitem);
40
        return jmenuitem;
40
        return jmenuitem;
41
    }
41
    }
42
 
42
 
43
    public void menuSelected(MenuEvent menuevent)
43
    public void menuSelected(MenuEvent menuevent)
44
    {
44
    {
45
        Point point = getLocationOnScreen();
45
        Point point = getLocationOnScreen();
46
        arrowWindow.setLocation(point.x, point.y + getSize().height);
46
        arrowWindow.setLocation(point.x, point.y + getSize().height);
47
        arrowWindow.setVisible(true);
47
        arrowWindow.setVisible(true);
48
        arrowWindow.requestFocus();
48
        arrowWindow.requestFocus();
49
        arrowWindow.repaint();
49
        arrowWindow.repaint();
50
    }
50
    }
51
 
51
 
52
    public void menuCanceled(MenuEvent menuevent)
52
    public void menuCanceled(MenuEvent menuevent)
53
    {
53
    {
54
        arrowWindow.setVisible(false);
54
        arrowWindow.setVisible(false);
55
    }
55
    }
56
 
56
 
57
    public void menuDeselected(MenuEvent menuevent)
57
    public void menuDeselected(MenuEvent menuevent)
58
    {
58
    {
59
        arrowWindow.setVisible(false);
59
        arrowWindow.setVisible(false);
60
    }
60
    }
61
 
61
 
62
    protected void fireMenuCanceled()
62
    protected void fireMenuCanceled()
63
    {
63
    {
64
        super.fireMenuCanceled();
64
        super.fireMenuCanceled();
65
    }
65
    }
66
 
66
 
67
   
67
   
68
}
68
}