Example usage for javax.swing SwingUtilities convertRectangle

List of usage examples for javax.swing SwingUtilities convertRectangle

Introduction

In this page you can find the example usage for javax.swing SwingUtilities convertRectangle.

Prototype

public static Rectangle convertRectangle(Component source, Rectangle aRectangle, Component destination) 

Source Link

Document

Convert the rectangle aRectangle in source coordinate system to destination coordinate system.

Usage

From source file:org.eclipse.wb.internal.swing.utils.SwingImageUtils.java

private static void fetchMenuVisualData_JMenuBar(MenuVisualData menuData, Container menuObject,
        Container parent) throws Exception {
    if (parent != null) {
        menuData.m_menuBounds = CoordinateUtils
                .get(SwingUtilities.convertRectangle(menuObject, menuObject.getBounds(), parent));
    } else {/*from ww  w .  j a  v  a2 s .  c  o  m*/
        // image
        {
            JFrame frame = new JFrame();
            frame.setBounds(menuObject.getBounds());
            frame.setJMenuBar((JMenuBar) menuObject);
            frame.pack();
            prepareForPrinting(frame);
            try {
                menuData.m_menuImage = createComponentShot(menuObject);
            } finally {
                setVisible(frame, false);
                frame.dispose();
            }
        }
        // bounds
        menuData.m_menuBounds = CoordinateUtils.get(menuObject.getBounds());
    }
    // items
    fetchMenuVisualData_items(menuData, menuObject);
}