本文整理汇总了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;
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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
}
}
示例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
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例13: getScrollOrientation
@Override
public int getScrollOrientation() {
return SwingConstants.VERTICAL;
}
示例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);
}
示例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);
}