예제 #1
0
  private void cascata(JInternalFrame jIFrame, JInternalFrame jIFrameAnt) {

    if (dPane.getAllFrames().length > 0) {
      if (autoManager) {
        maxX = dPane.getWidth() - jIFrame.getWidth();
        maxY = dPane.getHeight() - jIFrame.getHeight();
        minX = 0;
        minY = 0;
      }
      if (jIFrameAnt.getY() < maxY) {
        y = jIFrameAnt.getY() + distanceXY;
      } else {
        y = minY;
      }
      if (jIFrameAnt.getX() < maxX) {

        x = jIFrameAnt.getX() + distanceXY;

      } else {
        x = minX;
        y = minY;
      }
    } else {
      x = minX;
      y = minY;
    }
  }
예제 #2
0
 /** sort frames top-down-left-right */
 private void handleSwingTabAction(int delta) {
   JInternalFrame[] frames = getSwingDesktopPane().getAllFrames();
   TreeMap<Integer, JInternalFrame> sortedMap = new TreeMap<Integer, JInternalFrame>();
   for (JInternalFrame f : frames) {
     if (f.isVisible()) {
       int tabIndex = f.getX() * 100000 + f.getY();
       if (delta < 0) {
         tabIndex = -tabIndex;
       }
       sortedMap.put(tabIndex, f);
     }
   }
   JInternalFrame next = null;
   if (sortedMap.size() > 0) {
     ArrayList<JInternalFrame> list = new ArrayList<JInternalFrame>(sortedMap.values());
     int nextIndex = 0;
     JInternalFrame selectedFrame = getSwingDesktopPane().getSelectedFrame();
     if (selectedFrame != null) {
       nextIndex = (list.indexOf(selectedFrame) + 1) % list.size();
     }
     next = list.get(nextIndex);
   }
   if (next != null) {
     try {
       next.setSelected(true);
     } catch (PropertyVetoException ve) {
     }
   }
 }
예제 #3
0
 public void saveFrameConfiguration() {
   String frameTitle = jif.getTitle();
   pref.putInt(frameTitle + posXPreferenceKey, jif.getX());
   pref.putInt(frameTitle + posYPreferenceKey, jif.getY());
   pref.putInt(frameTitle + sizeXPreferenceKey, jif.getSize().width);
   pref.putInt(frameTitle + sizeYPreferenceKey, jif.getSize().height);
   pref.putBoolean(frameTitle + isVisiblePreferenceKey, jif.isVisible());
 }
예제 #4
0
  public void loadFrameConfiguration() {
    jif.setBounds(
        pref.getInt(jif.getTitle() + posXPreferenceKey, jif.getX()),
        pref.getInt(jif.getTitle() + posYPreferenceKey, jif.getY()),
        pref.getInt(jif.getTitle() + sizeXPreferenceKey, jif.getWidth()),
        pref.getInt(jif.getTitle() + sizeYPreferenceKey, jif.getHeight()));

    try {
      jif.setVisible(pref.getBoolean(jif.getTitle() + isVisiblePreferenceKey, true));
    } catch (Exception e) {
      System.err.println("failed setting JInternalFrame to visible/invisible");
      e.printStackTrace();
    }
  }
예제 #5
0
  private void saveSettings() {
    if (localSettings != null) {
      localSettings.objectDirectory = levelHolder.getPalette().getDirectoryPath();

      localSettings.mainWidth = this.getWidth();
      localSettings.mainHeight = this.getHeight();

      localSettings.paletteX = palette.getX();
      localSettings.paletteY = palette.getY();
      localSettings.paletteWidth = palette.getWidth();
      localSettings.paletteHeight = palette.getHeight();

      localSettings.levelHolderX = levelHolderFrame.getX();
      localSettings.levelHolderY = levelHolderFrame.getY();
      localSettings.levelHolderWidth = levelHolderFrame.getWidth();
      localSettings.levelHolderHeight = levelHolderFrame.getHeight();

      localSettings.store();
    } else {
      localSettings = new LocalSettings();
    }
  }