本文整理汇总了Java中javax.swing.SwingConstants.SOUTH_EAST属性的典型用法代码示例。如果您正苦于以下问题:Java SwingConstants.SOUTH_EAST属性的具体用法?Java SwingConstants.SOUTH_EAST怎么用?Java SwingConstants.SOUTH_EAST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.SwingConstants
的用法示例。
在下文中一共展示了SwingConstants.SOUTH_EAST属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSupported
private static void checkSupported(int constraint) {
if (constraint == SwingConstants.NORTH) return;
if (constraint == SwingConstants.WEST) return;
if (constraint == SwingConstants.SOUTH) return;
if (constraint == SwingConstants.EAST) return;
if (constraint == SwingConstants.NORTH_WEST) return;
if (constraint == SwingConstants.NORTH_EAST) return;
if (constraint == SwingConstants.SOUTH_WEST) return;
if (constraint == SwingConstants.SOUTH_EAST) return;
if (constraint == SwingConstants.CENTER) return;
throw new IllegalArgumentException("Unsupported constraint: " + constraint); // NOI18N
}
示例2: constraintName
private static String constraintName(int constraint) {
if (constraint == SwingConstants.NORTH) return "NORTH"; // NOI18N
if (constraint == SwingConstants.WEST) return "WEST"; // NOI18N
if (constraint == SwingConstants.SOUTH) return "SOUTH"; // NOI18N
if (constraint == SwingConstants.EAST) return "EAST"; // NOI18N
if (constraint == SwingConstants.NORTH_WEST) return "NORTH_WEST"; // NOI18N
if (constraint == SwingConstants.NORTH_EAST) return "NORTH_EAST"; // NOI18N
if (constraint == SwingConstants.SOUTH_WEST) return "SOUTH_WEST"; // NOI18N
if (constraint == SwingConstants.SOUTH_EAST) return "SOUTH_EAST"; // NOI18N
if (constraint == SwingConstants.CENTER) return "CENTER"; // NOI18N
return "UNSUPPORTED_CONSTRAINT (value=" + constraint + ")"; // NOI18N
}
示例3: displayPopup
protected void displayPopup() {
JPopupMenu menu = new JPopupMenu();
populatePopup(menu);
if (menu.getComponentCount() > 0) {
Dimension size = menu.getPreferredSize();
size.width = Math.max(size.width, getWidth());
menu.setPreferredSize(size);
int align = getPopupAlign();
int x;
switch (align) {
case SwingConstants.EAST:
case SwingConstants.NORTH_EAST:
case SwingConstants.SOUTH_EAST:
x = getWidth() - size.width;
break;
default:
x = 0;
break;
}
int y;
switch (align) {
case SwingConstants.NORTH:
case SwingConstants.NORTH_EAST:
case SwingConstants.NORTH_WEST:
y = -size.height;
break;
default:
y = getHeight();
break;
}
menu.show(this, x, y);
}
}
示例4: updateCursor
/**
* Updates cursor according to its location. For example, it sets
* the appropriate resizing cursor when the mouse is over the boundary
* of the selection component.
*
* @param cursorLocation current mouse cursor location.
*/
void updateCursor(Point cursorLocation) {
Cursor cursor = Cursor.getDefaultCursor();
if (cursorLocation == null) {
resizingMode = 0;
} else {
int x = cursorLocation.x;
int y = cursorLocation.y;
Image resizeHandle = GridDesigner.RESIZE_HANDLE;
int rw = resizeHandle.getWidth(null);
int rh = resizeHandle.getHeight(null);
for (Component selComp : selection) {
Rectangle rect = fromComponentPane(selectionResizingBounds(selComp));
boolean w = (rect.x-rw<=x) && (x<=rect.x+rect.width+rw);
boolean h = (rect.y-rh<=y) && (y<=rect.y+rect.height+rh);
boolean top = w && (rect.y-rh<=y) && (y<=rect.y+2);
boolean bottom = w && (rect.y+rect.height-2<=y) && (y<=rect.y+rect.height+rh);
boolean left = h && (rect.x-rw<=x) && (x<=rect.x+2);
boolean right = h && (rect.x+rect.width-2<=x) && (x<=rect.x+rect.width+rw);
if (top) {
if (left) {
cursor = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
resizingMode = SwingConstants.NORTH_WEST;
} else if (right) {
cursor = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
resizingMode = SwingConstants.NORTH_EAST;
} else {
cursor = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
resizingMode = SwingConstants.NORTH;
}
} else if (bottom) {
if (left) {
cursor = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
resizingMode = SwingConstants.SOUTH_WEST;
} else if (right) {
cursor = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
resizingMode = SwingConstants.SOUTH_EAST;
} else {
cursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
resizingMode = SwingConstants.SOUTH;
}
} else if (left) {
cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
resizingMode = SwingConstants.WEST;
} else if (right) {
cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
resizingMode = SwingConstants.EAST;
} else {
cursor = Cursor.getDefaultCursor();
resizingMode = 0;
}
if (resizingMode != 0) {
focusedComponent = selComp;
break;
}
}
}
setCursor(cursor);
}
示例5: show
public void show() {
// Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
// if (focusOwner != null) focusRef = new WeakReference(focusOwner);
owner = ownerRef == null ? null : ownerRef.get();
ownerLocation = owner == null ? null : owner.getLocationOnScreen();
window = new JWindow(owner);
window.setType(Window.Type.POPUP);
window.setAlwaysOnTop(false);
window.setFocusable(true);
window.setFocusableWindowState(true);
window.setAutoRequestFocus(true);
window.getContentPane().add(content);
window.pack();
if (popupAlign == -1) {
window.setLocation(location.getLocation());
} else {
Dimension size = content.getSize();
int x;
switch (popupAlign) {
case SwingConstants.EAST:
case SwingConstants.NORTH_EAST:
case SwingConstants.SOUTH_EAST:
x = location.x + location.width - size.width + 1;
break;
default:
x = location.x + 1;
break;
}
int y;
switch (popupAlign) {
case SwingConstants.NORTH:
case SwingConstants.NORTH_EAST:
case SwingConstants.NORTH_WEST:
y = location.y - size.height + 1;
break;
default:
y = location.y + location.height + 1;
break;
}
window.setLocation(x, y);
}
window.setVisible(true);
Component defaultFocus = content.getFocusTraversalPolicy().getDefaultComponent(content);
if (defaultFocus != null) defaultFocus.requestFocusInWindow();
content.installListeners();
if (listener != null) listener.popupShown();
}
示例6: isResizingEastward
/**
* Determines if we are moving east side of the component during resizing.
*
* @return {@code true} is we are moving east side of the component,
* returns {@code false} otherwise.
*/
private boolean isResizingEastward() {
return (resizingMode == SwingConstants.EAST
|| resizingMode == SwingConstants.SOUTH_EAST
|| resizingMode == SwingConstants.NORTH_EAST);
}
示例7: isResizingSouthward
/**
* Determines if we are moving south side of the component during resizing.
*
* @return {@code true} is we are moving south side of the component,
* returns {@code false} otherwise.
*/
private boolean isResizingSouthward() {
return (resizingMode == SwingConstants.SOUTH
|| resizingMode == SwingConstants.SOUTH_EAST
|| resizingMode == SwingConstants.SOUTH_WEST);
}