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; 21 22 import java.awt.*; 23 import java.awt.event.*; 24 import javax.swing.*; 25 26 class VcTesterFrame extends JFrame { 27 JPanel contentPane; 28 VirtualCamera virtualCamera1 = new VirtualCamera(); 29 private JButton initBtn = new JButton(); 30 private JTextField camTxt = new JTextField(); 31 private JTextField objTxt = new JTextField(); 32 private JButton lookAtBtn = new JButton(); 33 34 /***Construct the frame*/ 35 public VcTesterFrame() { 36 enableEvents(AWTEvent.WINDOW_EVENT_MASK); 37 try { 38 jbInit(); 39 } 40 catch(Exception e) { 41 e.printStackTrace(); 42 } 43 } 44 /***Component initialization*/ 45 private void jbInit() throws Exception { 46 //setIconImage(Toolkit.getDefaultToolkit().createImage(VcTesterFrame.class.getResource("[Your Icon]"))); 47 contentPane = (JPanel) this.getContentPane(); 48 contentPane.setLayout(null); 49 this.setSize(new Dimension(301, 219)); 50 this.setTitle("TesterFrame"); 51 virtualCamera1.setBounds(new Rectangle(10, 10, 154, 40)); 52 initBtn.setText("Initialize"); 53 initBtn.setBounds(new Rectangle(175, 12, 110, 36)); 54 initBtn.addActionListener(new java.awt.event.ActionListener() { 55 public void actionPerformed(ActionEvent e) { 56 initBtn_actionPerformed(e); 57 } 58 }); 59 camTxt.setText("camera"); 60 camTxt.setBounds(new Rectangle(23, 95, 87, 23)); 61 objTxt.setText("objeto"); 62 objTxt.setBounds(new Rectangle(23, 124, 88, 23)); 63 lookAtBtn.setText("lookAt"); 64 lookAtBtn.setBounds(new Rectangle(126, 95, 77, 31)); 65 lookAtBtn.addActionListener(new java.awt.event.ActionListener() { 66 public void actionPerformed(ActionEvent e) { 67 lookAtBtn_actionPerformed(e); 68 } 69 }); 70 contentPane.add(virtualCamera1, null); 71 contentPane.add(initBtn, null); 72 contentPane.add(camTxt, null); 73 contentPane.add(objTxt, null); 74 contentPane.add(lookAtBtn, null); 75 } 76 /***Overridden so we can exit when window is closed*/ 77 protected void processWindowEvent(WindowEvent e) { 78 super.processWindowEvent(e); 79 if (e.getID() == WindowEvent.WINDOW_CLOSING) { 80 System.exit(0); 81 } 82 } 83 84 void initBtn_actionPerformed(ActionEvent e) { 85 virtualCamera1.initialize(0); 86 } 87 88 void lookAtBtn_actionPerformed(ActionEvent e) { 89 virtualCamera1.lookAt(camTxt.getText(), objTxt.getText()); 90 } 91 }

This page was automatically generated by Maven