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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1285 - (show annotations) (download)
Fri Aug 10 19:55:03 2007 UTC (16 years, 8 months ago) by iliev
File size: 4920 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.classic;
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.classic.ClassicI18n.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.setEditable(false);
91 tfVersion.setOpaque(false);
92 tfVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
93
94 tfProtocolVersion.setEditable(false);
95 tfProtocolVersion.setOpaque(false);
96 tfProtocolVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
97
98 tfDbSupport.setEditable(false);
99 tfDbSupport.setOpaque(false);
100 tfDbSupport.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
101
102
103 JPanel infoPane = new JPanel();
104
105 GridBagLayout gridbag = new GridBagLayout();
106 GridBagConstraints c = new GridBagConstraints();
107
108 infoPane.setLayout(gridbag);
109
110 c.gridx = 0;
111 c.gridy = 0;
112 c.insets = new Insets(3, 3, 3, 3);
113 c.anchor = GridBagConstraints.EAST;
114 gridbag.setConstraints(lVersion, c);
115 infoPane.add(lVersion);
116
117 c.gridx = 0;
118 c.gridy = 1;
119 gridbag.setConstraints(lProtocolVersion, c);
120 infoPane.add(lProtocolVersion);
121
122 c.gridx = 0;
123 c.gridy = 2;
124 gridbag.setConstraints(lDbSupport, c);
125 infoPane.add(lDbSupport);
126
127 c.gridx = 1;
128 c.gridy = 0;
129 c.weightx = 1.0;
130 c.fill = GridBagConstraints.HORIZONTAL;
131 c.anchor = GridBagConstraints.WEST;
132 gridbag.setConstraints(tfVersion, c);
133 infoPane.add(tfVersion);
134
135 c.gridx = 1;
136 c.gridy = 1;
137 gridbag.setConstraints(tfProtocolVersion, c);
138 infoPane.add(tfProtocolVersion);
139
140 c.gridx = 1;
141 c.gridy = 2;
142 gridbag.setConstraints(tfDbSupport, c);
143 infoPane.add(tfDbSupport);
144
145 //infoPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
146 infoPane.setMaximumSize(infoPane.getPreferredSize());
147
148 JPanel bodyPane = new JPanel();
149 bodyPane.setLayout(new BoxLayout(bodyPane, BoxLayout.X_AXIS));
150 bodyPane.setAlignmentX(JPanel.LEFT_ALIGNMENT);
151
152 bodyPane.add(lLinuxSamplerLogo);
153 bodyPane.add(Box.createRigidArea(new Dimension(6, 0)));
154 bodyPane.add(infoPane);
155
156
157 mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));
158
159 mainPane.add(Box.createRigidArea(new Dimension(0, 6)));
160 lDescription.setAlignmentX(JPanel.LEFT_ALIGNMENT);
161 mainPane.add(lDescription);
162 mainPane.add(Box.createRigidArea(new Dimension(0, 12)));
163
164 mainPane.add(bodyPane);
165
166 setMainPane(mainPane);
167 }
168 }

  ViewVC Help
Powered by ViewVC