本文整理汇总了Java中javax.swing.SwingConstants.SOUTH属性的典型用法代码示例。如果您正苦于以下问题:Java SwingConstants.SOUTH属性的具体用法?Java SwingConstants.SOUTH怎么用?Java SwingConstants.SOUTH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.SwingConstants
的用法示例。
在下文中一共展示了SwingConstants.SOUTH属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDecreaseButton
protected JButton createDecreaseButton(int orientation) {
JButton btn = new XDMButton();
btn.setHorizontalAlignment(JButton.CENTER);
btn.setPreferredSize(new Dimension(15, 15));
btn.setContentAreaFilled(false);
btn.setBorderPainted(false);
btn.setOpaque(false);
if (orientation == SwingConstants.NORTH) {
btn.setIcon(XDMIconMap.getIcon("UP_ARROW"));
}
if (orientation == SwingConstants.SOUTH) {
btn.setIcon(XDMIconMap.getIcon("DOWN_ARROW"));
}
if (orientation == SwingConstants.EAST) {
btn.setIcon(XDMIconMap.getIcon("LEFT_ARROW"));
}
if (orientation == SwingConstants.WEST) {
btn.setIcon(XDMIconMap.getIcon("RIGHT_ARROW"));
}
return btn;
}
示例2: createIncreaseButton
protected JButton createIncreaseButton(int orientation) {
JButton btn = new XDMButton();
btn.setHorizontalAlignment(JButton.CENTER);
btn.setPreferredSize(new Dimension(15, 15));
btn.setContentAreaFilled(false);
btn.setBorderPainted(false);
if (orientation == SwingConstants.NORTH) {
btn.setIcon(XDMIconMap.getIcon("UP_ARROW"));
}
if (orientation == SwingConstants.SOUTH) {
btn.setIcon(XDMIconMap.getIcon("DOWN_ARROW"));
}
if (orientation == SwingConstants.EAST) {
btn.setIcon(XDMIconMap.getIcon("LEFT_ARROW"));
}
if (orientation == SwingConstants.WEST) {
btn.setIcon(XDMIconMap.getIcon("RIGHT_ARROW"));
}
return btn;
}
示例3: run
@Override
protected void run(Context context) throws Exception {
Random random = context.container().random();
int actionIndex = random.nextInt(4);
boolean select = random.nextBoolean();
int direction;
switch (actionIndex) {
case 0:
direction = SwingConstants.WEST;
break;
case 1:
direction = SwingConstants.EAST;
break;
case 2:
direction = SwingConstants.NORTH;
break;
case 3:
direction = SwingConstants.SOUTH;
break;
default:
throw new IllegalStateException("Invalid actionIndex=" + actionIndex); // NOI18N
}
moveOrSelect(context, direction, select);
}
示例4: getNextVisualPositionFromChecked
@Override
public int getNextVisualPositionFromChecked(int offset, Bias bias, Shape alloc,
int direction, Bias[] biasRet)
{
int retOffset;
switch (direction) {
case SwingConstants.EAST:
case SwingConstants.WEST:
retOffset = children.getNextVisualPositionX(this, offset, bias, alloc,
direction == SwingConstants.EAST, biasRet);
break;
case SwingConstants.NORTH:
case SwingConstants.SOUTH:
DocumentView docView = getDocumentView();
if (docView != null) {
retOffset = children.getNextVisualPositionY(this, offset, bias, alloc,
direction == SwingConstants.SOUTH, biasRet,
HighlightsViewUtils.getMagicX(docView, this, offset, bias, alloc));
} else {
retOffset = offset;
}
break;
default:
throw new IllegalArgumentException("Bad direction " + direction); // NOI18N
}
return retOffset;
}
示例5: toStringDirection
public static String toStringDirection(int direction) {
switch (direction) {
case SwingConstants.WEST: return "WEST";
case SwingConstants.EAST: return "EAST";
case SwingConstants.NORTH: return "NORTH";
case SwingConstants.SOUTH: return "SOUTH";
default: return "<INVALID-DIRECTION>";
}
}
示例6: 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
}
示例7: 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
}
示例8: setVertexLocation
/**
* Fixes the position of the specified vertex
* @param cell the vertex to position
*/
protected void setVertexLocation(mxGraphAbstractHierarchyCell cell)
{
mxGraphHierarchyNode node = (mxGraphHierarchyNode) cell;
Object realCell = node.cell;
double positionX = node.x[0] - node.width / 2;
double positionY = node.y[0] - node.height / 2;
// if (cell.minRank == -1)
// {
// System.out.println("invalid rank, never set");
// }
rankTopY[cell.minRank] = Math.min(rankTopY[cell.minRank], positionY);
rankBottomY[cell.minRank] = Math.max(rankBottomY[cell.minRank],
positionY + node.height);
if (orientation == SwingConstants.NORTH
|| orientation == SwingConstants.SOUTH)
{
layout.setVertexLocation(realCell, positionX, positionY);
}
else
{
layout.setVertexLocation(realCell, positionY, positionX);
}
limitX = Math.max(limitX, positionX + node.width);
}
示例9: getPadding
private int getPadding(int axis) {
int position;
if (axis == HORIZONTAL) {
position = SwingConstants.EAST;
} else {
position = SwingConstants.SOUTH;
}
return getLayoutStyle0().getPreferredGap(source,
target, type, position, host);
}
示例10: 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);
}
示例11: rankCoordinates
/**
* Sets up the layout in an initial positioning. All the first cells in each rank are moved to the
* left and the rest of the rank inserted as close together as their size and buffering permits.
* This method works on just the specified rank.
*
* @param rankValue the current rank being processed
* @param graph the facade describing the input graph
* @param model an internal model of the hierarchical layout
*/
protected void rankCoordinates(final int rankValue, final mxGraph graph,
final mxGraphHierarchyModel model) {
final mxGraphHierarchyRank rank = model.ranks.get(new Integer(rankValue));
double maxY = 0.0;
double localX = this.initialX + (this.widestRankValue - this.rankWidths[rankValue]) / 2;
// Store whether or not any of the cells' bounds were unavailable so
// to only issue the warning once for all cells
boolean boundsWarning = false;
for (final mxGraphAbstractHierarchyCell cell : rank) {
if (cell.isVertex()) {
final mxGraphHierarchyNode node = (mxGraphHierarchyNode) cell;
final mxRectangle bounds = this.layout.getVertexBounds(node.cell);
if (bounds != null) {
if (this.orientation == SwingConstants.NORTH
|| this.orientation == SwingConstants.SOUTH) {
cell.width = bounds.getWidth();
cell.height = bounds.getHeight();
} else {
cell.width = bounds.getHeight();
cell.height = bounds.getWidth();
}
} else {
boundsWarning = true;
}
maxY = Math.max(maxY, cell.height);
} else if (cell.isEdge()) {
final mxGraphHierarchyEdge edge = (mxGraphHierarchyEdge) cell;
// The width is the number of additional parallel edges
// time the parallel edge spacing
int numEdges = 1;
if (edge.edges != null) {
numEdges = edge.edges.size();
} else {
mxCoordinateAssignment.logger.info("edge.edges is null");
}
cell.width = (numEdges - 1) * this.parallelEdgeSpacing;
}
// Set the initial x-value as being the best result so far
localX += cell.width / 2.0;
cell.setX(rankValue, localX);
cell.setGeneralPurposeVariable(rankValue, (int) localX);
localX += cell.width / 2.0;
localX += this.intraCellSpacing;
}
if (boundsWarning == true) {
mxCoordinateAssignment.logger.info("At least one cell has no bounds");
}
}
示例12: isSouth
private static boolean isSouth(Integer[] constraints) {
return constraints[1] == SwingConstants.SOUTH;
}
示例13: moveOrSelect
/**
* Move/select caret left/right/up/down by directions WEST/EAST/NORTH/SOUTH from SwingConstants.
*
* @param context
* @param direction
* @throws Exception
*/
public static void moveOrSelect(Context context, int direction, boolean select) throws Exception {
JEditorPane pane = context.getInstance(JEditorPane.class);
String actionName;
String directionName;
String debugDirection;
switch (direction) {
case SwingConstants.WEST:
actionName = select ? DefaultEditorKit.selectionBackwardAction : DefaultEditorKit.backwardAction;
directionName = "left";
debugDirection = "SwingConstants.WEST";
break;
case SwingConstants.EAST:
actionName = select ? DefaultEditorKit.selectionForwardAction : DefaultEditorKit.forwardAction;
directionName = "right";
debugDirection = "SwingConstants.EAST";
break;
case SwingConstants.NORTH:
actionName = select ? DefaultEditorKit.selectionUpAction : DefaultEditorKit.upAction;
directionName = "up";
debugDirection = "SwingConstants.NORTH";
break;
case SwingConstants.SOUTH:
actionName = select ? DefaultEditorKit.selectionDownAction : DefaultEditorKit.downAction;
directionName = "down";
debugDirection = "SwingConstants.SOUTH";
break;
default:
throw new IllegalStateException("Invalid direction=" + direction); // NOI18N
}
StringBuilder sb = null;
if (context.isLogOp()) {
sb = context.logOpBuilder();
sb.append(select ? "Selection" : "Cursor").append(' ').append(directionName).append("\n");
debugCaret(sb, pane).append(" => ");
sb.append("moveOrSelect(context, ").append(debugDirection).append(", ").append(select).append(")");
sb.append(" => "); // Fill in after action gets performed
}
performAction(context, pane, actionName, null, false);
if (context.isLogOp()) {
debugCaret(sb, pane);
context.logOp(sb);
}
}
示例14: createPreviousButton
protected Component createPreviousButton() {
Component c = new BasicArrowButton(SwingConstants.SOUTH);
c.setName("Spinner.previousButton");
installPreviousButtonListeners(c);
return c;
}
示例15: DropDownArrowButton
public DropDownArrowButton(DropDownButton attachedButton) {
super(SwingConstants.SOUTH);
this.attachedButton = attachedButton;
}