View Javadoc
1 /***************************************************************************** 2 * Virtual Mockup for Machine Vision 3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr., 4 * Carlos S. Santos. 5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP 6 * 7 * Permission is granted to redistribute and/or modify this 8 * software under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This software 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 GNU 15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html) 16 * for more details. 17 * 18 *****************************************************************************/ 19 20 package camera3d.gui; 21 22 import java.awt.*; 23 import java.awt.event.*; 24 import javax.swing.*; 25 import javax.swing.border.*; 26 27 28 /*** 29 * Text box shown in response to "about" command in VcFrame. 30 * 31 * @author Fábio Roberto de Miranda 32 * @version 1.0 33 */ 34 35 class VcFrame_AboutBox extends JDialog implements ActionListener { 36 37 JPanel panel1 = new JPanel(); 38 JPanel panel2 = new JPanel(); 39 JPanel insetsPanel1 = new JPanel(); 40 JPanel insetsPanel2 = new JPanel(); 41 JPanel insetsPanel3 = new JPanel(); 42 JButton button1 = new JButton(); 43 JLabel imageLabel = new JLabel(); 44 JLabel label1 = new JLabel(); 45 JLabel label2 = new JLabel(); 46 JLabel label3 = new JLabel(); 47 JLabel label4 = new JLabel(); 48 BorderLayout borderLayout1 = new BorderLayout(); 49 BorderLayout borderLayout2 = new BorderLayout(); 50 FlowLayout flowLayout1 = new FlowLayout(); 51 GridLayout gridLayout1 = new GridLayout(); 52 String product = "Virtual Mockup for Machine Vision"; 53 String version = "v1.0"; 54 String copyright = "Copyright (c) 2001-2003 F. R. Miranda, J. E. Kogler Jr, C. S. Santos"; 55 String comments = "Funded by SENAC-SP"; 56 57 /*** Creates about box. */ 58 public VcFrame_AboutBox(Frame parent) { 59 super(parent); 60 enableEvents(AWTEvent.WINDOW_EVENT_MASK); 61 try { 62 jbInit(); 63 } 64 catch(Exception e) { 65 e.printStackTrace(); 66 } 67 pack(); 68 } 69 /***Component initialization.*/ 70 private void jbInit() throws Exception { 71 //imageLabel.setIcon(new ImageIcon(VcFrame_AboutBox.class.getResource("[Your Image]"))); 72 this.setTitle("About"); 73 setResizable(false); 74 panel1.setLayout(borderLayout1); 75 panel2.setLayout(borderLayout2); 76 insetsPanel1.setLayout(flowLayout1); 77 insetsPanel2.setLayout(flowLayout1); 78 insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); 79 gridLayout1.setRows(4); 80 gridLayout1.setColumns(1); 81 label1.setText(product); 82 label2.setText(version); 83 label3.setText(copyright); 84 label4.setText(comments); 85 insetsPanel3.setLayout(gridLayout1); 86 insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10)); 87 button1.setText("Ok"); 88 button1.addActionListener(this); 89 insetsPanel2.add(imageLabel, null); 90 panel2.add(insetsPanel2, BorderLayout.WEST); 91 this.getContentPane().add(panel1, null); 92 insetsPanel3.add(label1, null); 93 insetsPanel3.add(label2, null); 94 insetsPanel3.add(label3, null); 95 insetsPanel3.add(label4, null); 96 panel2.add(insetsPanel3, BorderLayout.CENTER); 97 insetsPanel1.add(button1, null); 98 panel1.add(insetsPanel1, BorderLayout.SOUTH); 99 panel1.add(panel2, BorderLayout.NORTH); 100 } 101 102 /***Overridden so we can exit when window is closed*/ 103 protected void processWindowEvent(WindowEvent e) { 104 if (e.getID() == WindowEvent.WINDOW_CLOSING) { 105 cancel(); 106 } 107 super.processWindowEvent(e); 108 } 109 110 /***Closes the dialog*/ 111 void cancel() { 112 dispose(); 113 } 114 /***Closes the dialog on a button event*/ 115 public void actionPerformed(ActionEvent e) { 116 if (e.getSource() == button1) { 117 cancel(); 118 } 119 } 120 }

This page was automatically generated by Maven