本文整理了Java中javax.swing.JScrollPane.getHorizontalScrollBar()
方法的一些代码示例,展示了JScrollPane.getHorizontalScrollBar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.getHorizontalScrollBar()
方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:getHorizontalScrollBar
暂无
代码示例来源:origin: JetBrains/ideavim
private void scrollOffset(int more) {
myAtEnd = false;
int val = myScrollPane.getVerticalScrollBar().getValue();
myScrollPane.getVerticalScrollBar().setValue(val + more);
myScrollPane.getHorizontalScrollBar().setValue(0);
if (val + more >=
myScrollPane.getVerticalScrollBar().getMaximum() - myScrollPane.getVerticalScrollBar().getVisibleAmount()) {
myAtEnd = true;
myLabel.setText("Hit ENTER or type command to continue");
}
else {
myLabel.setText("-- MORE --");
}
}
代码示例来源:origin: kiegroup/optaplanner
private Container createContentPane() {
JPanel contentPane = new JPanel(new BorderLayout(5, 5));
contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JLabel titleLabel = new JLabel("Which example do you want to see?", JLabel.CENTER);
titleLabel.setFont(titleLabel.getFont().deriveFont(20.0f));
contentPane.add(titleLabel, BorderLayout.NORTH);
JScrollPane examplesScrollPane = new JScrollPane(createExamplesPanel());
examplesScrollPane.getHorizontalScrollBar().setUnitIncrement(20);
examplesScrollPane.getVerticalScrollBar().setUnitIncrement(20);
examplesScrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
contentPane.add(examplesScrollPane, BorderLayout.CENTER);
JPanel bottomPanel = new JPanel(new BorderLayout(5, 5));
bottomPanel.add(createDescriptionPanel(), BorderLayout.CENTER);
bottomPanel.add(createExtraPanel(), BorderLayout.EAST);
contentPane.add(bottomPanel, BorderLayout.SOUTH);
return contentPane;
}
代码示例来源:origin: stanfordnlp/CoreNLP
private DisplayMatchesPanel() {
//data
JPanel spaceholder = new JPanel();
spaceholder.setBackground(Color.white);
JTextArea message = new JTextArea("For non-English trees, first set up the tree reader and encoding in Preferences. Then load trees from the File menu.");
message.setEditable(false);
spaceholder.add(message);
scroller = new JScrollPane(spaceholder);
// Fix slow scrolling on OS X
if (TregexGUI.isMacOSX()) {
scroller.getVerticalScrollBar().setUnitIncrement(3);
scroller.getHorizontalScrollBar().setUnitIncrement(3);
}
this.setFocusable(true);
this.setTransferHandler(new DisplayTransferHandler());
MatchesPanel.getInstance().addListener(this);
//layout
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(),""));
this.add(scroller, BorderLayout.CENTER);
}
代码示例来源:origin: plantuml/plantuml
private void imageRight() {
final JScrollBar bar = scrollPane.getHorizontalScrollBar();
bar.setValue(bar.getValue() + bar.getBlockIncrement());
}
代码示例来源:origin: plantuml/plantuml
private void imageLeft() {
final JScrollBar bar = scrollPane.getHorizontalScrollBar();
bar.setValue(bar.getValue() - bar.getBlockIncrement());
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void showMatchedPart(int idx) {
Point2D.Double coord = matchedPartCoordinates.get(idx);
Dimension treeSize = tjp.getPreferredSize();
JScrollBar horizontal = scroller.getHorizontalScrollBar();
JScrollBar vertical = scroller.getVerticalScrollBar();
int horizontalLength = horizontal.getMaximum() - horizontal.getMinimum();
double x = Math.max(0,
(coord.getX() / treeSize.getWidth() * horizontalLength
- (scroller.getWidth() / 2.0)));
int verticalLength = vertical.getMaximum() - vertical.getMinimum();
double y = Math.max(0,
(coord.getY() / treeSize.getHeight() * verticalLength
- (scroller.getHeight() / 2.0)));
horizontal.setValue((int) x);
vertical.setValue((int) y);
}
代码示例来源:origin: plantuml/plantuml
public void refreshImage(boolean external) {
final JScrollBar bar1 = scrollPane.getVerticalScrollBar();
final JScrollBar bar2 = scrollPane.getHorizontalScrollBar();
if (external && isError() == false) {
v1 = bar1.getValue();
v2 = bar2.getValue();
}
scrollPane.setViewportView(buildScrollablePicture());
force();
if (external) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
refreshSimpleLine();
if (isError() == false) {
bar1.setValue(v1);
bar2.setValue(v2);
}
}
});
}
}
代码示例来源:origin: chewiebug/GCViewer
public ChartPanelView(final GCPreferences preferences, final GCResource gcResource) {
this.gcResource = gcResource;
this.modelDetailsPanel = new ModelDetailsPanel();
this.modelChart = new ModelChartImpl();
this.preferences = preferences;
this.modelMetricsPanel = new ModelMetricsPanel();
this.modelLoaderView = new GCModelLoaderView(gcResource);
JScrollPane modelDetailsScrollPane = new JScrollPane(modelDetailsPanel,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JScrollBar hScrollBar = modelDetailsScrollPane.getHorizontalScrollBar();
hScrollBar.setUnitIncrement(10);
JScrollBar vScrollBar = modelDetailsScrollPane.getVerticalScrollBar();
vScrollBar.setUnitIncrement(10);
this.modelChartAndDetailsPanel = new JTabbedPane();
this.modelChartAndDetailsPanel.addTab(LocalisationHelper.getString("data_panel_tab_chart"), modelChart);
this.modelChartAndDetailsPanel.addTab(LocalisationHelper.getString("data_panel_tab_details"), modelDetailsScrollPane);
this.modelChartAndDetailsPanel.addTab(LocalisationHelper.getString("data_panel_tab_parser"), modelLoaderView);
this.viewBar = new ViewBar(this);
this.propertyChangeSupport = new SwingPropertyChangeSupport(this);
setGcResource(gcResource);
updateTabDisplay(gcResource);
}
代码示例来源:origin: stackoverflow.com
JTextPane leftDiffPane = diffPane1;
JTextPane rightDiffPane = diffPane2;
JScrollPane spLeft = new JScrollPane(leftDiffPane, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
JScrollPane spRight = new JScrollPane(leftDiffPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
spLeft.getHorizontalScrollBar().setModel(spRight.getHorizontalScrollBar().getModel());
spLeft.getVerticalScrollBar().setModel(spRight.getVerticalScrollBar().getModel());
// ...
代码示例来源:origin: magefree/mage
public void setHScrollSpeed(int unitIncrement) {
if (jScrollPane1 != null) {
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(unitIncrement);
}
}
代码示例来源:origin: magefree/mage
private void setGUISize() {
jScrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
cardDimension = GUISizeHelper.battlefieldCardMaxDimension;
}
代码示例来源:origin: magefree/mage
private void setGUISize() {
if (jScrollPane1 != null) {
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
}
代码示例来源:origin: magefree/mage
private void setGUISize() {
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
hand.setCardDimension(GUISizeHelper.handCardDimension);
hand.changeGUISize();
}
代码示例来源:origin: magefree/mage
private void setGUISize() {
jTableSeats.getTableHeader().setFont(GUISizeHelper.tableFont);
jTableSeats.setFont(GUISizeHelper.tableFont);
jTableSeats.setRowHeight(GUISizeHelper.getTableRowHeight());
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
代码示例来源:origin: magefree/mage
private void setGUISize() {
jTablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
jTablePlayers.setFont(GUISizeHelper.tableFont);
jTablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight());
jScrollPanePlayers.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPanePlayers.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
jScrollPaneSystem.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPaneSystem.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
jTabbedPaneText.setFont(GUISizeHelper.getTabFont());
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
}
代码示例来源:origin: magefree/mage
private void setGUISize() {
tablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
tablePlayers.setFont(GUISizeHelper.tableFont);
tablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight());
tableMatches.getTableHeader().setFont(GUISizeHelper.tableFont);
tableMatches.setFont(GUISizeHelper.tableFont);
tableMatches.setRowHeight(GUISizeHelper.getTableRowHeight());
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
jScrollPane2.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane2.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
actionButtonColumn1.changeGUISize();
}
代码示例来源:origin: magefree/mage
public void changeGUISize(Font font) {
txtConversation.setFont(font);
txtMessage.setFont(font);
if (jScrollPaneTxt != null) {
jScrollPaneTxt.setFont(font);
jScrollPaneTxt.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPaneTxt.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
int height = 30;
if (font.getSize() > 20) {
height = 30 + Math.min(font.getSize() - 10, 30);
}
txtMessage.setMinimumSize(new Dimension(20, height));
txtMessage.setMaximumSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setPreferredSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setSize(new Dimension(txtMessage.getWidth(), height));
if (connectedChat != null) {
connectedChat.changeGUISize(font);
}
}
代码示例来源:origin: magefree/mage
public AbilityPicker() {
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
initComponents();
jScrollPane2.setOpaque(false);
jScrollPane2.getViewport().setOpaque(false);
UIManager.put("ScrollBar.width", 17);
jScrollPane2.getHorizontalScrollBar().setUI(new MageScrollbarUI());
jScrollPane2.getVerticalScrollBar().setUI(new MageScrollbarUI());
}
代码示例来源:origin: magefree/mage
public AbilityPicker(List<Object> choices, String message) {
this.choices = choices;
setSize(DIALOG_WIDTH, DIALOG_HEIGHT);
if (message != null) {
this.message = message + " (single-click)";
}
initComponents();
jScrollPane2.setOpaque(false);
jScrollPane2.getViewport().setOpaque(false);
UIManager.put("ScrollBar.width", 17);
jScrollPane2.getHorizontalScrollBar().setUI(new MageScrollbarUI());
jScrollPane2.getVerticalScrollBar().setUI(new MageScrollbarUI());
}
代码示例来源:origin: magefree/mage
public void initComponents() {
hand = new mage.client.cards.Cards(true);
hand.setMinOffsetY(HAND_MIN_CARDS_OFFSET_Y);
hand.setCardDimension(GUISizeHelper.handCardDimension);
jPanel = new JPanel();
jScrollPane1 = new JScrollPane(jPanel);
jScrollPane1.getViewport().setBackground(new Color(0, 0, 0, 0));
jPanel.setLayout(new GridBagLayout()); // centers hand
jPanel.setBackground(new Color(0, 0, 0, 0));
jPanel.add(hand);
setOpaque(false);
jPanel.setOpaque(false);
jScrollPane1.setOpaque(false);
jPanel.setBorder(EMPTY_BORDER);
jScrollPane1.setBorder(EMPTY_BORDER);
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(8);
jScrollPane1.setViewportBorder(EMPTY_BORDER);
setLayout(new BorderLayout());
add(jScrollPane1, BorderLayout.CENTER);
hand.setHScrollSpeed(8);
hand.setBackgroundColor(new Color(0, 0, 0, 0));
hand.setVisibleIfEmpty(false);
hand.setBorder(EMPTY_BORDER);
hand.setZone(Zone.HAND.toString());
}
内容来源于网络,如有侵权,请联系作者删除!