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

Diff of /jsampler/trunk/src/org/jsampler/view/classic/HelpAboutDlg.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 787 by iliev, Mon Oct 10 16:03:12 2005 UTC revision 1767 by iliev, Mon Sep 8 00:19:27 2008 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005 Grigor Kirilov Iliev   *   Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 22  Line 22 
22    
23  package org.jsampler.view.classic;  package org.jsampler.view.classic;
24    
25    import java.awt.Desktop;
26  import java.awt.Dialog;  import java.awt.Dialog;
27  import java.awt.Dimension;  import java.awt.Dimension;
28  import java.awt.Frame;  import java.awt.Frame;
# Line 32  import java.awt.Insets; Line 33  import java.awt.Insets;
33  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
34  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
35    
36    import java.net.URI;
37  import java.net.URL;  import java.net.URL;
38    
39  import javax.swing.BorderFactory;  import javax.swing.BorderFactory;
# Line 49  import net.sf.juife.InformationDialog; Line 51  import net.sf.juife.InformationDialog;
51  import net.sf.juife.JuifeUtils;  import net.sf.juife.JuifeUtils;
52  import net.sf.juife.LinkButton;  import net.sf.juife.LinkButton;
53    
54    import org.jsampler.HF;
55    
56  import static org.jsampler.view.classic.ClassicI18n.i18n;  import static org.jsampler.view.classic.ClassicI18n.i18n;
57    
58    
# Line 57  import static org.jsampler.view.classic. Line 61  import static org.jsampler.view.classic.
61   * @author grish   * @author grish
62   */   */
63  public class HelpAboutDlg extends InformationDialog {  public class HelpAboutDlg extends InformationDialog {
         private final static JPanel pane = new JPanel();  
           
64          private JLabel lProductName =          private JLabel lProductName =
65                  new JLabel("<html>\n<font size=+1>JS Classic (version 0.1a)</font>");                  new JLabel("<html>\n<font size=+1>JS Classic (version 0.8a cvs_4)</font>");
66                    
67          private JLabel lAuthor = new JLabel(i18n.getLabel("HelpAboutDlg.lAuthor"));          private JLabel lAuthor = new JLabel(i18n.getLabel("HelpAboutDlg.lAuthor"));
68          private JTextField tfAuthor = new JTextField(i18n.getLabel("HelpAboutDlg.tfAuthor"));          private JTextField tfAuthor = new JTextField(i18n.getLabel("HelpAboutDlg.tfAuthor"));
# Line 77  public class HelpAboutDlg extends Inform Line 79  public class HelpAboutDlg extends Inform
79                  = new LinkButton("juife - Java User Interface Framework Extensions");                  = new LinkButton("juife - Java User Interface Framework Extensions");
80                    
81                    
82          private JLabel lCopyright =          private JLabel lCopyright = new JLabel(i18n.getLabel("HelpAboutDlg.lCopyright"));
                 new JLabel(i18n.getLabel("HelpAboutDlg.lCopyright"));  
83                    
84          private JPanel mainPane = new JPanel();          private JPanel mainPane = new JPanel();
85                    
86          /** Creates a new instance of HelpAboutDlg */          /** Creates a new instance of HelpAboutDlg */
87          public HelpAboutDlg(Frame owner) {          public HelpAboutDlg(Frame owner) {
88                  super(owner, i18n.getLabel("HelpAboutDlg.title"), pane);                  super(owner, i18n.getLabel("HelpAboutDlg.title"));
89                                    
90                  GridBagLayout gridbag = new GridBagLayout();                  GridBagLayout gridbag = new GridBagLayout();
91                  GridBagConstraints c = new GridBagConstraints();                  GridBagConstraints c = new GridBagConstraints();
# Line 187  public class HelpAboutDlg extends Inform Line 188  public class HelpAboutDlg extends Inform
188                  lCopyright.setAlignmentX(LEFT_ALIGNMENT);                  lCopyright.setAlignmentX(LEFT_ALIGNMENT);
189                  mainPane.add(lCopyright);                  mainPane.add(lCopyright);
190                                    
                 pane.getParent().remove(pane);  
191                  setMainPane(mainPane);                  setMainPane(mainPane);
192                                    
193                  pack();                  pack();
# Line 232  public class HelpAboutDlg extends Inform Line 232  public class HelpAboutDlg extends Inform
232                  private JLabel lAuthorEmail =                  private JLabel lAuthorEmail =
233                          new JLabel(i18n.getLabel("HelpAboutDlg.lAuthorEmail"));                          new JLabel(i18n.getLabel("HelpAboutDlg.lAuthorEmail"));
234                  private JLabel lLSWebsite = new JLabel(i18n.getLabel("HelpAboutDlg.lLSWebsite"));                  private JLabel lLSWebsite = new JLabel(i18n.getLabel("HelpAboutDlg.lLSWebsite"));
235                  private WebButton btnAuthorEmail = new WebButton("gr.iliev@gmail.com");                  private LinkButton btnAuthorEmail = new LinkButton("grigor@grigoriliev.com");
236                  private WebButton btnWebsite = new WebButton("http://www.linuxsampler.org");                  private LinkButton btnLSWebsite = new LinkButton("www.linuxsampler.org");
237                                    
238                  private JLabel lLSMailingList =                  private JLabel lLSMailingList =
239                          new JLabel(i18n.getLabel("HelpAboutDlg.lLSMailingList"));                          new JLabel(i18n.getLabel("HelpAboutDlg.lLSMailingList"));
240                                    
241                  private WebButton btnMailingList = new WebButton (                  private LinkButton btnMailingList = new LinkButton (
242                          "http://lists.sourceforge.net/lists/listinfo/linuxsampler-devel"                          "lists.sourceforge.net/lists/listinfo/linuxsampler-devel"
243                  );                  );
244                    
245                  ContactInfoPane() {                  ContactInfoPane() {
# Line 275  public class HelpAboutDlg extends Inform Line 275  public class HelpAboutDlg extends Inform
275                                                    
276                          c.gridx = 1;                          c.gridx = 1;
277                          c.gridy = 1;                          c.gridy = 1;
278                          gridbag.setConstraints(btnWebsite, c);                          gridbag.setConstraints(btnLSWebsite, c);
279                          add(btnWebsite);                          add(btnLSWebsite);
280                                                    
281                          c.gridx = 1;                          c.gridx = 1;
282                          c.gridy = 2;                          c.gridy = 2;
# Line 285  public class HelpAboutDlg extends Inform Line 285  public class HelpAboutDlg extends Inform
285                          add(btnMailingList);                          add(btnMailingList);
286                                                    
287                          setBorder(BorderFactory.createTitledBorder (                          setBorder(BorderFactory.createTitledBorder (
288                                  i18n.getLabel("HelpAboutDlg.ContactInfoPane")                                  i18n.getLabel("HelpAboutDlg.contactInfoPane")
289                          ));                          ));
290                            
291                            installListeners();
292                  }                  }
293                    
294                    private void
295                    installListeners() {
296                            btnAuthorEmail.addActionListener(new ActionListener() {
297                                    public void
298                                    actionPerformed(ActionEvent e) {
299                                            browse("mailto:grigor@grigoriliev.com");
300                                    }
301                            });
302                    
303                            btnLSWebsite.addActionListener(new ActionListener() {
304                                    public void
305                                    actionPerformed(ActionEvent e) {
306                                            browse("http://www.linuxsampler.org");
307                                    }
308                            });
309                    
310                            btnMailingList.addActionListener(new ActionListener() {
311                                    public void
312                                    actionPerformed(ActionEvent e) {
313                                            browse("http://lists.sourceforge.net/lists/listinfo/linuxsampler-devel");
314                                    }
315                            });
316                    }
317            }
318            
319            private boolean
320            checkDesktopSupported() {
321                    if(Desktop.isDesktopSupported()) return true;
322                    
323                    HF.showErrorMessage(i18n.getError("HelpAboutDlg.DesktopApiNotSupported"), this);
324                    
325                    return false;
326            }
327            
328            private void
329            browse(String uri) {
330                    if(!checkDesktopSupported()) return;
331                    
332                    try { Desktop.getDesktop().browse(new URI(uri)); }
333                    catch(Exception x) { x.printStackTrace(); }
334            }
335            
336            private void
337            mail(String uri) {
338                    if(!checkDesktopSupported()) return;
339                    
340                    Desktop desktop = Desktop.getDesktop();
341                    
342                    try { Desktop.getDesktop().mail(new URI(uri)); }
343                    catch(Exception x) { x.printStackTrace(); }
344          }          }
345  }  }
346    
# Line 305  class WebButton extends LinkButton { Line 358  class WebButton extends LinkButton {
358  enum License { GPL, LGPL }  enum License { GPL, LGPL }
359    
360  class LicenseDlg extends InformationDialog {  class LicenseDlg extends InformationDialog {
         private static JPanel pane = new JPanel();  
           
361          LicenseDlg(Dialog owner, License license) {          LicenseDlg(Dialog owner, License license) {
362                  super(owner, pane);                  super(owner);
363                                    
364                  switch(license) {                  switch(license) {
365                          case GPL: setTitle("GNU General Public License"); break;                          case GPL: setTitle("GNU General Public License"); break;
# Line 318  class LicenseDlg extends InformationDial Line 369  class LicenseDlg extends InformationDial
369                  JScrollPane sp = new JScrollPane(new LicensePane(license));                  JScrollPane sp = new JScrollPane(new LicensePane(license));
370                  sp.setPreferredSize(new Dimension(800, 400));                  sp.setPreferredSize(new Dimension(800, 400));
371                                    
                 pane.getParent().remove(pane);  
372                  setMainPane(sp);                  setMainPane(sp);
373          }          }
374                    
# Line 342  class LicenseDlg extends InformationDial Line 392  class LicenseDlg extends InformationDial
392                          } catch(Exception x) {                          } catch(Exception x) {
393                                  x.printStackTrace();                                  x.printStackTrace();
394                          }                          }
395                            
396                            setEditable(false);
397                  }                  }
398          }          }
399  }  }
400    
401  class LibraryInfoDlg extends InformationDialog {  class LibraryInfoDlg extends InformationDialog {
         private final static JPanel pane = new JPanel();  
           
402          private JLabel lAuthor = new JLabel(i18n.getLabel("LibraryInfoDlg.lAuthor"));          private JLabel lAuthor = new JLabel(i18n.getLabel("LibraryInfoDlg.lAuthor"));
403          private JTextField tfAuthor = new JTextField(i18n.getLabel("LibraryInfoDlg.tfAuthor"));          private JTextField tfAuthor = new JTextField(i18n.getLabel("LibraryInfoDlg.tfAuthor"));
404                    
# Line 365  class LibraryInfoDlg extends Information Line 415  class LibraryInfoDlg extends Information
415                  String website,                  String website,
416                  final License license                  final License license
417          ) {          ) {
418                  super(owner, libName,  pane);                  super(owner, libName);
419                                    
420                  switch(license) {                  switch(license) {
421                          case GPL: btnLicense.setText("GNU General Public License"); break;                          case GPL: btnLicense.setText("GNU General Public License"); break;
# Line 374  class LibraryInfoDlg extends Information Line 424  class LibraryInfoDlg extends Information
424                                    
425                  btnWebsite.setText(website);                  btnWebsite.setText(website);
426                                    
                 pane.getParent().remove(pane);  
427                  setMainPane(new LibraryInfoPane(libName, libVersion, license));                  setMainPane(new LibraryInfoPane(libName, libVersion, license));
428                                    
429                  btnLicense.addActionListener(new ActionListener() {                  btnLicense.addActionListener(new ActionListener() {

Legend:
Removed from v.787  
changed lines
  Added in v.1767

  ViewVC Help
Powered by ViewVC