~ubuntu-branches/ubuntu/utopic/sikuli/utopic

« back to all changes in this revision

Viewing changes to sikuli-ide/src/main/java/org/sikuli/ide/PatternWindow.java

  • Committer: Bazaar Package Importer
  • Author(s): Gilles Filippini
  • Date: 2011-10-04 23:32:13 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20111004233213-36fm78hx0z53tkuw
Tags: 1.0~x~rc3-dfsg1-2
* New patch fix-cmake-sikuli-ide.patch:
  + Fix random FTBFS due to missing inter target dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010-2011, Sikuli.org
 
3
 * Released under the MIT License.
 
4
 *
 
5
 */
1
6
package org.sikuli.ide;
2
7
 
3
8
import java.io.*;
16
21
import org.sikuli.script.UnionScreen;
17
22
 
18
23
 
19
 
public class PatternWindow extends JFrame implements Observer {
 
24
public class PatternWindow extends JFrame {
20
25
 
21
26
   private ImageButton _imgBtn;
22
27
   private ScreenshotPane _screenshot;
26
31
   private JTabbedPane tabPane;
27
32
   private JPanel paneTarget, panePreview;
28
33
 
29
 
   private JPanel glass;
30
34
   private ScreenImage _simg;
31
35
 
32
36
   static String _I(String key, Object... args){ 
47
51
      c.setLayout(new BorderLayout());
48
52
 
49
53
      tabPane = new JTabbedPane();
50
 
      //tabPane.setPreferredSize(new Dimension(500,300));
 
54
      tabPane.setPreferredSize(new Dimension(790,700));
51
55
      paneTarget = createTargetPanel();
52
56
      panePreview = createPrewviewPanel();
53
57
      _namingPane = new NamingPane(_imgBtn);
60
64
      c.doLayout();
61
65
      pack();
62
66
 
 
67
      setVisible(true);
63
68
      init(exact, similarity, numMatches);
64
 
 
65
 
      setVisible(true);
66
69
   }
67
70
 
68
71
   void takeScreenshot(){
114
117
 
115
118
   private void createScreenshots(Container c){
116
119
      _screenshot = new ScreenshotPane(_simg);
117
 
      _screenshot.addObserver(this);
 
120
      //_screenshot.addObserver(this);
118
121
      createMarginBox(c, _screenshot);
119
122
   }
120
123
 
138
141
      JButton btnCancel = new JButton(_I("cancel"));
139
142
      btnCancel.addActionListener(new ActionCancel(this));
140
143
 
141
 
      ImageIcon loadingIcon = new ImageIcon(
142
 
            SikuliIDE.class.getResource("/icons/loading.gif"));
143
 
      JLabel lblLoading = new JLabel(loadingIcon);
144
 
 
145
 
      glass = (JPanel)getGlassPane();
146
 
      glass.setLayout(new BorderLayout());
147
 
      glass.add(lblLoading, BorderLayout.CENTER);
148
 
      glass.setVisible(true);
149
 
 
150
144
      GridBagConstraints c = new GridBagConstraints();
151
145
 
152
146
      c.gridy = 3;
161
155
   }
162
156
 
163
157
 
164
 
   public void update(Subject s){
165
 
      glass.setVisible(false);
166
 
   }
167
 
 
168
158
   public void setTargetOffset(Location offset){
169
159
      if(offset != null)
170
160
         _tarOffsetPane.setTarget(offset.x, offset.y);
204
194
               _screenshot.isExact(), _screenshot.getSimilarity(),
205
195
               _screenshot.getNumMatches());
206
196
         _imgBtn.setTargetOffset( _tarOffsetPane.getTargetOffset() );
207
 
         Debug.info("update :" + _imgBtn.toString());
 
197
         Debug.log("update: " + _imgBtn.toString());
208
198
         _parent.dispose();
209
199
      }
210
200
   }