Here you can find the source of exportBounds(Frame theFame, Document doc)
Parameter | Description |
---|---|
theFame | The target frame. |
doc | The XML document from which the XML element is to be constructed. |
public static Element exportBounds(Frame theFame, Document doc)
//package com.java2s; //License from project: Apache License import java.awt.*; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { /**//from www .j a v a2 s. c o m * Extracts the bounds information from a given Frame and returns the XML * representation thereof. Must be invoked from the EDT. * * @param theFame The target frame. * @param doc The XML document from which the XML element is to be * constructed. * @return The XML construct representing the bounds information from the * given frame. */ public static Element exportBounds(Frame theFame, Document doc) { Element ret = doc.createElement("Bounds"); ret.setAttribute("Maximized", String.valueOf(((theFame.getExtendedState() & Frame.MAXIMIZED_BOTH) != 0))); Rectangle bounds = theFame.getBounds(); ret.setAttribute("X", String.valueOf((int) bounds.getX())); ret.setAttribute("Y", String.valueOf((int) bounds.getY())); ret.setAttribute("Width", String.valueOf((int) bounds.getWidth())); ret.setAttribute("Height", String.valueOf((int) bounds.getHeight())); return ret; } }