本文整理汇总了Java中javax.swing.JScrollPane.getVerticalScrollBar方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.getVerticalScrollBar方法的具体用法?Java JScrollPane.getVerticalScrollBar怎么用?Java JScrollPane.getVerticalScrollBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.getVerticalScrollBar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: componentMoved
import javax.swing.JScrollPane; //导入方法依赖的package包/类
@Override
public void componentMoved(ComponentEvent e) {
if(timer == null) {
JScrollPane scrollPane = getScrollPane();
if(scrollPane == null) {
change();
} else {
scrollBar = scrollPane.getVerticalScrollBar();
if(scrollBar == null ||
!scrollBar.getValueIsAdjusting()) {
// Try the horizontal scrollbar.
if((scrollBar = scrollPane.getHorizontalScrollBar())
!= null && scrollBar.getValueIsAdjusting()) {
startTimer();
} else {
change();
}
} else {
startTimer();
}
}
}
}
示例2: func_164247_a
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_)
{
if (!SwingUtilities.isEventDispatchThread())
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
MinecraftServerGui.this.func_164247_a(p_164247_1_, p_164247_2_, p_164247_3_);
}
});
}
else
{
Document document = p_164247_1_.getDocument();
JScrollBar jscrollbar = p_164247_2_.getVerticalScrollBar();
boolean flag = false;
if (p_164247_2_.getViewport().getView() == p_164247_1_)
{
flag = (double)jscrollbar.getValue() + jscrollbar.getSize().getHeight() + (double)(serverGuiFont.getSize() * 4) > (double)jscrollbar.getMaximum();
}
try
{
document.insertString(document.getLength(), p_164247_3_, (AttributeSet)null);
}
catch (BadLocationException var8)
{
;
}
if (flag)
{
jscrollbar.setValue(Integer.MAX_VALUE);
}
}
}
示例3: scrollToTop
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* Scrolls scroll pane to the top left corner.
*/
public static void scrollToTop(final JScrollPane scrollPane) {
JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
JScrollBar horizontalScrollBar = scrollPane.getHorizontalScrollBar();
verticalScrollBar.setValue(verticalScrollBar.getMinimum());
horizontalScrollBar.setValue(horizontalScrollBar.getMinimum());
}
示例4: appendLine
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public void appendLine(final JTextArea textArea, final JScrollPane scrollPane, final String line)
{
try
{
latch.await();
} catch (InterruptedException e){} //Prevent logging until after constructor has ended.
if (!SwingUtilities.isEventDispatchThread())
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
MinecraftServerGui.this.appendLine(textArea, scrollPane, line);
}
});
}
else
{
Document document = textArea.getDocument();
JScrollBar jscrollbar = scrollPane.getVerticalScrollBar();
boolean flag = false;
if (scrollPane.getViewport().getView() == textArea)
{
flag = (double)jscrollbar.getValue() + jscrollbar.getSize().getHeight() + (double)(SERVER_GUI_FONT.getSize() * 4) > (double)jscrollbar.getMaximum();
}
try
{
document.insertString(document.getLength(), line, (AttributeSet)null);
}
catch (BadLocationException var8)
{
;
}
if (flag)
{
jscrollbar.setValue(Integer.MAX_VALUE);
}
}
}