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


Java SwingConstants.VERTICAL屬性代碼示例

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


在下文中一共展示了SwingConstants.VERTICAL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getScrollableUnitIncrement

@Override
public int getScrollableUnitIncrement( Rectangle visibleRect, int orientation, int direction ) {
    int res = 0;
    if( orientation == SwingConstants.VERTICAL ) {
        res = getRowHeight() / 2;
    } else {
        Point columnPoint = visibleRect.getLocation();
        columnPoint.x += 1;
        int col = columnAtPoint( columnPoint );
        if( col >= 0 ) {
            Rectangle rect = getCellRect( 0, col, true );
            res = rect.width / 2;
        } else {
            res = super.getScrollableUnitIncrement( visibleRect, orientation, direction );
        }
    }
    if( direction < 0 )
        res *= -1;
    return res;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:TabTable.java

示例2: getScrollableBlockIncrement

@Override
public int getScrollableBlockIncrement(Rectangle vis, int orientation, int direction) {
	if (orientation == SwingConstants.VERTICAL) {
		int height = measures.getCellHeight();
		if (height < 1) {
			measures.recompute();
			height = measures.getCellHeight();
			if (height < 1)
				return 19 * vis.height / 20;
		}
		int lines = Math.max(1, (vis.height / height) - 1);
		return lines * height;
	} else {
		return 19 * vis.width / 20;
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:16,代碼來源:HexEditor.java

示例3: getUI

@Override
public JComponent getUI() {
	
	JPanel out = new JPanel(new BorderLayout());
	
	int MAX = 1000;
	final JSlider s = new JSlider(SwingConstants.VERTICAL, 0, MAX, sliderValue);
	
	s.addChangeListener(new ChangeListener() {
		@Override
		public void stateChanged(ChangeEvent e) {
			sliderValue = s.getValue();
			setHeight( sliderValue / (float) MAX);
		}
	});

	out.add(s, BorderLayout.WEST);
	
	return s;
}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:20,代碼來源:LineGen.java

示例4: paint

@Override
public void paint(Graphics g, JComponent c)
{
	JSeparator sep = (JSeparator) c;
	Dimension dim = sep.getSize();

	g.setColor(sep.getForeground());

	if( sep.getOrientation() == SwingConstants.VERTICAL )
	{
		int x = dim.width / 2;
		g.drawLine(x, 0, x, dim.height);
	}
	else
	{
		int y = dim.height / 2;
		g.drawLine(0, y, dim.width, y);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:19,代碼來源:FlatterSeparatorUI.java

示例5: getScrollableUnitIncrement

@Override
public int getScrollableUnitIncrement(
        Rectangle visible, int orientation, int direction) {
    switch (orientation) {
        case SwingConstants.HORIZONTAL:
            return visible.width * 10 / 100;
        case SwingConstants.VERTICAL:
            return visible.height * 10 / 100;
        default:
            throw new IllegalArgumentException("Invalid orientation: " + orientation); //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ScrollableJPanel.java

示例6: getScrollableBlockIncrement

@Override
public int getScrollableBlockIncrement(
        Rectangle visible, int orientation, int direction) {
    switch (orientation) {
        case SwingConstants.HORIZONTAL:
            return visible.width * 100 / 100;
        case SwingConstants.VERTICAL:
            return visible.height * 100 / 100;
        default:
            throw new IllegalArgumentException("Invalid orientation: " + orientation); //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ScrollableJPanel.java

示例7: getScrollableUnitIncrement

/**
 * fix for #38139. 
 * returns height of a line for vertical scroll unit
 * or width of a widest char for a horizontal scroll unit
 */
@Override
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
    switch (orientation) {
        case SwingConstants.VERTICAL:
            return fontHeight;
        case SwingConstants.HORIZONTAL:
            return charWidth;
        default:
            throw new IllegalArgumentException("Invalid orientation: " +orientation);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:QuietEditorPane.java

示例8: getScrollableUnitIncrement

@Override
public int getScrollableUnitIncrement(Rectangle vis, int orientation, int direction) {
	if (orientation == SwingConstants.VERTICAL) {
		int ret = measures.getCellHeight();
		if (ret < 1) {
			measures.recompute();
			ret = measures.getCellHeight();
			if (ret < 1)
				return 1;
		}
		return ret;
	} else {
		return Math.max(1, vis.width / 20);
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:HexEditor.java

示例9: getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
			int orientation, int direction) {
	if( orientation == SwingConstants.VERTICAL) return visibleRect.height/2;
	int dx = visibleRect.width/2;
	int newX = visibleRect.x + (direction>0 ? dx : -dx);
	if( wrap>0. ) {
		dx = (int) (wrap*zoom);
		int test = getPreferredSize().width - visibleRect.width;
		while( newX<0 ) newX += dx;
		while( newX>test ) newX -= dx;
	}
	return (direction>0) ? (newX-visibleRect.x) : -(newX-visibleRect.x);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:13,代碼來源:XMap.java

示例10: addToBar

private void addToBar(JComponent comp, int pos, boolean priority, boolean separator)
{
	JPanel panel = getPanel(pos);
	JSeparator sep = new JSeparator(SwingConstants.VERTICAL);
	sep.setPreferredSize(new Dimension(3, image.getIconHeight()));
	comp.setBorder(new EmptyBorder(0, 5, 0, 5));
	boolean sepFirst = false;
	int loc = -1;

	// This could all be done nicer, but who cares if it works?
	if( pos == SwingConstants.RIGHT )
	{
		if( priority )
		{
			sepFirst = true;
		}
		else
		{
			loc = 0;
		}
	}
	else
	{
		if( priority )
		{
			loc = 0;
			sepFirst = true;
		}
	}

	if( sepFirst && separator )
	{
		panel.add(sep, loc);
	}
	panel.add(comp, loc);
	if( !sepFirst && separator )
	{
		panel.add(sep, loc);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:40,代碼來源:JStatusBar.java

示例11: getPreferredSize

@Override
public Dimension getPreferredSize(JComponent c)
{
	if( ((JSeparator) c).getOrientation() == SwingConstants.VERTICAL )
	{
		return new Dimension(1, 0);
	}
	else
	{
		return new Dimension(0, 1);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:12,代碼來源:FlatterSeparatorUI.java

示例12: getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect,
			int orientation, int direction) {
	if( orientation == SwingConstants.VERTICAL) return 10;
	int newX = visibleRect.x + (direction>0 ? 10 : -10);
	if( wrap>0. ) {
		int dx = (int) (wrap*zoom);
		int test = getPreferredSize().width - visibleRect.width;
		while( newX<0 ) newX += dx;
		while( newX>test ) newX -= dx;
	}
	return (direction>0) ? (newX-visibleRect.x) : -(newX-visibleRect.x);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:12,代碼來源:XMap.java

示例13: getScrollOrientation

@Override
public int getScrollOrientation() {
    return SwingConstants.VERTICAL;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:JSpinnerOperator.java

示例14: getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
	int hundredth = (orientation == SwingConstants.VERTICAL ? getParent().getHeight() : getParent().getWidth()) / 100;
	return (hundredth == 0 ? 1 : hundredth);
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:4,代碼來源:WarningWindow.java

示例15: includeSeparator

private void includeSeparator() {
  JSeparator separator = new JSeparator(SwingConstants.VERTICAL);
  separator.setPreferredSize(new Dimension(2, 14));
  this.panel.add(separator);
  this.panel.add(FileType.label);
}
 
開發者ID:maumss,項目名稱:file-type-plugin,代碼行數:6,代碼來源:FileType.java


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