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 camera3d.*;
26 import camera3d.test.*;
27
28
29 /***
30 *
31 * @author Fábio Roberto de Miranda
32 */
33
34 class SelectionListTesterFrame extends JFrame {
35 private JPanel contentPane;
36 private JMenuBar jMenuBar1 = new JMenuBar();
37 private JMenu jMenuFile = new JMenu();
38 private JMenuItem jMenuFileExit = new JMenuItem();
39 private JMenu jMenuHelp = new JMenu();
40 private JMenuItem jMenuHelpAbout = new JMenuItem();
41 private JToolBar jToolBar = new JToolBar();
42 private JButton jButton1 = new JButton();
43 private JButton jButton2 = new JButton();
44 private JButton jButton3 = new JButton();
45 private ImageIcon image1;
46 private ImageIcon image2;
47 private ImageIcon image3;
48 private JLabel statusBar = new JLabel();
49 private SelectionListPane selectionListPane1 = new SelectionListPane();
50 private JScrollPane jScrollPane1 = new JScrollPane(selectionListPane1);
51 private BorderLayout borderLayout1 = new BorderLayout();
52
53
54 /***Construct the frame*/
55 public SelectionListTesterFrame() {
56 enableEvents(AWTEvent.WINDOW_EVENT_MASK);
57 try {
58 jbInit();
59 }
60 catch(Exception e) {
61 e.printStackTrace();
62 }
63 }
64
65 /***Component initialization*/
66 private void jbInit() throws Exception {
67 image1 = new ImageIcon(camera3d.gui.SelectionListTesterFrame.class.getResource("openFile.gif"));
68 image2 = new ImageIcon(camera3d.gui.SelectionListTesterFrame.class.getResource("closeFile.gif"));
69 image3 = new ImageIcon(camera3d.gui.SelectionListTesterFrame.class.getResource("help.gif"));
70 //setIconImage(Toolkit.getDefaultToolkit().createImage(SelectionListTesterFrame.class.getResource("[Your Icon]")));
71 contentPane = (JPanel) this.getContentPane();
72 contentPane.setPreferredSize(new Dimension(200, 300));
73 contentPane.setMinimumSize(new Dimension(200, 300));
74 contentPane.setLayout(borderLayout1);
75 this.setSize(new Dimension(200, 300));
76 this.setTitle("Testing Selection List");
77 statusBar.setText(" ");
78 jMenuFile.setText("File");
79 jMenuFileExit.setText("Exit");
80 jMenuFileExit.addActionListener(new ActionListener() {
81 public void actionPerformed(ActionEvent e) {
82 jMenuFileExit_actionPerformed(e);
83 }
84 });
85 jMenuHelp.setText("Help");
86 jMenuHelpAbout.setText("About");
87 jMenuHelpAbout.addActionListener(new ActionListener() {
88 public void actionPerformed(ActionEvent e) {
89 jMenuHelpAbout_actionPerformed(e);
90 }
91 });
92 jButton1.setIcon(image1);
93 jButton1.setToolTipText("Open File");
94 jButton2.setIcon(image2);
95 jButton2.addActionListener(new java.awt.event.ActionListener() {
96 public void actionPerformed(ActionEvent e) {
97 jButton2_actionPerformed(e);
98 }
99 });
100 jButton2.setToolTipText("Close File");
101 jButton3.setIcon(image3);
102 jButton3.addActionListener(new java.awt.event.ActionListener() {
103 public void actionPerformed(ActionEvent e) {
104 jButton3_actionPerformed(e);
105 }
106 });
107 jButton3.setToolTipText("Help");
108 // selectionListPane1.setBackground(Color.cyan);
109 jMenuFile.add(jMenuFileExit);
110 jMenuHelp.add(jMenuHelpAbout);
111 jMenuBar1.add(jMenuFile);
112 jMenuBar1.add(jMenuHelp);
113 this.setJMenuBar(jMenuBar1);
114 contentPane.add(statusBar, BorderLayout.SOUTH);
115 contentPane.add(jScrollPane1, BorderLayout.CENTER);
116 contentPane.add(jToolBar, BorderLayout.NORTH);
117 jToolBar.add(jButton1);
118 jToolBar.add(jButton2);
119 jToolBar.add(jButton3);
120 //jScrollPane1.getViewport().add(selectionListPane1, BorderLayout.CENTER);
121 }
122 /***File | Exit action performed*/
123 public void jMenuFileExit_actionPerformed(ActionEvent e) {
124 System.exit(0);
125 }
126 /***Help | About action performed*/
127 public void jMenuHelpAbout_actionPerformed(ActionEvent e) {
128 SelectionListTesterFrame_AboutBox dlg = new SelectionListTesterFrame_AboutBox(this);
129 Dimension dlgSize = dlg.getPreferredSize();
130 Dimension frmSize = getSize();
131 Point loc = getLocation();
132 dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
133 dlg.setModal(true);
134 dlg.show();
135 }
136 /***Overridden so we can exit when window is closed*/
137 protected void processWindowEvent(WindowEvent e) {
138 super.processWindowEvent(e);
139 if (e.getID() == WindowEvent.WINDOW_CLOSING) {
140 jMenuFileExit_actionPerformed(null);
141 }
142 }
143
144 public SelectionListPane getSelectionPane(){
145 return this.selectionListPane1;
146 }
147
148 public void debugln(String s){
149 if (GUIControl.debugflag){
150 System.out.println(s);
151 }
152
153 }
154
155 void jButton3_actionPerformed(ActionEvent e) {
156
157 }
158
159 void jButton2_actionPerformed(ActionEvent e) {
160
161 }
162 }
This page was automatically generated by Maven