/[svn]/jsampler/trunk/src/org/jsampler/view/classic/CloseTabDlg.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/classic/CloseTabDlg.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1143 - (show annotations) (download)
Mon Apr 2 21:18:31 2007 UTC (17 years ago) by iliev
File size: 3385 byte(s)
* upgrading to version 0.4a

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>
5 *
6 * This file is part of JSampler.
7 *
8 * JSampler is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * JSampler is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with JSampler; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 package org.jsampler.view.classic;
24
25 import java.awt.Dimension;
26 import java.awt.Frame;
27
28 import java.awt.event.ActionEvent;
29 import java.awt.event.ActionListener;
30
31 import javax.swing.Box;
32 import javax.swing.BoxLayout;
33 import javax.swing.ButtonGroup;
34 import javax.swing.JComboBox;
35 import javax.swing.JLabel;
36 import javax.swing.JPanel;
37 import javax.swing.JRadioButton;
38
39 import org.jsampler.CC;
40 import org.jsampler.view.JSChannelsPane;
41
42 import net.sf.juife.JuifeUtils;
43 import net.sf.juife.OkCancelDialog;
44
45 import static org.jsampler.view.classic.ClassicI18n.i18n;
46
47
48 /**
49 *
50 * @author Grigor Iliev
51 */
52 public class CloseTabDlg extends OkCancelDialog {
53 private final JLabel l = new JLabel(i18n.getLabel("CloseTabDlg.?"));
54 protected final JRadioButton rbRemove =
55 new JRadioButton(i18n.getButtonLabel("CloseTabDlg.rbRemove"));
56 protected final JRadioButton rbMove =
57 new JRadioButton(i18n.getButtonLabel("CloseTabDlg.rbMove"));
58 protected final JComboBox cbTabs = new JComboBox();
59
60
61 /** Creates a new instance of CloseTabDlg */
62 public
63 CloseTabDlg(Frame frm) {
64 super(frm);
65
66 JPanel mainPane = new JPanel();
67 mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));
68
69 l.setAlignmentX(LEFT_ALIGNMENT);
70 mainPane.add(l);
71
72 mainPane.add(Box.createRigidArea(new Dimension(0, 11)));
73
74 ButtonGroup bg = new ButtonGroup();
75 bg.add(rbRemove);
76 bg.add(rbMove);
77 rbRemove.setSelected(true);
78 rbRemove.setForeground(new java.awt.Color(0xee3377));
79
80 JPanel p = new JPanel();
81 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
82 p.add(Box.createRigidArea(new Dimension(12, 0)));
83 p.add(rbRemove);
84 p.setAlignmentX(LEFT_ALIGNMENT);
85 mainPane.add(p);
86
87 for(JSChannelsPane pane : CC.getMainFrame().getChannelsPaneList())
88 if(pane != CC.getMainFrame().getSelectedChannelsPane())
89 cbTabs.addItem(pane);
90
91 cbTabs.addActionListener(new ActionListener() {
92 public void
93 actionPerformed(ActionEvent e) { rbMove.setSelected(true); }
94 });
95
96 p = new JPanel();
97 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
98 p.add(Box.createRigidArea(new Dimension(12, 0)));
99 p.add(rbMove);
100 p.add(Box.createRigidArea(new Dimension(5, 0)));
101 p.add(cbTabs);
102 p.setAlignmentX(LEFT_ALIGNMENT);
103 mainPane.add(p);
104
105 setMainPane(mainPane);
106 }
107
108 protected void
109 onOk() {
110 setCancelled(false);
111 setVisible(false);
112 }
113
114 protected void
115 onCancel() { setVisible(false); }
116
117 public boolean
118 remove() { return rbRemove.isSelected(); }
119
120 public JSChannelsPane
121 getSelectedChannelsPane() { return (JSChannelsPane)cbTabs.getSelectedItem(); }
122 }
123

  ViewVC Help
Powered by ViewVC