Java Code Examples for javax.swing.SwingConstants#SOUTH_WEST
The following examples show how to use
javax.swing.SwingConstants#SOUTH_WEST .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: pumpernickel File: BoxContainerPanelUI.java License: MIT License | 6 votes |
public Cursor getCursor() { switch (position) { case SwingConstants.NORTH: return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR); case SwingConstants.SOUTH: return Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR); case SwingConstants.EAST: return Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); case SwingConstants.WEST: return Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR); case SwingConstants.NORTH_EAST: return Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR); case SwingConstants.SOUTH_EAST: return Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR); case SwingConstants.NORTH_WEST: return Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR); case SwingConstants.SOUTH_WEST: return Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR); } return Cursor.getDefaultCursor(); }
Example 2
Source Project: SikuliX1 File: Resizable.java License: MIT License | 5 votes |
private Rectangle getRectangle(int x, int y, int w, int h, int location) { switch (location) { case SwingConstants.NORTH: return new Rectangle(x + w / 2 - dist / 2, y, dist, dist); case SwingConstants.SOUTH: return new Rectangle(x + w / 2 - dist / 2, y + h - dist, dist, dist); case SwingConstants.WEST: return new Rectangle(x, y + h / 2 - dist / 2, dist, dist); case SwingConstants.EAST: return new Rectangle(x + w - dist, y + h / 2 - dist / 2, dist, dist); case SwingConstants.NORTH_WEST: return new Rectangle(x, y, dist, dist); case SwingConstants.NORTH_EAST: return new Rectangle(x + w - dist, y, dist, dist); case SwingConstants.SOUTH_WEST: return new Rectangle(x, y + h - dist, dist, dist); case SwingConstants.SOUTH_EAST: return new Rectangle(x + w - dist, y + h - dist, dist, dist); } return null; }
Example 3
Source Project: netbeans File: CrossBorderLayout.java License: Apache License 2.0 | 5 votes |
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 }
Example 4
Source Project: netbeans File: CrossBorderLayout.java License: Apache License 2.0 | 5 votes |
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 }
Example 5
Source Project: visualvm File: CrossBorderLayout.java License: GNU General Public License v2.0 | 5 votes |
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 }
Example 6
Source Project: visualvm File: CrossBorderLayout.java License: GNU General Public License v2.0 | 5 votes |
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 }
Example 7
Source Project: pdfxtk File: GraphPanel.java License: Apache License 2.0 | 5 votes |
int pointToSelectionArea(int px, int py) { if(selectionBoundingBox == null) return -1; int x = selectionBoundingBox.x; int y = selectionBoundingBox.y; int w = selectionBoundingBox.width; int wh = w / 2; int h = selectionBoundingBox.height; int hh = h / 2; if(px >= x - SELECTION_MARK_CENTER && px <= x + SELECTION_MARK_CENTER) { if(py >= y - SELECTION_MARK_CENTER && py <= y + SELECTION_MARK_CENTER) return SwingConstants.NORTH_WEST; if(py >= y - SELECTION_MARK_CENTER + hh && py <= y + SELECTION_MARK_CENTER + hh) return SwingConstants.WEST; if(py >= y - SELECTION_MARK_CENTER + h && py <= y + SELECTION_MARK_CENTER + h) return SwingConstants.SOUTH_WEST; } if(px >= x - SELECTION_MARK_CENTER + wh && px <= x + SELECTION_MARK_CENTER + wh) { if(py >= y - SELECTION_MARK_CENTER && py <= y + SELECTION_MARK_CENTER) return SwingConstants.NORTH; if(py >= y - SELECTION_MARK_CENTER + h && py <= y + SELECTION_MARK_CENTER + h) return SwingConstants.SOUTH; } if(px >= x - SELECTION_MARK_CENTER + w && px <= x + SELECTION_MARK_CENTER + w) { if(py >= y - SELECTION_MARK_CENTER && py <= y + SELECTION_MARK_CENTER) return SwingConstants.NORTH_EAST; if(py >= y - SELECTION_MARK_CENTER + hh && py <= y + SELECTION_MARK_CENTER + hh) return SwingConstants.EAST; if(py >= y - SELECTION_MARK_CENTER + h && py <= y + SELECTION_MARK_CENTER + h) return SwingConstants.SOUTH_EAST; } return selectionBoundingBox.contains(px, py) ? SwingConstants.CENTER : -1; }
Example 8
Source Project: netbeans File: GlassPane.java License: Apache License 2.0 | 4 votes |
/** * 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); }
Example 9
Source Project: pumpernickel File: BoxContainerPanelUI.java License: MIT License | 4 votes |
public void defineShape(Rectangle r) { shape = new GeneralPath(); int k1 = 15; int k2 = 8; switch (position) { case SwingConstants.NORTH_WEST: shape.moveTo(r.x, r.y); shape.lineTo(r.x + k1, r.y); shape.lineTo(r.x + k1, r.y - k2); shape.lineTo(r.x - k2, r.y - k2); shape.lineTo(r.x - k2, r.y + k1); shape.lineTo(r.x, r.y + k1); shape.closePath(); break; case SwingConstants.NORTH_EAST: shape.moveTo(r.x + r.width, r.y); shape.lineTo(r.x + r.width - k1, r.y); shape.lineTo(r.x + r.width - k1, r.y - k2); shape.lineTo(r.x + r.width + k2, r.y - k2); shape.lineTo(r.x + r.width + k2, r.y + k1); shape.lineTo(r.x + r.width, r.y + k1); shape.closePath(); break; case SwingConstants.SOUTH_WEST: shape.moveTo(r.x, r.y + r.height); shape.lineTo(r.x + k1, r.y + r.height); shape.lineTo(r.x + k1, r.y + r.height + k2); shape.lineTo(r.x - k2, r.y + r.height + k2); shape.lineTo(r.x - k2, r.y + r.height - k1); shape.lineTo(r.x, r.y + r.height - k1); shape.closePath(); break; case SwingConstants.SOUTH_EAST: shape.moveTo(r.x + r.width, r.y + r.height); shape.lineTo(r.x + r.width - k1, r.y + r.height); shape.lineTo(r.x + r.width - k1, r.y + r.height + k2); shape.lineTo(r.x + r.width + k2, r.y + r.height + k2); shape.lineTo(r.x + r.width + k2, r.y + r.height - k1); shape.lineTo(r.x + r.width, r.y + r.height - k1); shape.closePath(); break; case SwingConstants.NORTH: shape.moveTo(r.x + r.width / 2 - k1 / 2, r.y); shape.lineTo(r.x + r.width / 2 + k1 / 2, r.y); shape.lineTo(r.x + r.width / 2 + k1 / 2, r.y - k2); shape.lineTo(r.x + r.width / 2 - k1 / 2, r.y - k2); break; case SwingConstants.SOUTH: shape.moveTo(r.x + r.width / 2 - k1 / 2, r.y + r.height); shape.lineTo(r.x + r.width / 2 + k1 / 2, r.y + r.height); shape.lineTo(r.x + r.width / 2 + k1 / 2, r.y + r.height + k2); shape.lineTo(r.x + r.width / 2 - k1 / 2, r.y + r.height + k2); break; case SwingConstants.EAST: shape.moveTo(r.x, r.y + r.height / 2 - k1 / 2); shape.lineTo(r.x, r.y + r.height / 2 + k1 / 2); shape.lineTo(r.x - k2, r.y + r.height / 2 + k1 / 2); shape.lineTo(r.x - k2, r.y + r.height / 2 - k1 / 2); break; case SwingConstants.WEST: shape.moveTo(r.x + r.width, r.y + r.height / 2 - k1 / 2); shape.lineTo(r.x + r.width, r.y + r.height / 2 + k1 / 2); shape.lineTo(r.x + r.width + k2, r.y + r.height / 2 + k1 / 2); shape.lineTo(r.x + r.width + k2, r.y + r.height / 2 - k1 / 2); break; default: throw new RuntimeException("unexpected position: " + position); } }
Example 10
Source Project: netbeans File: GlassPane.java License: Apache License 2.0 | 2 votes |
/** * 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); }
Example 11
Source Project: netbeans File: GlassPane.java License: Apache License 2.0 | 2 votes |
/** * 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); }