Example usage for javax.swing SwingConstants NORTH_EAST

List of usage examples for javax.swing SwingConstants NORTH_EAST

Introduction

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

Prototype

int NORTH_EAST

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

Click Source Link

Document

Compass-direction north-east (upper right).

Usage

From source file:Main.java

public static Point arrangeWithin(final Shape shapeToArrange, final Rectangle window, final int arrangement,
        Insets padding) {/*  ww w .jav a  2 s  .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:op.care.med.structure.PnlMed.java

private java.util.List<Component> addCommands() {
    java.util.List<Component> list = new ArrayList<Component>();

    if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.INSERT, internalClassID)) {
        final JideButton addButton = GUITools.createHyperlinkButton(MedProductWizard.internalClassID,
                SYSConst.icon22wizard, null);

        addButton.addActionListener(new ActionListener() {
            @Override/* ww w.  j  av  a2 s .c  om*/
            public void actionPerformed(ActionEvent actionEvent) {

                final JidePopup popup = new JidePopup();

                WizardDialog wizard = new MedProductWizard(new Closure() {
                    @Override
                    public void execute(Object o) {
                        popup.hidePopup();
                        // keine Manahme ntig
                    }
                }).getWizard();

                popup.setMovable(false);
                popup.setPreferredSize((new Dimension(800, 450)));
                popup.setResizable(false);
                popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS));
                popup.getContentPane().add(wizard.getContentPane());
                popup.setOwner(addButton);
                popup.removeExcludedComponent(addButton);
                popup.setTransient(false);
                popup.setDefaultFocusComponent(wizard.getContentPane());
                popup.addPropertyChangeListener("visible", new PropertyChangeListener() {
                    @Override
                    public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
                        popup.getContentPane().getComponentCount();
                    }
                });

                GUITools.showPopup(popup, SwingConstants.NORTH_EAST);
            }
        });

        list.add(addButton);
    }

    //       OPDE.debug("isCalcMediUPR1: " + OPDE.isCalcMediUPR1());
    //
    //        if (OPDE.isDebug()) {
    //            Iterator it = OPDE.getProps().entrySet().iterator();
    //            while (it.hasNext()) {
    //                OPDE.debug(it.next().toString());
    //            }
    //        }

    if (OPDE.isCalcMediUPR1() && OPDE.getAppInfo().isAllowedTo(InternalClassACL.INSERT, internalClassID)) {
        JideButton buchenButton = GUITools.createHyperlinkButton("nursingrecords.inventory.newstocks",
                SYSConst.icon22addrow, new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent actionEvent) {
                        new DlgNewStocks(null);
                    }
                });
        list.add(buchenButton);
    }

    return list;
}

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

/**
 * Returns the tab pane at the specified position.
 *
 * @param position - the position of the pane
 *///from   www.  j av  a2 s  .  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 ww .  java  2 s  .  c o  m*/
            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  www  .  j  ava  2  s .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.//from  w  w w  .j  ava 2s  .c  om
 *
 * @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);
}