Java DesktopManager类代码示例

本文整理汇总了Java中javax.swing.DesktopManager的典型用法代码示例。如果您正苦于以下问题:Java DesktopManager类的具体用法?Java DesktopManager怎么用?Java DesktopManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java DesktopManager类代码示例

DesktopManager类属于javax.swing包,在下文中一共展示了DesktopManager类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setMaximized

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * Maximise the Project-Window within the AgenGUI-Application
 */
public void setMaximized() {

	MainWindow mainWindow = Application.getMainWindow();
	if (mainWindow != null) {
		// --- Validate the main application window -----------------
		mainWindow.validate();
		// --- Be sure that everything is there as needed -----------
		if (this.getParent() != null) {
			((BasicInternalFrameUI) this.getUI()).setNorthPane(null);
			DesktopManager dtm = mainWindow.getJDesktopPane4Projects().getDesktopManager();
			if (dtm != null) {
				dtm.maximizeFrame(this);
			}
		}
		mainWindow.setCloseButtonPosition(true);
	}
} 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:ProjectWindow.java

示例2: tabMaximize

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * Tab maximize.
 */
private void tabMaximize() {

	// --- Maximize the main window ---------------------------------------
	// Application.getMainWindow().setExtendedState(JFrame.MAXIMIZED_BOTH);

	// --- Open a new JInteraFrame with the current tab enlarged ----------
	SwingUtilities.invokeLater(new Runnable() {
		@Override
		public void run() {
			JDesktopPane appDesktop = Application.getMainWindow().getJDesktopPane4Projects();
			if (maxTab == null) {
				appDesktop.add(getMaximizedTab());
				Application.getMainWindow().addJToolbarComponent(getMaximizedTab().getJButtonRestore4MainToolBar());
			}

			DesktopManager dtm = Application.getMainWindow().getJDesktopPane4Projects().getDesktopManager();
			if (dtm != null) {
				dtm.activateFrame(getMaximizedTab());
				dtm.maximizeFrame(getMaximizedTab());
			}
		}
	});
} 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:27,代码来源:ProjectWindow.java

示例3: mousePressed

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * This method is called when the mouse is pressed.
 *
 * @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);
    }
} 
开发者ID:vilie,项目名称:javify,代码行数:29,代码来源:BasicInternalFrameUI.java

示例4: mouseReleased

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * This method is called when the mouse is released.
 *
 * @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);
} 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:BasicInternalFrameUI.java

示例5: mousePressed

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * This method is called when the mouse is pressed.
 * 
 * @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);
    }
} 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:29,代码来源:BasicInternalFrameUI.java

示例6: mouseReleased

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * This method is called when the mouse is released.
 *
 * @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);
} 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:21,代码来源:BasicInternalFrameUI.java

示例7: testGetDesktopManager

import javax.swing.DesktopManager; //导入依赖的package包/类
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);
    manager2 = ui.getDesktopManager();
    assertTrue("not null", manager2 != null);
    assertTrue("is taken from desktop pane", manager2 == frame.getDesktopPane()
            .getDesktopManager());
    assertTrue("another object", manager2 != manager1);
} 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:BasicInternalFrameUITest.java

示例8: getDesktopManager

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * This method returns the DesktopManager to use with the JInternalFrame.
 *
 * @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();
  return value;
} 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:BasicInternalFrameUI.java

示例9: getDesktopManager

import javax.swing.DesktopManager; //导入依赖的package包/类
protected DesktopManager getDesktopManager() {
    JDesktopPane desktop = frame.getDesktopPane();
    if (desktop != null) {
        return desktop.getDesktopManager();
    }

    if (defaultDesktopManager == null) {
        defaultDesktopManager = createDesktopManager();
    }
    return defaultDesktopManager;
} 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:BasicInternalFrameUI.java

示例10: mouseDragged

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * This method is called when the mouse is dragged. This method is
 * responsible for resizing or dragging the JInternalFrame.
 *
 * @param e The MouseEvent.
 */
public void mouseDragged(MouseEvent e)
{
  // 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);
    }
} 
开发者ID:vilie,项目名称:javify,代码行数:72,代码来源:BasicInternalFrameUI.java

示例11: autoScrollingStep

import javax.swing.DesktopManager; //导入依赖的package包/类
protected void autoScrollingStep(AutoScrollTimerTask asTask) {
    if (autoscrollingPane != null && autoscrollingDirection != null && asTask != null) {
        JScrollPane lautoscrollingPane = autoscrollingPane;
        Component lviewComp = lautoscrollingPane.getViewport().getView();
        if (lviewComp instanceof JComponent) {
            JComponent lview = (JComponent) lviewComp;
            Point lautoscrollingDirection = autoscrollingDirection;
            Rectangle viewRect = lautoscrollingPane.getViewport().getViewRect();
            Rectangle viewRectBeforeMovement = (Rectangle) viewRect.clone();
            viewRect.translate(lautoscrollingDirection.x, lautoscrollingDirection.y);
            lview.scrollRectToVisible(viewRect);
            Rectangle viewRectAfterMovement = lautoscrollingPane.getViewport().getViewRect();
            lautoscrollingDirection.x = viewRectAfterMovement.x - viewRectBeforeMovement.x;
            lautoscrollingDirection.y = viewRectAfterMovement.y - viewRectBeforeMovement.y;
            if (lautoscrollingDirection.x != 0
                    || lautoscrollingDirection.y != 0) {
                MouseEvent e = asTask.getEvent();
                if (e != null && dragTarget != null) {
                    JDesktopPane ldp = null;
                    DesktopManager ldm = null;
                    JInternalFrame lif = null;
                    JDesktopIcon ldi = null;
                    lif = iifInternalFrame(dragTarget);
                    if (lif != null && lif.getDesktopPane() != null) {
                        ldp = lif.getDesktopPane();
                        ldm = ldp.getDesktopManager();
                    } else {
                        ldi = iifDesktopIcon(dragTarget);
                        if (ldi != null && ldi.getDesktopPane() != null) {
                            ldp = ldi.getDesktopPane();
                            ldm = ldp.getDesktopManager();
                        }
                    }
                    if (ldp != null && ldm != null && (lif != null || ldi != null)) {
                        MouseListener[] mlisteners = dragTarget.getMouseListeners();
                        MouseMotionListener[] mmlisteners = dragTarget.getMouseMotionListeners();
                        if (mlisteners != null && mmlisteners != null) {
                            ldp.setDesktopManager(dummyDesktopManager);
                            try {
                                for (int i = 0; i < mlisteners.length; i++) {
                                    mlisteners[i].mousePressed(cloneMouseEvent(e, dragTarget, e.getID(), dragTargetInnerPt));
                                }
                            } finally {
                                ldp.setDesktopManager(ldm);
                            }
                            asTask.incEvent(lautoscrollingDirection);
                            MouseEvent afterMoveE = asTask.getEvent();
                            Point afterMovePt = convertPoint(afterMoveE.getPoint(), dragTarget);
                            Dimension beforeDragSize = dragTarget.getSize();
                            int lbeforeWidth = dragTarget.getWidth();
                            int lbeforeHeight = dragTarget.getHeight();
                            for (int i = 0; i < mmlisteners.length; i++) {
                                mmlisteners[i].mouseDragged(cloneMouseEvent(e, dragTarget, e.getID(), afterMovePt));
                            }
                            Dimension afterDragSize = dragTarget.getSize();
                            if (beforeDragSize != null && afterDragSize != null && !beforeDragSize.equals(afterDragSize) && dragTarget != null && dragTarget instanceof JComponent) {
                                int ldx = afterDragSize.width - beforeDragSize.width;
                                int ldy = afterDragSize.height - beforeDragSize.height;
                                JComponent jDragTarget = (JComponent) dragTarget;
                                Insets insts = jDragTarget.getInsets();
                                if (dragTargetInnerPt.x >= lbeforeWidth - insts.right) {
                                    dragTargetInnerPt.x += ldx;
                                }
                                if (dragTargetInnerPt.y >= lbeforeHeight - insts.bottom) {
                                    dragTargetInnerPt.y += ldy;
                                }
                            }
                        }
                    }
                }
            }
        } else {
            cancelAutoScrolling();
        }
    }
} 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:77,代码来源:JScalablePanel.java

示例12: createDesktopManager

import javax.swing.DesktopManager; //导入依赖的package包/类
protected DesktopManager createDesktopManager() {
    return new DefaultDesktopManager();
} 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:BasicInternalFrameUI.java

示例13: testCreateDesktopManager

import javax.swing.DesktopManager; //导入依赖的package包/类
public void testCreateDesktopManager() {
    DesktopManager manager1 = ui.createDesktopManager();
    assertTrue("not null", manager1 != null);
    DesktopManager manager2 = ui.createDesktopManager();
    assertTrue("other object", manager1 != manager2);
} 
开发者ID:shannah,项目名称:cn1,代码行数:7,代码来源:BasicInternalFrameUITest.java

示例14: createDesktopManager

import javax.swing.DesktopManager; //导入依赖的package包/类
/**
 * This method returns a default DesktopManager that can be used with this
 * JInternalFrame.
 *
 * @return A default DesktopManager that can be used with this
 *         JInternalFrame.
 */
protected DesktopManager createDesktopManager()
{
  return new DefaultDesktopManager();
} 
开发者ID:vilie,项目名称:javify,代码行数:12,代码来源:BasicInternalFrameUI.java

本文标签属性:

示例:示例志愿表

代码:代码编程

java:javascript18岁

DesktopManager:DesktopManager

上一篇:如果捡到弃婴想抚养需要怎么办理(捡到弃婴可以自己抚养吗)(如果捡到弃婴可以自己抚养吗)
下一篇:价格和质量成正比叫什么值(你觉得质量与价格是什么关系?)(合同标的数量、质量和价格的关系)

为您推荐