當前位置: 首頁>>代碼示例>>Java>>正文


Java SwingConstants.NORTH屬性代碼示例

本文整理匯總了Java中javax.swing.SwingConstants.NORTH屬性的典型用法代碼示例。如果您正苦於以下問題:Java SwingConstants.NORTH屬性的具體用法?Java SwingConstants.NORTH怎麽用?Java SwingConstants.NORTH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.SwingConstants的用法示例。


在下文中一共展示了SwingConstants.NORTH屬性的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: AxisComponent

public AxisComponent(ChartComponent chart, AxisMarksComputer marksComputer,
                     AxisMarksPainter marksPainter, int location, int mesh) {

    this.location = location;
    horizontal = location == SwingConstants.NORTH ||
                 location == SwingConstants.SOUTH;

    this.chart = chart;
    this.marksComputer = marksComputer;
    this.marksPainter = marksPainter;

    setOpaque(false);

    chart.addConfigurationListener(new ChartListener());

    if (mesh == MESH_BACKGROUND) chart.addPreDecorator(createMeshPainter());
    else if (mesh == MESH_FOREGROUND) chart.addPostDecorator(createMeshPainter());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:AxisComponent.java

示例3: 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

示例4: 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

示例5: setVertexLocation

/**
 * Fixes the position of the specified vertex
 *
 * @param cell the vertex to position
 */
protected void setVertexLocation(final mxGraphAbstractHierarchyCell cell) {
  final mxGraphHierarchyNode node = (mxGraphHierarchyNode) cell;
  final Object realCell = node.cell;
  final double positionX = node.x[0] - node.width / 2;
  final double positionY = this.ourConstantValue + node.y[0] - node.height / 2;

  // if (cell.minRank == -1)
  // {
  // System.out.println("invalid rank, never set");
  // }

  this.rankTopY[cell.minRank] = Math.min(this.rankTopY[cell.minRank], positionY);
  this.rankBottomY[cell.minRank] =
      Math.max(this.rankBottomY[cell.minRank], positionY + node.height);

  if (this.orientation == SwingConstants.NORTH || this.orientation == SwingConstants.SOUTH) {
    this.layout.setVertexLocation(realCell, positionX, positionY);
  } else {
    this.layout.setVertexLocation(realCell, positionY, positionX);
  }

  this.limitX = Math.max(this.limitX, positionX + node.width);
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:28,代碼來源:mxCoordinateAssignment.java

示例6: 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

示例7: 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

示例8: paintHorizontalBasis

protected void paintHorizontalBasis(Graphics g, Rectangle clip, Rectangle chartMask) {
    Rectangle dirty = clip.intersection(chartMask);
    g.setColor(getForeground());
    if (location == SwingConstants.NORTH) {
        g.drawLine(dirty.x - 1, getHeight() - 1, dirty.x + dirty.width, getHeight() - 1);
    } else {
        g.drawLine(dirty.x, 0, dirty.x + dirty.width, 0);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:AxisComponent.java

示例9: paintHorizontalTick

protected void paintHorizontalTick(Graphics g, AxisMark mark, int x,
                                   Rectangle clip, Rectangle chartMask) {
    g.setColor(getForeground());
    if (location == SwingConstants.NORTH) {
        g.drawLine(x, getHeight() - 2 - getAxisBasisExtent(), x, getHeight() - 2);
    } else {
        g.drawLine(x, 1, x, 1 + getAxisBasisExtent());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:AxisComponent.java

示例10: 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

示例11: Axis

Axis(TimelineChart chart, MarksComputer marksComputer) {

            super(chart, marksComputer, null, SwingConstants.NORTH,
                  AxisComponent.MESH_FOREGROUND);

            this.chart = chart;
            this.marksComputer = marksComputer;
            this.marksPainter = new TimelineMarksPainter();

            repainter = new Runnable() {
                public void run() { Axis.this.chart.invalidateRepaint(); }
            };
        }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:TimelineAxis.java

示例12: 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);
	}
 
開發者ID:GDSRS,項目名稱:TrabalhoFinalEDA2,代碼行數:32,代碼來源:mxCoordinateAssignment.java

示例13: 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

示例14: isNorth

private static boolean isNorth(Integer[] constraints) {
    return constraints[1] == SwingConstants.NORTH;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:CrossBorderLayout.java

示例15: createNextButton

protected Component createNextButton() {
	JButton c = new BasicArrowButton(SwingConstants.NORTH);
	c.setName("Spinner.nextButton");
	installNextButtonListeners(c);
	return c;
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:6,代碼來源:XDMSpinnerUI.java


注:本文中的javax.swing.SwingConstants.NORTH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。