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 --"); } }
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; }
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); }
private void imageRight() { final JScrollBar bar = scrollPane.getHorizontalScrollBar(); bar.setValue(bar.getValue() + bar.getBlockIncrement()); }
private void imageLeft() { final JScrollBar bar = scrollPane.getHorizontalScrollBar(); bar.setValue(bar.getValue() - bar.getBlockIncrement()); }
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); }
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); } } }); } }
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); }
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()); // ...
public void setHScrollSpeed(int unitIncrement) { if (jScrollPane1 != null) { jScrollPane1.getHorizontalScrollBar().setUnitIncrement(unitIncrement); } }
private void setGUISize() { jScrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); jScrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize)); cardDimension = GUISizeHelper.battlefieldCardMaxDimension; }
private void setGUISize() { if (jScrollPane1 != null) { jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize)); } }
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(); }
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)); }
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); }
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(); }
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); } }
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()); }
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()); }
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()); }