當前位置: 首頁>>代碼示例>>Java>>正文


Java JRootPane.getLayeredPane方法代碼示例

本文整理匯總了Java中javax.swing.JRootPane.getLayeredPane方法的典型用法代碼示例。如果您正苦於以下問題:Java JRootPane.getLayeredPane方法的具體用法?Java JRootPane.getLayeredPane怎麽用?Java JRootPane.getLayeredPane使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JRootPane的用法示例。


在下文中一共展示了JRootPane.getLayeredPane方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

import javax.swing.JRootPane; //導入方法依賴的package包/類
private void initialize(HighlightInfo info) {
	highlightInfo = info;
	currentID = id;
	
	JRootPane rootPane = info.jc.getRootPane();
	layeredPane = rootPane.getLayeredPane();

	highlights = highlightInfo.createHighlights();
	for(HighlightImage highlight : highlights) {
		layeredPane.add(highlight, JLayeredPane.DRAG_LAYER);
	}
	updateAnimation(highlights, 0);
	
	timer.start();

}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:17,代碼來源:AbstractSearchHighlight.java

示例2: installTitlePane

import javax.swing.JRootPane; //導入方法依賴的package包/類
protected void installTitlePane(JRootPane root, LuckTitlePanel titlePane, Window window)
{
    JLayeredPane layeredPane = root.getLayeredPane();

    JComponent oldTitlePane = getTitlePane();

    if (oldTitlePane != null)
    {
        oldTitlePane.setVisible(false);

        layeredPane.remove(oldTitlePane);
    }

    if (titlePane != null)
    {
    	titlePane.setOpaque(true);
    	
        layeredPane.add(titlePane, JLayeredPane.FRAME_CONTENT_LAYER);

        titlePane.setVisible(true);
    }

    this.titlePane = titlePane;
}
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:25,代碼來源:LuckMetalRootPaneUI.java

示例3: setDragCursor

import javax.swing.JRootPane; //導入方法依賴的package包/類
protected void setDragCursor() {
  JRootPane rootWin = SwingUtilities.getRootPane(this);
  if (rootWin != null) {
    // remove cursor from old window
    if (dragCursor.getParent() != null) {
      dragCursor.getParent().remove(dragCursor);
    }
    drawWin = rootWin.getLayeredPane();

    calcDrawOffset();
    dragCursor.setVisible(true);
    drawWin.add(dragCursor, JLayeredPane.DRAG_LAYER);
  }
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:15,代碼來源:SetupStack.java

示例4: setDragCursor

import javax.swing.JRootPane; //導入方法依賴的package包/類
protected void setDragCursor() {
  final JRootPane rootWin = SwingUtilities.getRootPane(this);
  if (rootWin != null) {
    // remove cursor from old window
    if (dragCursor.getParent() != null) {
      dragCursor.getParent().remove(dragCursor);
    }
    drawWin = rootWin.getLayeredPane();

    dragCursor.setVisible(true);
    drawWin.add(dragCursor, JLayeredPane.DRAG_LAYER);
  }
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:14,代碼來源:RegionGrid.java

示例5: actionPerformed

import javax.swing.JRootPane; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent e) {

			if(active && layeredPane==null) {
				JRootPane rootPane = jtc.getRootPane();
				if(rootPane==null)
					return;
				
				layeredPane = rootPane.getLayeredPane();
				int layer = JLayeredPane.DRAG_LAYER.intValue()*3/4+JLayeredPane.POPUP_LAYER.intValue()*1/4;
				layeredPane.add(TextHighlightSheet.this, new Integer(layer));
				makeHighlightsDirty();
			}
			
			if(layeredPane==null) {
				animator.stop();
				return;
			}
			
			layeredPane.repaint( getX(), getY(), getWidth(), getHeight() );
			if(active && searchPhrase.length()>0) {
				setVisible(true);
				if(opacity==1) {
					animator.stop();
				} else {
					opacity = (float)Math.min(1,opacity+.3);
				}
			} else {
				if(opacity==0) {
					setVisible(false);
					animator.stop();
				} else {
					opacity = (float)Math.max(0,opacity-.3);
				}
			}
			layeredPane.repaint( getX(), getY(), getWidth(), getHeight() );
		}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:37,代碼來源:TextHighlightSheet.java

示例6: layoutContainer

import javax.swing.JRootPane; //導入方法依賴的package包/類
public void layoutContainer(Container parent)
{
    JRootPane root = (JRootPane) parent;
    Rectangle bound = root.getBounds();
    Insets inset = root.getInsets();

    // 獲取內容麵板實際寬度, 減去左右邊框麵積
    // Calculate the actual width
    int w = bound.width - inset.right - inset.left;

    // 獲取內容麵板實際高度, 減去上下邊框麵積
    // Calculate the actual height
    int h = bound.height - inset.top - inset.bottom;

    // 設置層級麵板在根窗格中的位置
    // layout LayeredPane
    if(root.getLayeredPane() != null)
    {
        root.getLayeredPane().setBounds(inset.left, inset.top, w, h);
    }

    // 玻璃窗格是在層級麵板中,所以坐標從(0, 0)開始
    // layout GlassPane
    if(root.getGlassPane() != null)
    {
        root.getGlassPane().setBounds(inset.left, inset.top, w, h);
    }

    int nextY = 0;

    RootPaneUI rootPaneUI = root.getUI();

    if(rootPaneUI instanceof LuckMetalRootPaneUI)
    {
        // 布局標題麵板
        // layout TitlePane
        Component titlePanel = ((LuckMetalRootPaneUI)rootPaneUI).getTitlePane();

        // 如果未取消窗體裝飾
        if (titlePanel != null)
        {
            titlePanel.setBounds(0, nextY, w, titlePanel.getHeight());

            nextY += titlePanel.getHeight();
        }
    }

    // 布局JMenuBar
    // layout JMenuBar
    JMenuBar menuBar = root.getJMenuBar();

    if(menuBar != null && menuBar.isVisible())
    {
        menuBar.setBounds(0, nextY, w, menuBar.getPreferredSize().height);

        nextY += menuBar.getPreferredSize().getHeight();
    }

    // 布局內容麵板
    // layout ContentPane
    root.getContentPane().setBounds(0, nextY, w, h - nextY);
}
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:63,代碼來源:LuckMetalRootPaneLayout.java

示例7: preferredLayoutSize

import javax.swing.JRootPane; //導入方法依賴的package包/類
public Dimension preferredLayoutSize(Container parent)
{
  JRootPane rp = (JRootPane) parent;
  JLayeredPane layeredPane = rp.getLayeredPane();
  Component contentPane = rp.getContentPane();
  Component menuBar = rp.getJMenuBar();

  // We must synchronize here, otherwise we cannot guarantee that the
  // prefSize is still non-null when returning.
  synchronized (this)
    {
      if (prefSize == null)
        {
          Insets i = parent.getInsets();
          prefSize = new Dimension(i.left + i.right, i.top + i.bottom);
          Dimension contentPrefSize = contentPane.getPreferredSize();
          prefSize.width += contentPrefSize.width;
          prefSize.height += contentPrefSize.height
                             + titlePane.getPreferredSize().height;
          if (menuBar != null)
            {
              Dimension menuBarSize = menuBar.getPreferredSize();
              if (menuBarSize.width > contentPrefSize.width)
                prefSize.width += menuBarSize.width - contentPrefSize.width;
              prefSize.height += menuBarSize.height;
            }
        }
      // Return a copy here so the cached value won't get trashed by some
      // other component.
      return new Dimension(prefSize);
  }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:33,代碼來源:MetalRootPaneUI.java

示例8: uninstallWindowDecorations

import javax.swing.JRootPane; //導入方法依賴的package包/類
/**
 * Uninstalls the window decorations from the root pane. This should rarely
 * be necessary, but we do it anyway.
 *
 * @param rp the root pane
 */
private void uninstallWindowDecorations(JRootPane rp)
{
  rp.setBorder(null);
  JLayeredPane lp = rp.getLayeredPane();
  for (int i = lp.getComponentCount() - 1; i >= 0; --i)
    {
      if (lp.getComponent(i) instanceof MetalTitlePane)
        {
          lp.remove(i);
          break;
        }
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:20,代碼來源:MetalRootPaneUI.java

示例9: layoutContainer

import javax.swing.JRootPane; //導入方法依賴的package包/類
public void layoutContainer(Container parent)
{
    JRootPane root = (JRootPane) parent;
    Rectangle bound = root.getBounds();
    Insets inset = root.getInsets();

    // 獲取內容麵板實際寬度, 減去左右邊框麵積
    // Calculate the actual width
    int w = bound.width - inset.right - inset.left;

    // 獲取內容麵板實際高度, 減去上下邊框麵積
    int h = bound.height - inset.top - inset.bottom;

    // 設置層級麵板在根窗格中的位置
    // Calculate the actual height
    if(root.getLayeredPane() != null)
    {
        root.getLayeredPane().setBounds(inset.left, inset.top, w, h);
    }

    // 布局玻璃窗格
    // layout LayeredPane
    if(root.getGlassPane() != null)
    {
        root.getGlassPane().setBounds(inset.left, inset.top, w, h);
    }

    // 獲取當前內容麵板
    // get current ContentPane
    Container content = root.getContentPane();

    LuckRootPaneUI rootPaneUI = (LuckRootPaneUI) root.getUI();

    // 使用 <code>LuckBackgroundPanel</code>替換當前的內容麵板
    // Use <code>LuckBackgroundPanel</code> replace the current contents of the panel
    if(!(content instanceof LuckBackgroundPanel))
    {
        Window window = SwingUtilities.getWindowAncestor(root);

       	boolean isResizeableOnInit = LuckWindowUtil.isResizable(window);

    	int initStyle = root.getWindowDecorationStyle();

        if(initStyle != JRootPane.NONE)
        {
            //
            LuckTitlePanel titlePanel = rootPaneUI.createTitlePanel(initStyle, isResizeableOnInit);

            LuckBackgroundPanel background = rootPaneUI.createContentPane(titlePanel, content);

            root.setContentPane(background);
        }
    }

    root.getContentPane().setBounds(0, 0, w, h);
}
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:57,代碼來源:LuckRootPaneLayout.java

示例10: layoutContainer

import javax.swing.JRootPane; //導入方法依賴的package包/類
public void layoutContainer(Container parent)
{
  JRootPane rp = (JRootPane) parent;
  JLayeredPane layeredPane = rp.getLayeredPane();
  Component contentPane = rp.getContentPane();
  Component menuBar = rp.getJMenuBar();
  Component glassPane = rp.getGlassPane();

  if (glassPaneBounds == null || layeredPaneBounds == null
      || contentPaneBounds == null || menuBarBounds == null)
    {
      Insets i = rp.getInsets();
      int containerWidth = parent.getBounds().width - i.left - i.right;
      int containerHeight = parent.getBounds().height - i.top - i.bottom;

      // 1. The glassPane fills entire viewable region (bounds - insets).
      // 2. The layeredPane filles entire viewable region.
      // 3. The titlePane is placed at the upper edge of the layeredPane.
      // 4. The menuBar is positioned at the upper edge of layeredPane.
      // 5. The contentPane fills viewable region minus menuBar minus
      //    titlePane, if present.

      // +-------------------------------+
      // |  JLayeredPane                 |
      // |  +--------------------------+ |
      // |  | titlePane                + |
      // |  +--------------------------+ |
      // |  +--------------------------+ |
      // |  | menuBar                  | |
      // |  +--------------------------+ |
      // |  +--------------------------+ |
      // |  |contentPane               | |
      // |  |                          | |
      // |  |                          | |
      // |  |                          | |
      // |  +--------------------------+ |
      // +-------------------------------+

      // Setup titlePaneBounds.
      if (titlePaneBounds == null)
        titlePaneBounds = new Rectangle();
      titlePaneBounds.width = containerWidth;
      titlePaneBounds.height = titlePane.getPreferredSize().height;

      // Setup menuBarBounds.
      if (menuBarBounds == null)
        menuBarBounds = new Rectangle();
      menuBarBounds.setBounds(0,
                              titlePaneBounds.y + titlePaneBounds.height,
                              containerWidth, 0);
      if (menuBar != null)
        {
          Dimension menuBarSize = menuBar.getPreferredSize();
          if (menuBarSize.height > containerHeight)
            menuBarBounds.height = containerHeight;
          else
            menuBarBounds.height = menuBarSize.height;
        }

      // Setup contentPaneBounds.
      if (contentPaneBounds == null)
        contentPaneBounds = new Rectangle();
      contentPaneBounds.setBounds(0,
                                  menuBarBounds.y + menuBarBounds.height,
                                  containerWidth,
                                  containerHeight - menuBarBounds.y
                                  - menuBarBounds.height);
      glassPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);
      layeredPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);
    }

  // Layout components.
  glassPane.setBounds(glassPaneBounds);
  layeredPane.setBounds(layeredPaneBounds);
  if (menuBar != null)
    menuBar.setBounds(menuBarBounds);
  contentPane.setBounds(contentPaneBounds);
  titlePane.setBounds(titlePaneBounds);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:80,代碼來源:MetalRootPaneUI.java


注:本文中的javax.swing.JRootPane.getLayeredPane方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。