Example usage for javax.swing SwingConstants SOUTH_EAST

List of usage examples for javax.swing SwingConstants SOUTH_EAST

Introduction

In this page you can find the example usage for javax.swing SwingConstants SOUTH_EAST.

Prototype

int SOUTH_EAST

To view the source code for javax.swing SwingConstants SOUTH_EAST.

Click Source Link

Document

Compass-direction south-east (lower right).

Usage

From source file:Main.java

public static Point arrangeWithin(final Shape shapeToArrange, final Rectangle window, final int arrangement,
        Insets padding) {/*from  w w w. j  a  v  a 2s  .c o m*/
    if (shapeToArrange == null)
        throw new IllegalArgumentException("Parameter 'shapeToArrange' must not be null!");
    if (window == null)
        throw new IllegalArgumentException("Parameter 'window' must not be null!");
    if (padding == null)
        padding = new Insets(0, 0, 0, 0);

    final Rectangle bounds = shapeToArrange.getBounds();

    switch (arrangement) {
    case SwingConstants.NORTH:
        return new Point((window.width - bounds.width) / 2, padding.top);
    case SwingConstants.NORTH_EAST:
        return new Point(window.width - padding.right, padding.top);
    case SwingConstants.EAST:
        return new Point(window.width - padding.right, (window.height - bounds.height) / 2);
    case SwingConstants.SOUTH_EAST:
        return new Point(window.width - padding.right, window.height - padding.bottom);
    case SwingConstants.SOUTH:
        return new Point((window.width - bounds.width) / 2, window.height - padding.bottom);
    case SwingConstants.SOUTH_WEST:
        return new Point(padding.left, window.height - padding.bottom);
    case SwingConstants.WEST:
        return new Point(padding.left, (window.height - bounds.height) / 2);
    case SwingConstants.NORTH_WEST:
        return new Point(padding.left, padding.top);
    case SwingConstants.CENTER:
        return new Point((window.width - bounds.width) / 2, (window.height - bounds.height) / 2);
    default:
        throw new IllegalArgumentException("Illegal arrangement key, expected one of the SwingConstants keys");
    }
}

From source file:org.executequery.base.DockedTabContainer.java

/**
 * Closed the specfied tab component with name at the specified position.
 * /*from ww  w .j av  a 2s  . co  m*/
 * @param the name of the tab component
 * @param the position
 */
public void closeTabComponent(String name, int position) {

    TabPane tabPane = getTabPaneForPosition(position);

    if (position == SwingConstants.SOUTH || position == SwingConstants.SOUTH_WEST
            || position == SwingConstants.SOUTH_EAST) {

        if (tabPane != null) {

            ((AbstractTabPane) tabPane).closeTabComponent(name);

        } else {

            closeTabComponent(name, NORTH);
        }

    }

    if (tabPane != null) {

        ((AbstractTabPane) tabPane).closeTabComponent(name);
    }

}

From source file:org.executequery.base.DockedTabContainer.java

/**
 * Returns the tab pane at the specified position.
 *
 * @param position - the position of the pane
 *//*from w ww . jav a  2s  .c  o m*/
protected TabPane getTabPaneForPosition(int position) {
    switch (position) {
    case SwingConstants.NORTH:
    case SwingConstants.NORTH_WEST:
    case SwingConstants.NORTH_EAST:
        return northTabPane;
    case SwingConstants.SOUTH:
    case SwingConstants.SOUTH_WEST:
    case SwingConstants.SOUTH_EAST:
        return southTabPane;
    case SwingConstants.CENTER:
        return scrollingTabPane;
    }
    return null;
}

From source file:org.executequery.base.DockedTabContainer.java

protected int getTabPanePosition(DockedTabPane tabPane) {
    if (tabPane == northTabPane) {
        if (orientation == SwingConstants.WEST) {
            return SwingConstants.NORTH_WEST;
        } else {//from w  w  w. j av a  2  s .  c om
            return SwingConstants.NORTH_EAST;
        }
    } else if (tabPane == southTabPane) {
        if (orientation == SwingConstants.WEST) {
            return SwingConstants.SOUTH_WEST;
        } else if (orientation == SwingConstants.CENTER) {
            return SwingConstants.SOUTH;
        } else {
            return SwingConstants.SOUTH_EAST;
        }
    }
    return SwingConstants.NORTH_WEST; // default
}

From source file:org.executequery.base.DockedTabContainer.java

/**
 * Adds the specified component as a docked tab component
 * in the specified position.//from  w  w w. j  a va2s . co m
 *
 * @param the tab title
 * @param the tab icon
 * @param the component
 * @param the tab's tool tip
 * @param the position - one of SwingConstants.NORTH | SOUTH
 */
public void addDockedTab(String title, Icon icon, Component component, String tip, int position) {

    // make sure the split pane is visible
    splitPane.setVisible(true);

    DockedTabPane tabPane = null;

    // check if we have a north tab pane.
    // if not, add there regardless of specified position
    if (northTabPane == null && orientation != CENTER) {

        northTabPane = new DockedTabPane(this);
        splitPane.setLeftComponent(northTabPane);
        tabPane = northTabPane;

        // if we have minimised tabs but added a tab pane
        // restore it to its previous size
        //if (buttonPanel != null) {
        //desktopMediator.resetPaneToPreferredSizes(orientation, true);
        //}

    } else {

        switch (position) {
        case SwingConstants.NORTH:
        case SwingConstants.NORTH_WEST:
        case SwingConstants.NORTH_EAST:
            tabPane = northTabPane;
            break;
        case SwingConstants.SOUTH:
        case SwingConstants.SOUTH_WEST:
        case SwingConstants.SOUTH_EAST:
            if (southTabPane == null) {
                southTabPane = new DockedTabPane(this);
                southPaneCreated();
            }
            tabPane = southTabPane;
            break;
        case SwingConstants.CENTER:
            if (scrollingTabPane == null) {
                scrollingTabPane = new ScrollingTabPane(this);
                splitPane.setLeftComponent(scrollingTabPane);
                splitPane.setGlassPaneVisible(SwingUtilities.BOTTOM, true);
                splitPane.setGlassPaneVisible(SwingUtilities.TOP, false);
                splitPane.setResizeWeight(1.0);
                if (southTabPane != null) {
                    splitPane.setDividerSize(ApplicationConstants.SPLIT_PANE_DIVIDER_SIZE);
                }
            }
            scrollingTabPane.addTab(position, title, icon, component, tip);
            return;
        }

    }

    if (tabPane != null) {
        tabPane.addTab(position, title, icon, component, tip);
    }

    if (orientation != SwingConstants.CENTER) {
        desktopMediator.resetPaneToPreferredSizes(orientation, true);
    }

}

From source file:org.executequery.base.DockedTabContainer.java

/**
 * Indicates whether the tab pane in the specified
 * position is visible.// ww  w.ja  va2s  . c o m
 *
 * @return <code>true | false</code>
 */
public boolean isTabPaneVisible(int position) {
    switch (position) {
    case SwingConstants.NORTH:
    case SwingConstants.NORTH_WEST:
    case SwingConstants.NORTH_EAST:
        return (northTabPane != null);
    case SwingConstants.SOUTH:
    case SwingConstants.SOUTH_WEST:
    case SwingConstants.SOUTH_EAST:
        return (southTabPane != null);
    }
    return (northTabPane != null || southTabPane != null);
}