List of usage examples for javax.swing JScrollBar getMaximum
public int getMaximum()
From source file:ca.uhn.hl7v2.testpanel.ui.editor.Hl7V2MessageEditorPanel.java
private void updateMessageEditor() { final JScrollBar vsb = myMessageScrollPane.getVerticalScrollBar(); int initialVerticalValue = vsb.getValue(); myMessageEditor.getDocument().removeDocumentListener(myDocumentListener); String sourceMessage = myMessage.getSourceMessage(); if (myMessage.getEncoding() == Hl7V2EncodingTypeEnum.XML) { myMessageEditor.setContentType("text/xml"); } else {//from w ww.j a va 2s. c o m myMessageEditor.setContentType("text/er7"); sourceMessage = sourceMessage.replace('\r', '\n'); } myMessageEditor.setText(sourceMessage); myMessageEditor.getDocument().addDocumentListener(myDocumentListener); final int verticalValue = Math.min(initialVerticalValue, vsb.getMaximum()); SwingUtilities.invokeLater(new Runnable() { public void run() { // myMessageEditor.setFont(Prefs.getHl7EditorFont()); vsb.setValue(verticalValue); } }); }
From source file:br.com.jinsync.view.FrmJInSync.java
private void rollScroll() { SwingUtilities.invokeLater(new Runnable() { @Override//from w w w .j ava 2s . com public void run() { JScrollBar temp = scrConsole.getVerticalScrollBar(); temp.setValue(temp.getMaximum()); } }); }
From source file:com.qspin.qtaste.ui.reporter.TestCaseReportTable.java
public void putEntry(TestResult tr, String campaignReportName) { boolean isInteractiveCommand = tr.getTestCaseDirectory().endsWith("QTaste_interactive"); String testReportName = TestResultsReportManager.getInstance().getReportName(); boolean isManualSUTStartOrStop = testReportName != null && testReportName.startsWith("Manual SUT"); if (interactive) { if (!isInteractiveCommand && !isManualSUTStartOrStop) { return; }//from www .j ava2 s . co m } else { if (isInteractiveCommand) { return; } if (campaignReportName != null && !campaignReportName.equals(runName)) { return; } if (campaignReportName == null && !runName.equals("Run1")) { return; } } if (!testCases.containsKey(tr)) { Object[] cols = new Object[7]; cols[TEST_CASE] = convertToUniqueTc(tr); cols[DETAILS] = tr.getExtraResultDetails(); if (tr.getReturnValue() != null) { cols[RESULT] = tr.getReturnValue(); } cols[STATUS] = getImage(tr.getStatus()); if (tr.getStatus() != TestResult.Status.RUNNING) { cols[EXEC_TIME] = tr.getFormattedElapsedTime(false); } TestBedConfiguration testbed = TestBedConfiguration.getInstance(); cols[TESTBED] = testbed.getFile().getName().replace("." + StaticConfiguration.CAMPAIGN_FILE_EXTENSION, ""); cols[TC] = tr; //tcModel.addRow(cols); Integer rowNum = new Integer(tcModel.getRowCount()); testCases.put(tr, rowNum); long currentScrollBarMax = 0; JScrollPane scrollPane = (JScrollPane) tcTable.getParent().getParent(); JScrollBar scrollbar = scrollPane.getVerticalScrollBar(); if (scrollbar != null) { if (scrollbar.getMouseListeners().length == 1) { scrollPane.addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent e) { userScrollPosition = true; } }); scrollbar.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { userScrollPosition = true; } @Override public void mousePressed(MouseEvent e) { userScrollPosition = true; } }); } currentScrollBarMax = scrollbar.getMaximum() - scrollbar.getSize().height - tcTable.getRowHeight(); tcModel.addRow(cols); if (!userScrollPosition) { tcTable.scrollRectToVisible(tcTable.getCellRect(tcModel.getRowCount() - 1, 0, true)); return; } else if (scrollbar.getValue() >= currentScrollBarMax) { tcTable.scrollRectToVisible(tcTable.getCellRect(tcModel.getRowCount() - 1, 0, true)); userScrollPosition = false; return; } else { System.out.println("Scrollbar pos=" + scrollbar.getValue() + "; max=" + currentScrollBarMax + "height=" + scrollbar.getSize().height); } } else { tcModel.addRow(cols); } } else { updateTestCaseRow(tr); } }
From source file:org.forester.archaeopteryx.ControlPanel.java
void zoomOutY(final float factor) { final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor(0.9f);// w ww . j a va 2s . c om if ((treepanel.getYdistance() * factor) > 0.0) { final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar(); final double x = (sb.getMaximum() - sb.getMinimum()) / (sb.getValue() + (sb.getVisibleAmount() / 2.0)); treepanel.setYdistance((treepanel.getYdistance() * factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(ForesterUtil .roundToInt(((sb.getMaximum() - sb.getMinimum()) / x) - (sb.getVisibleAmount() / 2.0))); treepanel.resetPreferredSize(); treepanel.updateOvSizes(); } }
From source file:org.forester.archaeopteryx.ControlPanel.java
void zoomInY(final float factor) { final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar(); final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor(1.1f);//from w ww . java2s .c o m final double x = (sb.getMaximum() - sb.getMinimum()) / (sb.getValue() + (sb.getVisibleAmount() / 2.0)); treepanel.setYdistance((treepanel.getYdistance() * factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue( ForesterUtil.roundToInt(((sb.getMaximum() - sb.getMinimum()) / x) - (sb.getVisibleAmount() / 2.0))); treepanel.resetPreferredSize(); treepanel.updateOvSizes(); }
From source file:com.declarativa.interprolog.gui.ListenerWindow.java
public void scrollToBottom() { if (prologOutput.isShowing()) { prologOutput//from ww w. j ava2 s.c o m .setCaretPosition(prologOutput.getDocument().getEndPosition().getOffset() - 1 /* OBOB hack */); try { // If we're in a JScrollPane, force scrolling to bottom and left JScrollBar scrollbarV = ((JScrollPane) ((JViewport) (prologOutput.getParent())).getParent()) .getVerticalScrollBar(); scrollbarV.setValue(scrollbarV.getMaximum()); JScrollBar scrollbarH = ((JScrollPane) ((JViewport) (prologOutput.getParent())).getParent()) .getHorizontalScrollBar(); scrollbarH.setValue(scrollbarH.getMinimum()); } catch (Exception e) {/* We're not in a JScrollPane, forget it! */ } ; } }
From source file:org.forester.archaeopteryx.ControlPanel.java
void zoomInX(final float factor, final float x_correction_factor) { final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar(); final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor(1f);//w ww. ja va2s . com if ((treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR) || (treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED) || isDrawPhylogram(getMainPanel().getCurrentTabIndex()) || (getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP)) { final double x = (sb.getMaximum() - sb.getMinimum()) / (sb.getValue() + (sb.getVisibleAmount() / 2.0)); treepanel.setXdistance((treepanel.getXdistance() * factor)); treepanel.setXcorrectionFactor((treepanel.getXcorrectionFactor() * x_correction_factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(ForesterUtil .roundToInt(((sb.getMaximum() - sb.getMinimum()) / x) - (sb.getVisibleAmount() / 2.0))); } else { final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue(); treepanel.setXdistance((treepanel.getXdistance() * factor)); treepanel.setXcorrectionFactor((treepanel.getXcorrectionFactor() * x_correction_factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount()); } treepanel.resetPreferredSize(); treepanel.updateOvSizes(); }
From source file:org.forester.archaeopteryx.ControlPanel.java
void zoomOutX(final float factor, final float x_correction_factor) { final TreePanel treepanel = getMainPanel().getCurrentTreePanel(); treepanel.multiplyUrtFactor(1f);//from ww w . j a v a2s . com if ((treepanel.getXdistance() * factor) > 0.0) { final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar(); if ((treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR) || (treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED) || isDrawPhylogram(getMainPanel().getCurrentTabIndex()) || (getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP)) { getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); final double x = (sb.getMaximum() - sb.getMinimum()) / (sb.getValue() + (sb.getVisibleAmount() / 2.0)); treepanel.setXdistance((treepanel.getXdistance() * factor)); treepanel.setXcorrectionFactor((treepanel.getXcorrectionFactor() * x_correction_factor)); getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(ForesterUtil .roundToInt(((sb.getMaximum() - sb.getMinimum()) / x) - (sb.getVisibleAmount() / 2.0))); } else { final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue(); treepanel.setXdistance(treepanel.getXdistance() * factor); treepanel.setXcorrectionFactor(treepanel.getXcorrectionFactor() * x_correction_factor); if (x > 0) { getMainPanel().adjustJScrollPane(); treepanel.resetPreferredSize(); getMainPanel().getCurrentScrollPane().getViewport().validate(); sb.setValue(sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount()); } } treepanel.resetPreferredSize(); treepanel.updateOvSizes(); } }
From source file:eu.crisis_economics.abm.dashboard.Page_Parameters.java
private void addBox() { final JPanel panel = createAParameterBox(false); combinationsPanel.add(panel);/*from w w w . ja v a 2 s . c o m*/ combinationsPanel.revalidate(); combinationsScrPane.invalidate(); combinationsScrPane.validate(); final JScrollBar verticalScrollBar = combinationsScrPane.getVerticalScrollBar(); verticalScrollBar.setValue(verticalScrollBar.getMaximum()); }
From source file:eu.crisis_economics.abm.dashboard.Page_Parameters.java
void showHideSubparameters(final JComboBox combobox, final SubmodelInfo info) { if (!combobox.isDisplayable()) { return;/*from w w w. j a v a2 s . co m*/ } final ClassElement classElement = (ClassElement) combobox.getSelectedItem(); info.setActualType(classElement.clazz, classElement.instance); final int level = calculateParameterLevel(info); for (int i = singleRunParametersPanel.getComponentCount() - 1; i >= level + 1; --i) singleRunParametersPanel.remove(i); if (classElement.clazz != null) { try { final List<ai.aitia.meme.paramsweep.batch.param.ParameterInfo<?>> subparameters = ParameterTreeUtils .fetchSubparameters(currentModelHandler, info); String title = "Configure " + info.getName().replaceAll("([A-Z])", " $1").trim(); createAndDisplayAParameterPanel(subparameters, title, info, true, currentModelHandler); } catch (final ModelInformationException e) { info.setActualType(null, null); JOptionPane.showMessageDialog(wizard, new JLabel(e.getMessage()), "Error while analyizing model", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); combobox.setSelectedIndex(0); } } parametersScrollPane.invalidate(); parametersScrollPane.validate(); final JScrollBar horizontalScrollBar = parametersScrollPane.getHorizontalScrollBar(); horizontalScrollBar.setValue(horizontalScrollBar.getMaximum()); }