本文整理匯總了Java中javax.swing.SwingConstants.TOP屬性的典型用法代碼示例。如果您正苦於以下問題:Java SwingConstants.TOP屬性的具體用法?Java SwingConstants.TOP怎麽用?Java SwingConstants.TOP使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.swing.SwingConstants
的用法示例。
在下文中一共展示了SwingConstants.TOP屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paintComponent
protected void paintComponent(Graphics graphics) {
graphics.setColor(getBackground());
graphics.fillRect(0, 0, getWidth(), getHeight());
switch (imageAlign) {
case (SwingConstants.TOP):
graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this);
break;
case (SwingConstants.BOTTOM):
graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, getHeight() - image.getHeight(null), this);
break;
default:
graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this);
}
}
示例2: paintTabBorderSelected
private void paintTabBorderSelected(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h) {
if (tabPlacement == SwingConstants.TOP) {
paintSelectedTop(g, x, y, w, h);
} else if (tabPlacement == SwingConstants.LEFT) {
paintSelectedLeft(g, x, y, w, h);
} else if (tabPlacement == SwingConstants.RIGHT) {
paintSelectedRight(g, x, y, w, h);
} else {
paintSelectedBottom(g, x, y, w, h);
}
}
示例3: ImagePanel
public ImagePanel(Image image) {
this(image, SwingConstants.TOP);
}
示例4: ExtendedJTabbedPane
public ExtendedJTabbedPane() {
super(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
}