Beispiel #1
0
 private JPanel createTargetPanel() {
   JPanel p = new JPanel();
   p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
   _tarOffsetPane =
       new PatternPaneTargetOffset(_simg, _imgBtn.getFilename(), _imgBtn.getTargetOffset());
   createMarginBox(p, _tarOffsetPane);
   p.add(Box.createVerticalStrut(5));
   p.add(_tarOffsetPane.createControls());
   p.add(Box.createVerticalStrut(5));
   p.add(msgApplied[tabSequence]);
   p.doLayout();
   return p;
 }
Beispiel #2
0
 private void actionPerformedUpdates(Window _parent) {
   boolean tempDirty = isDirty();
   if (paneNaming.isDirty()) {
     String filename = paneNaming.getAbsolutePath();
     String oldFilename = _imgBtn.getFilename();
     if (FileManager.exists(filename)) {
       String name = FileManager.getName(filename);
       int ret =
           JOptionPane.showConfirmDialog(
               _parent,
               SikuliIDEI18N._I("msgFileExists", name),
               SikuliIDEI18N._I("dlgFileExists"),
               JOptionPane.WARNING_MESSAGE,
               JOptionPane.YES_NO_OPTION);
       if (ret != JOptionPane.YES_OPTION) {
         return;
       }
     }
     try {
       FileManager.xcopy(oldFilename, filename, null);
       (new File(oldFilename)).delete();
       _imgBtn.setFilename(filename);
     } catch (IOException ioe) {
       Debug.error("renaming failed: " + oldFilename + " " + filename);
       Debug.error(ioe.getMessage());
     }
     paneNaming.updateFilename();
     addDirty(true);
   }
   addDirty(
       _imgBtn.setParameters(
           _screenshot.isExact(), _screenshot.getSimilarity(), _screenshot.getNumMatches()));
   addDirty(_imgBtn.setTargetOffset(_tarOffsetPane.getTargetOffset()));
   Debug.log(2, "update: " + _imgBtn.toString());
   if (isDirty() || tempDirty) {
     int i = _imgBtn.getWindow().getTabbedPane().getSelectedIndex();
     _imgBtn.getWindow().setMessageApplied(i, true);
     _imgBtn.repaint();
   }
 }
Beispiel #3
0
 public void setTargetOffset(Location offset) {
   if (offset != null) {
     _tarOffsetPane.setTarget(offset.x, offset.y);
   }
 }