本文整理汇总了Java中javax.swing.SwingConstants.SOUTH_WEST属性的典型用法代码示例。如果您正苦于以下问题:Java SwingConstants.SOUTH_WEST属性的具体用法?Java SwingConstants.SOUTH_WEST怎么用?Java SwingConstants.SOUTH_WEST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.SwingConstants
的用法示例。
在下文中一共展示了SwingConstants.SOUTH_WEST属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例4: isResizingWestward
/**
* Determines if we are moving west side of the component during resizing.
*
* @return {@code true} is we are moving west side of the component,
* returns {@code false} otherwise.
*/
private boolean isResizingWestward() {
return (resizingMode == SwingConstants.WEST
|| resizingMode == SwingConstants.SOUTH_WEST
|| resizingMode == SwingConstants.NORTH_WEST);
}
示例5: 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);
}