Gridarta Editor
CloseableTabbedPane.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 /*
21  * Section two. Copy of licensing declaration xnap source code.
22  *
23  * Java Napster version x.yz (for current version number as well as for
24  * additional information see version.txt)
25  *
26  * Previous versions of this program were written by Florian Student
27  * and Michael Ransburg available at www.weblicity.de/jnapster and
28  * http://www.tux.org/~daneel/content/projects/10.shtml respectively.
29  *
30  *
31  * This program is free software; you can redistribute it and/or modify
32  * it under the terms of the GNU General Public License as published by
33  * the Free Software Foundation; either version 2 of the License, or
34  * (at your option) any later version.
35  *
36  * This program is distributed in the hope that it will be useful,
37  * but WITHOUT ANY WARRANTY; without even the implied warranty of
38  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39  * GNU General Public License for more details.
40  *
41  * You should have received a copy of the GNU General Public License
42  * along with this program; if not, write to the Free Software
43  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44  *
45  */
46 
47 package net.sf.gridarta.gui.dialog.plugin;
48 
49 import java.awt.Component;
50 import javax.swing.ImageIcon;
51 import javax.swing.JTabbedPane;
52 import org.jetbrains.annotations.NotNull;
53 
54 public class CloseableTabbedPane extends JTabbedPane {
55 
59  @NotNull
60  private final ImageIcon closingIcon;
61 
62  private static final long serialVersionUID = 1L;
63 
68  public CloseableTabbedPane(@NotNull final ImageIcon closingIcon) {
69  this.closingIcon = closingIcon;
70 
71  addMouseListener(new ClosingListener(this));
72  }
73 
74  @Override
75  @SuppressWarnings("RefusedBequest")
76  public void addTab(@NotNull final String title, @NotNull final Component component) {
77  addTab(title, new ClosingIcon(closingIcon), component);
78  setSelectedComponent(component);
79  }
80 
81 }
net.sf.gridarta.gui.dialog.plugin.CloseableTabbedPane.CloseableTabbedPane
CloseableTabbedPane(@NotNull final ImageIcon closingIcon)
Creates a new instance.
Definition: CloseableTabbedPane.java:68
net.sf.gridarta.gui.dialog.plugin.CloseableTabbedPane.addTab
void addTab(@NotNull final String title, @NotNull final Component component)
Definition: CloseableTabbedPane.java:76
net.sf.gridarta.gui.dialog.plugin.ClosingListener
Definition: ClosingListener.java:27
net.sf.gridarta.gui.dialog.plugin.CloseableTabbedPane.closingIcon
final ImageIcon closingIcon
The icon.
Definition: CloseableTabbedPane.java:60
net.sf.gridarta.gui.dialog.plugin.CloseableTabbedPane
Definition: CloseableTabbedPane.java:54
net.sf.gridarta.gui.dialog.plugin.CloseableTabbedPane.serialVersionUID
static final long serialVersionUID
Definition: CloseableTabbedPane.java:62
net.sf.gridarta.gui.dialog.plugin.ClosingIcon
the idea for this class stems from limewire's CancelSearchIconProxy class, thanks for going open sour...
Definition: ClosingIcon.java:31