Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: ide/AboutDialog.java


1   
2   /* **********************************
3    File: AboutDialog.java
4    Author: Felix(felix@ulise.cs.pub.ro)
5    Created on 01-03-99 
6    Comments: Part of the vIDE Project
7               Copyright 1999 the vIDE Team.
8   ***********************************/
9   
10  package ide;
11  
12  
13  import java.awt.*;
14  import java.awt.event.*;
15  //import java.beans.*;
16  import javax.swing.*;
17  import javax.swing.border.*;
18  import javax.swing.event.*;
19  //import javax.swing.plaf.*;
20  //import javax.swing.text.*;
21  //import javax.swing.tree.*;
22  //import javax.swing.undo.*;
23  import java.io.FileReader;
24  import java.io.Reader;
25  //import javax.swing.text.html.*;
26  
27  
28  public class AboutDialog extends JDialog {
29  
30    public AboutDialog(JFrame f) {
31      super(f, "About vIDE ", true);
32      
33      setResizable(false); 
34  
35      JTabbedPane tabs = new JTabbedPane(SwingConstants.TOP);
36  
37  
38      JLabel imageLabel = new JLabel(new ImageIcon(vide.baseDir + "images/splash.gif"));
39      
40      tabs.addTab( "About vIDE", null, imageLabel);
41  
42  
43      JPanel infoPanel = new JPanel(new GridLayout(11, 1, 0, 0));
44      java.util.Properties  properties;
45  
46      Runtime rt = Runtime.getRuntime();
47      long freeMem, totalMem;
48      
49      
50      freeMem = rt.freeMemory() >> 10;
51      totalMem = rt.totalMemory() >> 10;
52      
53      try {
54          properties = System.getProperties();
55          infoPanel.add(new JLabel("Operating system :" + properties.getProperty("os.name")));
56          infoPanel.add(new JLabel("OS version :" + properties.getProperty("os.version")));
57          infoPanel.add(new JLabel("os.architecture : " + properties.getProperty("os.arch")));
58          infoPanel.add(new JLabel("java.vm.name :" + properties.getProperty("java.vm.name")));
59          infoPanel.add(new JLabel("java.vm.info :" + properties.getProperty("java.vm.info")));
60          infoPanel.add(new JLabel("java.vm.version :" + properties.getProperty("java.vm.version")));
61          infoPanel.add(new JLabel("java.version :" + properties.getProperty("java.version")));
62          infoPanel.add(new JLabel("JIT compiler :" + properties.getProperty("java.compiler")));
63          infoPanel.add(new JLabel("Java Class Version :" + properties.getProperty("java.class.version")));
64          infoPanel.add(new JLabel("Total virtual machine memory :" + totalMem));
65          infoPanel.add(new JLabel("Free virtual machine memory :" + freeMem));
66      } catch(SecurityException ex) {
67          infoPanel.add(new JLabel("Security Excpetion: Cannot access System.getProperties()"));
68      } 
69  
70      tabs.addTab( "Sys Info", null, infoPanel);
71      
72      JPanel aboutUsPanel = new JPanel(new GridLayout(15, 1, 0, 0));
73      aboutUsPanel.add(new JLabel("vIDE - The Definitive Interplatform Verilog IDE(c) 1999 pChr"));
74      aboutUsPanel.add(new JLabel("Copyright (c) 1999 - 0001"));
75      aboutUsPanel.add(new JLabel(""));
76      aboutUsPanel.add(new JLabel("Team:"));
77  
78      aboutUsPanel.add(new JLabel("Chief programmer: Alexandru Panoviciu"));
79      aboutUsPanel.add(new JLabel(""));
80      aboutUsPanel.add(new JLabel("Raluca Ionescu (ide)"));
81      aboutUsPanel.add(new JLabel("Daniel Pavel (engine) [power@sundy.cs.pub.ro]"));
82      aboutUsPanel.add(new JLabel("Alexandru Panoviciu (engine, middle) [alecu@sundy.cs.pub.ro]"));
83      aboutUsPanel.add(new JLabel("Lucian Felix Ghita (ide, middle, artwork) [felix@ulise.cs.pub.ro]"));
84      aboutUsPanel.add(new JLabel(""));   
85      aboutUsPanel.add(new JLabel("Made at the"));
86      aboutUsPanel.add(new JLabel("Computer Science Departament of the"));
87      aboutUsPanel.add(new JLabel("\"Politehnica\" University of Buchrest, Romania"));
88      
89      tabs.addTab( "Credits", aboutUsPanel);
90      
91      JPanel licensePanel = new JPanel();
92      JTextArea licenseTextArea = new JTextArea();
93      try {
94        licenseTextArea.read((Reader) (new FileReader(vide.baseDir + "Documentation/license")), null);
95      } catch (Exception e) {
96        System.out.println("Cannot find license file.");
97        licenseTextArea.setText("IOException: license file not foud in ./Documentation");
98      }
99      licenseTextArea.setEditable(false); 
100     //licenseTextArea.setMaximumSize(new Dimension(190, 200));
101     
102     JScrollPane scroller = new JScrollPane(licenseTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS  );
103     //scroller.setMaximumSize(new Dimension(100, 200));
104     //licensePanel.add(scroller);
105     
106     scroller.setMaximumSize(new Dimension(100, 200));
107     scroller.setSize(new Dimension(100, 200));
108     scroller.setPreferredSize(new Dimension(100, 200));
109     tabs.addTab("License", scroller);
110     //those sizes give me headakes
111     
112     
113     //licensePanel.setMaximumSize(new Dimension(150, 200));
114     
115     //scroller.setSize(new Dimension(100, 200));
116     //licensePanel.setSize(new Dimension(150, 200));
117     
118     getContentPane().setLayout( new BorderLayout() );
119     getContentPane().add(tabs, BorderLayout.CENTER);
120     
121     JButton ok = new JButton("OK");
122     ok.addActionListener(new ActionListener() {
123       public void actionPerformed(ActionEvent e) {
124         OKPressed();
125       }});
126     JPanel p = new JPanel();
127     p.setLayout( new BorderLayout() );
128     p.add(ok, BorderLayout.EAST );
129     getContentPane().add(p, BorderLayout.SOUTH );
130     
131     getRootPane().setDefaultButton(ok);
132     pack();
133     
134     scroller.setMaximumSize(new Dimension(100, 200));
135     scroller.setSize(new Dimension(100, 200));
136     scroller.setPreferredSize(new Dimension(100, 200));
137     
138     centerDialog();
139   }
140 
141   protected void centerDialog() {
142     Dimension screenSize = this.getToolkit().getScreenSize();
143     Dimension size = this.getSize();
144     screenSize.height = screenSize.height/2;
145     screenSize.width = screenSize.width/2;
146     size.height = size.height/2;
147     size.width = size.width/2;
148     int y = screenSize.height - size.height;
149     int x = screenSize.width - size.width;
150     this.setLocation(x,y);
151   }
152 
153   public void OKPressed() {
154     this.setVisible(false);
155   }
156 }
157