当前位置: 首页>>代码示例>>Java>>正文


Java SwingConstants.WEST属性代码示例

本文整理汇总了Java中javax.swing.SwingConstants.WEST属性的典型用法代码示例。如果您正苦于以下问题:Java SwingConstants.WEST属性的具体用法?Java SwingConstants.WEST怎么用?Java SwingConstants.WEST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.SwingConstants的用法示例。


在下文中一共展示了SwingConstants.WEST属性的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;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:21,代码来源:XDMScrollBarUI.java

示例2: paintVerticalTick

protected void paintVerticalTick(Graphics g, AxisMark mark, int y,
                                   Rectangle clip, Rectangle chartMask) {
    g.setColor(getForeground());
    if (location == SwingConstants.WEST) {
        g.drawLine(getWidth() - 2 - getAxisBasisExtent(), y, getWidth() - 2, y);
    } else {
        g.drawLine(1, y, 1 + getAxisBasisExtent(), y);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:AxisComponent.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:EditorPaneTesting.java

示例4: 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;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:20,代码来源:XDMScrollBarUI.java

示例5: 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ParagraphView.java

示例6: 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>";
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ViewUtils.java

示例7: paintVerticalBasis

protected void paintVerticalBasis(Graphics g, Rectangle clip, Rectangle chartMask) {
    g.setColor(getForeground());
    if (location == SwingConstants.WEST) {
        g.drawLine(getWidth() - 1, chartMask.y - 1, getWidth() - 1, chartMask.y + chartMask.height);
    } else {
        g.drawLine(0, chartMask.y, 0, chartMask.y + chartMask.height);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:AxisComponent.java

示例8: getLayoutComponent

public Component getLayoutComponent(int constraint) {
    if (constraint == SwingConstants.NORTH) return north;
    if (constraint == SwingConstants.WEST) return west;
    if (constraint == SwingConstants.SOUTH) return south;
    if (constraint == SwingConstants.EAST) return east;
    if (constraint == SwingConstants.CENTER) return center;
    throw new IllegalArgumentException("Illegal constraint: " + // NOI18N
            constraintName(constraint));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CrossBorderLayout.java

示例9: isLeftAligned

private boolean isLeftAligned(AbstractButton button, int position) {
    if (position == SwingConstants.WEST) {
        boolean ltr = button.getComponentOrientation().isLeftToRight();
        int hAlign = button.getHorizontalAlignment();
        return ((ltr && (hAlign == SwingConstants.LEFT ||
                         hAlign == SwingConstants.LEADING)) ||
                (!ltr && (hAlign == SwingConstants.TRAILING)));
    }
    return false;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:10,代码来源:LayoutStyle.java

示例10: 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
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:CrossBorderLayout.java

示例11: 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
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:CrossBorderLayout.java

示例12: calculatePadding

public void calculatePadding(int axis) {
    size = UNSET;
    int maxPadding = UNSET;
    if (matches != null) {
        LayoutStyle p = getLayoutStyle0();
        int position;
        if (axis == HORIZONTAL) {
            if (isLeftToRight()) {
                position = SwingConstants.EAST;
            } else {
                position = SwingConstants.WEST;
            }
        } else {
            position = SwingConstants.SOUTH;
        }
        for (int i = matches.size() - 1; i >= 0; i--) {
            AutopaddingMatch match = (AutopaddingMatch)matches.get(i);
            maxPadding = Math.max(maxPadding,
                    calculatePadding(p, position, match.source,
                    match.target));
        }
    }
    if (size == UNSET) {
        size = 0;
    }
    if (maxPadding == UNSET) {
        maxPadding = 0;
    }
    if (lastSize != UNSET) {
        size += Math.min(maxPadding, lastSize);
    }
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:32,代码来源:GroupLayout.java

示例13: dluToPixels

private int dluToPixels(int dlu, int direction) {
    if (baseUnitX == 0) {
        calculateBaseUnits();
    }
    if (direction == SwingConstants.EAST ||
                     direction == SwingConstants.WEST) {
        return dlu * baseUnitX / 4;
    }
    assert (direction == SwingConstants.NORTH ||
            direction == SwingConstants.SOUTH);
    return dlu * baseUnitY / 8;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:12,代码来源:WindowsLayoutStyle.java

示例14: 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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:65,代码来源:GlassPane.java

示例15: isWest

private static boolean isWest(Integer[] constraints) {
    return constraints[1] == SwingConstants.WEST;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:CrossBorderLayout.java


注:本文中的javax.swing.SwingConstants.WEST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。