Package javax.swing

Examples of javax.swing.DesktopManager


        setEnabled(false);
    }

    public void actionPerformed(final ActionEvent e) {
        final JInternalFrame[] frames = gcViewer.getDesktopPane().getAllFrames();
        final DesktopManager desktopManager = gcViewer.getDesktopPane().getDesktopManager();
        for (int i=0; i<frames.length; i++) {
            final JInternalFrame frame = frames[i];
            desktopManager.deiconifyFrame(frame);
            try {
                frame.setMaximum(false);
            } catch (PropertyVetoException e1) {
                e1.printStackTrace();
            }
            final int height = gcViewer.getDesktopPane().getHeight()/frames.length;
            desktopManager.setBoundsForFrame(frame, 0, height * i, gcViewer.getDesktopPane().getWidth(), height);
        }
    }
View Full Code Here


    /*
     * Class under test for DesktopManager createDesktopManager()
     */
    public void testCreateDesktopManager() {
        DesktopManager manager1 = ui.createDesktopManager();
        assertTrue("not null", manager1 != null);
        DesktopManager manager2 = ui.createDesktopManager();
        assertTrue("other object", manager1 != manager2);
    }
View Full Code Here

     * Class under test for DesktopManager getDesktopManager()
     */
    public void testGetDesktopManager() {
        frame.setUI(ui);
        // no desktop pane, the default desktop manager is created
        DesktopManager manager1 = ui.getDesktopManager();
        assertTrue("not null", manager1 != null);
        DesktopManager manager2 = ui.getDesktopManager();
        assertTrue("the same object", manager1 == manager2);
        assertNull("no desktop pane", frame.getDesktopPane());
        // the desktop pane is set
        JDesktopPane desktop = new JDesktopPane();
        desktop.add(frame);
View Full Code Here

    /*
     * Class under test for DesktopManager createDesktopManager()
     */
    public void testCreateDesktopManager() {
        DesktopManager manager1 = ui.createDesktopManager();
        assertTrue("not null", manager1 != null);
        DesktopManager manager2 = ui.createDesktopManager();
        assertTrue("other object", manager1 != manager2);
    }
View Full Code Here

   *
   * @return The DesktopManager to use with the JInternalFrame.
   */
  protected DesktopManager getDesktopManager()
  {
    DesktopManager value = null;
    JDesktopPane pane = frame.getDesktopPane();
    if (pane != null)
      value = frame.getDesktopPane().getDesktopManager();
    if (value == null)
      value = createDesktopManager();
View Full Code Here

    {
      // If the frame is maximized, there is nothing that
      // can be dragged around.
      if (frame.isMaximum())
        return;
      DesktopManager dm = getDesktopManager();
      Rectangle b = frame.getBounds();
      Dimension min = frame.getMinimumSize();
      if (min == null)
        min = new Dimension(0, 0);
      Insets insets = frame.getInsets();
      int x = e.getX();
      int y = e.getY();
      if (e.getSource() == frame && frame.isResizable())
        {
          switch (direction)
            {
            case Cursor.N_RESIZE_CURSOR:
              cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height
                                                         - min.height),
                                  b.width, b.height - y);
              break;
            case Cursor.NE_RESIZE_CURSOR:
              cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height
                                                         - min.height), x + 1,
                                  b.height - y);
              break;
            case Cursor.E_RESIZE_CURSOR:
              cacheRect.setBounds(b.x, b.y, x + 1, b.height);
              break;
            case Cursor.SE_RESIZE_CURSOR:
              cacheRect.setBounds(b.x, b.y, x + 1, y + 1);
              break;
            case Cursor.S_RESIZE_CURSOR:
              cacheRect.setBounds(b.x, b.y, b.width, y + 1);
              break;
            case Cursor.SW_RESIZE_CURSOR:
              cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
                                  b.y, b.width - x, y + 1);
              break;
            case Cursor.W_RESIZE_CURSOR:
              cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
                                  b.y, b.width - x, b.height);
              break;
            case Cursor.NW_RESIZE_CURSOR:
              cacheRect.setBounds(
                                  Math.min(b.x + x, b.x + b.width - min.width),
                                  Math.min(b.y + y, b.y + b.height - min.height),
                                  b.width - x, b.height - y);
              break;
            }
          dm.resizeFrame(frame, cacheRect.x, cacheRect.y,
                         Math.max(min.width, cacheRect.width),
                         Math.max(min.height, cacheRect.height));
          setCursor(e);
        }
      else if (e.getSource() == titlePane)
        {
          Rectangle fBounds = frame.getBounds();
          frame.putClientProperty("bufferedDragging", Boolean.TRUE);
          dm.dragFrame(frame, e.getX() - xOffset + b.x, e.getY() - yOffset
                                                        + b.y);
        }
    }
View Full Code Here

     * @param e The MouseEvent.
     */
    public void mousePressed(MouseEvent e)
    {
      activateFrame(frame);
      DesktopManager dm = getDesktopManager();
      int x = e.getX();
      int y = e.getY();
      Insets insets = frame.getInsets();

      if (e.getSource() == frame && frame.isResizable())
        {
          direction = sectionOfClick(x, y);
          dm.beginResizingFrame(frame, direction);
        }
      else if (e.getSource() == titlePane)
        {
          Rectangle tBounds = titlePane.getBounds();

          xOffset = e.getX() - tBounds.x + insets.left;
          yOffset = e.getY() - tBounds.y + insets.top;

          dm.beginDraggingFrame(frame);
        }
    }
View Full Code Here

     *
     * @param e The MouseEvent.
     */
    public void mouseReleased(MouseEvent e)
    {
      DesktopManager dm = getDesktopManager();
      xOffset = 0;
      yOffset = 0;
      if (e.getSource() == frame && frame.isResizable())
        dm.endResizingFrame(frame);
      else if (e.getSource() == titlePane)
        {
          dm.endDraggingFrame(frame);
          frame.putClientProperty("bufferedDragging", null);
        }

      setCursor(e);
    }
View Full Code Here

TOP

Related Classes of javax.swing.DesktopManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.