Пример #1
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();
    }
  }
Пример #2
0
 public ButtonBar addButtonBar(JInternalFrame iaf) {
   ButtonBar bb = new ButtonBar(this, iaf, iaf.getTitle());
   bar.add(bb);
   bBar.add(bb);
   activeButton(bb);
   return bb;
 }
Пример #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 String getTitle() {
   if (f != null) {
     return f.getTitle();
   } else if (d != null) {
     return d.getTitle();
   } else if (jif != null) {
     return jif.getTitle();
   } else {
     return null; // throw new IllegalStateException();
   }
 }
Пример #5
0
 private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {
   JInternalFrame internalFrame = api.desktopPane.getSelectedFrame();
   String aux = internalFrame.getTitle();
   int pos = 0;
   for (int i = 0; i < api.imagenes.size(); i++) {
     if (aux == api.imagenes.get(i).internalFrame.getTitle()) {
       pos = i;
     }
   }
   //		JOptionPane.showMessageDialog(new JFrame(), pos);
   ProcesamientoImagen imagenSalida = new ProcesamientoImagen();
   imagenSalida.imageActual = api.imagenes.get(pos).imagenReal;
   imagenSalida.guardarImagen();
 }
Пример #6
0
  private void updateMenuWindow() {
    JMenuItem itemCascade =
        new JMenuItem(Messages.getString("CookbookJXFrame.itemCascade")); // $NON-NLS-1$
    itemCascade.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            int step = 15;
            int x = step;
            int y = step;

            double dw = desktop.getSize().getWidth();
            double dh = desktop.getSize().getHeight();

            for (final JInternalFrame jif : DesktopManager.get().getAllWindows()) {
              double w = jif.getSize().getWidth();
              double h = jif.getSize().getHeight();

              if (x + w > dw) {
                x = step;
              }

              if (y + h > dh) {
                y = step;
              }

              jif.setLocation(x, y);

              x += step;
              y += step;
            }
          }
        });

    JMenuItem itemReduceAll =
        new JMenuItem(Messages.getString("CookbookJXFrame.itemReduceAll")); // $NON-NLS-1$
    itemReduceAll.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            for (final JInternalFrame jif : DesktopManager.get().getAllWindows()) {
              try {
                jif.setIcon(true);
              } catch (PropertyVetoException e1) {
              }
            }
          }
        });

    JMenuItem itemShowAll =
        new JMenuItem(Messages.getString("CookbookJXFrame.itemShowAll")); // $NON-NLS-1$
    itemShowAll.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            for (final JInternalFrame jif : DesktopManager.get().getAllWindows()) {
              try {
                jif.setIcon(false);
              } catch (PropertyVetoException e1) {
              }
            }
          }
        });

    menuWindow.removeAll();
    menuWindow.add(itemCascade);
    menuWindow.add(itemReduceAll);
    menuWindow.add(itemShowAll);
    menuWindow.addSeparator();

    int index = 1;
    for (final JInternalFrame jif : DesktopManager.get().getAllWindows()) {
      String item = index++ + ": " + jif.getTitle(); // $NON-NLS-1$
      JMenuItem menuItem = new JMenuItem(item);
      menuItem.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              try {
                jif.setSelected(true);
                if (jif.isIcon()) {
                  jif.setIcon(false);
                }
              } catch (PropertyVetoException e1) {
              }
            }
          });
      menuWindow.add(menuItem);
    }
  }
Пример #7
0
 /**
  * Constructor for the ChildMenuItem object
  *
  * @param frame Description of the Parameter
  */
 public ChildMenuItem(JInternalFrame frame) {
   super(frame.getTitle());
   this.frame = frame;
 }
Пример #8
0
 /** Run the task. */
 public void run() {
   final BoundedRangeModel model = progressBar.getModel();
   switch (task) {
     case -LABEL:
       {
         value = description.getText();
         return;
       }
     case +LABEL:
       {
         description.setText((String) value);
         return;
       }
     case PROGRESS:
       {
         model.setValue(((Integer) value).intValue());
         progressBar.setIndeterminate(false);
         return;
       }
     case STARTED:
       {
         model.setRangeProperties(0, 1, 0, 100, false);
         window.setVisible(true);
         break; // Need further action below.
       }
     case COMPLETE:
       {
         model.setRangeProperties(100, 1, 0, 100, false);
         window.setVisible(warningArea != null);
         cancel.setEnabled(false);
         break; // Need further action below.
       }
   }
   /*
    * Some of the tasks above requires an action on the window, which may be a JDialog or
    * a JInternalFrame. We need to determine the window type before to apply the action.
    */
   synchronized (ProgressWindow.this) {
     if (window instanceof JDialog) {
       final JDialog window = (JDialog) ProgressWindow.this.window;
       switch (task) {
         case -TITLE:
           {
             value = window.getTitle();
             return;
           }
         case +TITLE:
           {
             window.setTitle((String) value);
             return;
           }
         case STARTED:
           {
             window.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
             return;
           }
         case COMPLETE:
           {
             window.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
             return;
           }
         case DISPOSE:
           {
             window.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
             if (warningArea == null || !window.isVisible()) {
               window.dispose();
             }
             return;
           }
       }
     } else {
       final JInternalFrame window = (JInternalFrame) ProgressWindow.this.window;
       switch (task) {
         case -TITLE:
           {
             value = window.getTitle();
             return;
           }
         case +TITLE:
           {
             window.setTitle((String) value);
             return;
           }
         case STARTED:
           {
             window.setClosable(false);
             return;
           }
         case COMPLETE:
           {
             window.setClosable(true);
             return;
           }
         case DISPOSE:
           {
             window.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
             if (warningArea == null || !window.isVisible()) {
               window.dispose();
             }
             return;
           }
       }
     }
     /*
      * Si la tâche spécifiée n'est aucune des tâches énumérées ci-haut,
      * on supposera que l'on voulait afficher un message d'avertissement.
      */
     if (warningArea == null) {
       final JTextArea warningArea = new JTextArea();
       final JScrollPane scroll = new JScrollPane(warningArea);
       final JPanel namedArea = new JPanel(new BorderLayout());
       ProgressWindow.this.warningArea = warningArea;
       warningArea.setFont(Font.getFont("Monospaced"));
       warningArea.setEditable(false);
       namedArea.setBorder(BorderFactory.createEmptyBorder(0, HMARGIN, VMARGIN, HMARGIN));
       namedArea.add(new JLabel(getString(VocabularyKeys.WARNING)), BorderLayout.NORTH);
       namedArea.add(scroll, BorderLayout.CENTER);
       content.add(namedArea, BorderLayout.CENTER);
       if (window instanceof JDialog) {
         final JDialog window = (JDialog) ProgressWindow.this.window;
         window.setResizable(true);
       } else {
         final JInternalFrame window = (JInternalFrame) ProgressWindow.this.window;
         window.setResizable(true);
       }
       window.setSize(WIDTH, HEIGHT + WARNING_HEIGHT);
       window.setVisible(true); // Seems required in order to force relayout.
     }
     final JTextArea warningArea = (JTextArea) ProgressWindow.this.warningArea;
     warningArea.append((String) value);
   }
 }
 /**
  * Simple constructor.
  *
  * @param f Associated internal frame.
  */
 public SubstanceInternalFrameTitlePane(JInternalFrame f) {
   super(f);
   this.setToolTipText(f.getTitle());
   SubstanceLookAndFeel.setDecorationType(this, DecorationAreaType.SECONDARY_TITLE_PANE);
 }