/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/SamplerInfoDlg.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/fantasia/SamplerInfoDlg.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1286 - (show annotations) (download)
Fri Aug 10 20:24:23 2007 UTC (16 years, 9 months ago) by iliev
File size: 5123 byte(s)
- Updated to version 0.6a. The Fantasia distribution is now
  capable of controlling all features available in LinuxSampler

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2007 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.fantasia;
24
25 import java.awt.Frame;
26
27 import java.awt.Dimension;
28 import java.awt.GridBagConstraints;
29 import java.awt.GridBagLayout;
30 import java.awt.Insets;
31
32 import javax.swing.BorderFactory;
33 import javax.swing.Box;
34 import javax.swing.BoxLayout;
35 import javax.swing.JLabel;
36 import javax.swing.JPanel;
37 import javax.swing.JTextField;
38
39 import net.sf.juife.InformationDialog;
40
41 import org.jsampler.CC;
42
43 import org.linuxsampler.lscp.ServerInfo;
44
45 import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
46
47
48 /**
49 *
50 * @author Grigor Iliev
51 */
52 public class SamplerInfoDlg extends InformationDialog {
53 private final JLabel lLinuxSamplerLogo = new JLabel(Res.iconLinuxSamplerLogo);
54 private final JLabel lDescription = new JLabel();
55 private final JLabel lVersion = new JLabel(i18n.getLabel("SamplerInfoDlg.lVersion"));
56 private final JLabel lProtocolVersion =
57 new JLabel(i18n.getLabel("SamplerInfoDlg.lProtocolVersion"));
58
59 private final JLabel lDbSupport = new JLabel(i18n.getLabel("SamplerInfoDlg.lDbSupport"));
60 private final JTextField tfVersion = new JTextField();
61 private final JTextField tfProtocolVersion = new JTextField();
62 private final JTextField tfDbSupport = new JTextField();
63
64
65 /** Creates a new instance of SamplerInfoDlg */
66 public SamplerInfoDlg(Frame owner) {
67 super(owner, i18n.getLabel("SamplerInfoDlg.title"));
68
69 showCloseButton(false);
70 setResizable(false);
71
72 JPanel mainPane = new JPanel();
73 ServerInfo si = CC.getSamplerModel().getServerInfo();
74
75 if(si == null) {
76 mainPane.add(new JLabel(i18n.getLabel("SamplerInfoDlg.unavailable")));
77 setMainPane(mainPane);
78 return;
79 }
80
81 lDescription.setText(si.getDescription());
82 tfVersion.setText(si.getVersion());
83 tfProtocolVersion.setText(si.getProtocolVersion());
84 if(si.hasInstrumentsDbSupport()) {
85 tfDbSupport.setText(i18n.getButtonLabel("yes"));
86 } else {
87 tfDbSupport.setText(i18n.getButtonLabel("no"));
88 }
89
90 tfVersion.setEnabled(false);
91 tfVersion.setOpaque(false);
92 tfVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
93 tfVersion.setDisabledTextColor(tfVersion.getForeground());
94
95 tfProtocolVersion.setEnabled(false);
96 tfProtocolVersion.setOpaque(false);
97 tfProtocolVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
98 tfProtocolVersion.setDisabledTextColor(tfProtocolVersion.getForeground());
99
100 tfDbSupport.setEnabled(false);
101 tfDbSupport.setOpaque(false);
102 tfDbSupport.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
103 tfDbSupport.setDisabledTextColor(tfDbSupport.getForeground());
104
105
106 JPanel infoPane = new JPanel();
107
108 GridBagLayout gridbag = new GridBagLayout();
109 GridBagConstraints c = new GridBagConstraints();
110
111 infoPane.setLayout(gridbag);
112
113 c.gridx = 0;
114 c.gridy = 0;
115 c.insets = new Insets(3, 3, 3, 3);
116 c.anchor = GridBagConstraints.EAST;
117 gridbag.setConstraints(lVersion, c);
118 infoPane.add(lVersion);
119
120 c.gridx = 0;
121 c.gridy = 1;
122 gridbag.setConstraints(lProtocolVersion, c);
123 infoPane.add(lProtocolVersion);
124
125 c.gridx = 0;
126 c.gridy = 2;
127 gridbag.setConstraints(lDbSupport, c);
128 infoPane.add(lDbSupport);
129
130 c.gridx = 1;
131 c.gridy = 0;
132 c.weightx = 1.0;
133 c.fill = GridBagConstraints.HORIZONTAL;
134 c.anchor = GridBagConstraints.WEST;
135 gridbag.setConstraints(tfVersion, c);
136 infoPane.add(tfVersion);
137
138 c.gridx = 1;
139 c.gridy = 1;
140 gridbag.setConstraints(tfProtocolVersion, c);
141 infoPane.add(tfProtocolVersion);
142
143 c.gridx = 1;
144 c.gridy = 2;
145 gridbag.setConstraints(tfDbSupport, c);
146 infoPane.add(tfDbSupport);
147
148 //infoPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
149 infoPane.setMaximumSize(infoPane.getPreferredSize());
150
151 JPanel bodyPane = new JPanel();
152 bodyPane.setLayout(new BoxLayout(bodyPane, BoxLayout.X_AXIS));
153 bodyPane.setAlignmentX(JPanel.LEFT_ALIGNMENT);
154
155 bodyPane.add(lLinuxSamplerLogo);
156 bodyPane.add(Box.createRigidArea(new Dimension(6, 0)));
157 bodyPane.add(infoPane);
158
159
160 mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));
161
162 mainPane.add(Box.createRigidArea(new Dimension(0, 6)));
163 lDescription.setAlignmentX(JPanel.LEFT_ALIGNMENT);
164 mainPane.add(lDescription);
165 mainPane.add(Box.createRigidArea(new Dimension(0, 12)));
166
167 mainPane.add(bodyPane);
168
169 setMainPane(mainPane);
170 }
171 }

  ViewVC Help
Powered by ViewVC