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


Java JDesktopPane.getAllFrames方法代碼示例

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


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

示例1: showAndPositionInternalFrame

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
/**
 *
 * @param desktopPane
 * @param internalFrame
 */
public static void showAndPositionInternalFrame(JDesktopPane desktopPane, JInternalFrame internalFrame) {
    int numberOfOpenFrames = desktopPane.getAllFrames().length;
    try {
        desktopPane.add(internalFrame, javax.swing.JLayeredPane.DEFAULT_LAYER);
    } catch (java.lang.IllegalArgumentException iae) {
        // frame already displayed
    }
    internalFrame.setVisible(true);
    int posX = 0;
    // Math.max(desktopPane.getWidth() / 2 - internalFrame.getWidth() / 2, 0);
    posX = Math.min(posX + numberOfOpenFrames * X_OFFSET, desktopPane.getWidth() - X_OFFSET);
    int posY = 0;
    // Math.max(desktopPane.getHeight() / 2 - internalFrame.getHeight() / 2, 0);
    posY = Math.min(posY + numberOfOpenFrames * Y_OFFSET, desktopPane.getHeight() - Y_OFFSET);
    internalFrame.setLocation(posX, posY);
    //CanRegClientApp.getApplication().getMainFrame();
    internalFrame.setVisible(true);
    internalFrame.toFront();
}
 
開發者ID:IARC-CSU,項目名稱:CanReg5,代碼行數:25,代碼來源:CanRegClientView.java

示例2: getDesktopProjectFrames

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
/**
 * Get all frames of the CURRENT desktop
 */
@Override
public final ProjectFrame[] getDesktopProjectFrames() {
  List<ProjectFrame> projectFrameList = new ArrayList<ProjectFrame>();
  JDesktopPane currentDesktop = this.getCurrentDesktop();
  if (currentDesktop == null) {
    return new ProjectFrame[0];
  }

  for (JInternalFrame frameGui : currentDesktop.getAllFrames()) {
    ProjectFrame projectFrame = this.getProjectFrameFromGui(frameGui);
    if (projectFrame != null) {
      projectFrameList.add(projectFrame);
    }
  }
  return projectFrameList.toArray(new ProjectFrame[0]);
}
 
開發者ID:IGNF,項目名稱:geoxygene,代碼行數:20,代碼來源:FloatingMainFrame.java

示例3: getTopViewCacheController

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
public static CacheListController getTopViewCacheController(JDesktopPane desktop)
{
    if (desktop.getAllFrames().length == 0)
        return null;

    JInternalFrame jif = desktop.getAllFrames()[0];
    return CacheListController.getCacheListController(jif);
}
 
開發者ID:RoffelKartoffel,項目名稱:cmanager,代碼行數:9,代碼來源:CacheListController.java

示例4: tile

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
/**
 * From <a href=
 * "https://www.java-tips.org/how-to-tile-all-internal-frames-when-requested.html">java-tips.org</a>
 * <br>
 * Modified to account for iconified windows.
 * 
 * @param desk
 *            Desktop pane containing windows to be tiled.
 */
public static void tile(JDesktopPane desk) {
	// How many frames do we have?
	JInternalFrame[] frames = desk.getAllFrames();
	List<JInternalFrame> tileableFrames = new ArrayList<>();
	List<JInternalFrame> iconifiedFrames = new ArrayList<>();
	boolean icons = false;
	int count = 0;
	for (JInternalFrame frame : frames) {
		if (frame.isIcon()) {
			iconifiedFrames.add(frame);
			icons = true;
		} else {
			tileableFrames.add(frame);
			count++;
		}
	}
	if (count == 0) return;

	// Determine the necessary grid size
	int sqrt = (int) Math.sqrt(count);
	int rows = sqrt;
	int cols = sqrt;
	if (rows * cols < count) {
		cols++;
		if (rows * cols < count) {
			rows++;
		}
	}

	// Define some initial values for size & location.
	Dimension size = desk.getSize();
	int hb = size.height;
	if (icons && hb > 27) {
		hb -= 27;
	}
	int w = size.width / cols;
	int h = hb / rows;

	int x = 0;
	int y = 0;

	// Iterate over the frames and relocating & resizing each.
	for (int i = 0; i < rows; i++) {
		for (int j = 0; j < cols && ((i * cols) + j < count); j++) {
			JInternalFrame f = tileableFrames.get((i * cols) + j);
			desk.getDesktopManager().resizeFrame(f, x, y, w, h);
			x += w;
		}
		y += h; // start the next row
		x = 0;
	}
}
 
開發者ID:Col-E,項目名稱:Recaf,代碼行數:62,代碼來源:Swing.java

示例5: getTopView

import javax.swing.JDesktopPane; //導入方法依賴的package包/類
public static CacheListView getTopView(JDesktopPane desktop)
{
    return (CacheListView)desktop.getAllFrames()[0];
}
 
開發者ID:RoffelKartoffel,項目名稱:cmanager,代碼行數:5,代碼來源:CacheListController.java


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