javax.swing.JScrollPane#setWheelScrollingEnabled ( )源码实例Demo

下面列出了javax.swing.JScrollPane#setWheelScrollingEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: osp   文件: MessageFrame.java
private MessageFrame() {
  // create the panel, text pane and scroller
  setTitle(ControlsRes.getString("MessageFrame.DefaultTitle")); //$NON-NLS-1$
  JPanel logPanel = new JPanel(new BorderLayout());
  logPanel.setPreferredSize(new Dimension(480, 240));
  setContentPane(logPanel);
  logPanel.setPreferredSize(new Dimension(200, 300));
  logPanel.setMinimumSize(new Dimension(100, 100));
  textPane.setEditable(false);
  textPane.setAutoscrolls(true);
  black = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
  red = textPane.addStyle("red", black); //$NON-NLS-1$
  StyleConstants.setForeground(red, DARK_RED);
  blue = textPane.addStyle("blue", black); //$NON-NLS-1$
  StyleConstants.setForeground(blue, DARK_BLUE);
  green = textPane.addStyle("green", black); //$NON-NLS-1$
  StyleConstants.setForeground(green, DARK_GREEN);
  magenta = textPane.addStyle("magenta", black); //$NON-NLS-1$
  StyleConstants.setForeground(magenta, Color.MAGENTA);
  gray = textPane.addStyle("gray", black); //$NON-NLS-1$
  StyleConstants.setForeground(gray, Color.GRAY);
  JScrollPane textScroller = new JScrollPane(textPane);
  textScroller.setWheelScrollingEnabled(true);
  logPanel.add(textScroller, BorderLayout.CENTER);
  pack();
}
 
源代码2 项目: owltools   文件: OortGuiQueryOntologyPanel.java
public OortGuiQueryOntologyPanel(Frame frame, OortConfiguration oortConfiguration) {
	super();
	this.panel = new JPanel();
	this.frame = frame;
	subComponents = new ArrayList<JComponent>();
	
	this.setLayout(new BorderLayout(1, 1));
	JScrollPane scrollPane = new JScrollPane(panel);
	scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	scrollPane.setWheelScrollingEnabled(true);
	this.add(scrollPane, BorderLayout.CENTER);
	
	// Layout
	panel.setLayout(new GridBagLayout());
	GBHelper pos = new GBHelper();
	
	
	
	// add checkbox which activates the following options
	createMainCheckBox(pos);
	addRowGap(panel, pos.nextRow(), 10);
	
	// add query ontology (file or url)
	createFileSelector(pos, subComponents);
	
	addRowGap(panel, pos.nextRow(), 10);
	// get IRI or Label
	createQueryTargetSelector(pos, subComponents);
	
	addRowGap(panel, pos.nextRow(), 10);
	// add reference to IO panel
	createMessageForMainPanel(pos, subComponents);
	
	addRowGap(panel, pos.nextRow().expandH(), 10);
	
	applyConfig(oortConfiguration);
}
 
源代码3 项目: owltools   文件: OortGuiAdvancedPanel.java
/**
 * Create the panel with the given default values.
 * 
 * @param frame 
 * @param oortConfiguration 
 */
public OortGuiAdvancedPanel(Frame frame, OortConfiguration oortConfiguration) {
	super();
	this.frame = frame;
	
	this.panel = new JPanel();
	
	this.setLayout(new BorderLayout(1, 1));
	JScrollPane scrollPane = new JScrollPane(panel);
	scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	scrollPane.setWheelScrollingEnabled(true);
	this.add(scrollPane, BorderLayout.CENTER);
	
	// options flags
	assertedCheckBox = new JCheckBox();
	simpleCheckBox = new JCheckBox();
	expandXrefsCheckBox = new JCheckBox();
	allowOverwrite = new JCheckBox();
	recreateMireot = new JCheckBox();
	repairAnnotationCardinality = new JCheckBox();
	expandShortcutRelations = new JCheckBox();
	writeELOntologyCheckBox = new JCheckBox();
	justifyAssertedSubclasses = new JCheckBox();
	writeSubSets = new JCheckBox();
	gafToOwl = new JCheckBox();
	addSupportFromImports = new JCheckBox();
	
	writeOBO = new JCheckBox();
	writeOWL = new JCheckBox();
	writeOWX = new JCheckBox();
	
	versionReportFiles = new JCheckBox();
	
	catalogXMLField = new JTextField();
	
	// reasoner radio buttons
	hermitRadioButton = new JRadioButton();
	factppRadioButton = new JRadioButton();
	jcelRadioButton = new JRadioButton();
	elkRadioButton = new JRadioButton();
	moreRadioButton = new JRadioButton();
	
	// ontolgy checks
	ontologyCheckBoxes = new HashMap<OntologyCheck, JCheckBox>();
	for (OntologyCheck check : OortConfiguration.getAvailableChecks()) {
		ontologyCheckBoxes.put(check, new JCheckBox(check.getLabel()));
	}
	
	// Layout
	panel.setLayout(new GridBagLayout());
	GBHelper pos = new GBHelper();
	
	// options
	createOptionPanel(pos, 
			"Make original", 
			"<html><p>Also make original ontology in obo and owl.</p>" +
			"<p>In addition to creating the main ontology file <X>, will make a file '<X>-non-classified'</p>" +
			"<p>This is the version does <i>not</i> have the reasoner-inferred links asserted</p></html>",
			"simple", 
			"<html><p>In addition the generating the main ontology, this will make a version</p>" +
			"<p> with all external classes and references to them removed</p></html>");
	addRowGap(panel, pos, 10);
	
	// catalog xml
	createCatalogXMLPanel(pos);
	
	// write format options
	createWriteFormatPanel(pos);
	
	// reasoner
	createReasonerPanel(pos);
	addRowGap(panel, pos, 5);
	
	// set values
	applyConfig(oortConfiguration);
	
}
 
源代码4 项目: rtg-tools   文件: RocPlot.java
/**
 * Creates a new swing plot.
 * @param precisionRecall true defaults to precision recall graph
 * @param interpolate if true, enable curve interpolation
 */
RocPlot(boolean precisionRecall, boolean interpolate) {
  mInterpolate = interpolate;
  mMainPanel = new JPanel();
  UIManager.put("FileChooser.readOnly", Boolean.TRUE);
  mFileChooser = new JFileChooser();
  final Action details = mFileChooser.getActionMap().get("viewTypeDetails");
  if (details != null) {
    details.actionPerformed(null);
  }
  mFileChooser.setMultiSelectionEnabled(true);
  mFileChooser.setFileFilter(new RocFileFilter());
  mZoomPP = new RocZoomPlotPanel();
  mZoomPP.setOriginIsMin(true);
  mZoomPP.setTextAntialiasing(true);
  mProgressBar = new JProgressBar(-1, -1);
  mProgressBar.setVisible(true);
  mProgressBar.setStringPainted(true);
  mProgressBar.setIndeterminate(true);
  mStatusLabel = new JLabel();
  mPopup = new JPopupMenu();
  mRocLinesPanel = new RocLinesPanel(this);
  mScrollPane = new JScrollPane(mRocLinesPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  mScrollPane.setWheelScrollingEnabled(true);
  mLineWidthSlider = new JSlider(JSlider.HORIZONTAL, LINE_WIDTH_MIN, LINE_WIDTH_MAX, 1);
  mScoreCB = new JCheckBox("Show Scores");
  mScoreCB.setSelected(true);
  mSelectAllCB = new JCheckBox("Select / Deselect all");
  mTitleEntry = new JTextField("ROC");
  mTitleEntry.setMaximumSize(new Dimension(Integer.MAX_VALUE, mTitleEntry.getPreferredSize().height));
  mOpenButton = new JButton("Open...");
  mOpenButton.setToolTipText("Add a new curve from a file");
  mCommandButton = new JButton("Cmd...");
  mCommandButton.setToolTipText("Send the equivalent rocplot command-line to the terminal");
  final ImageIcon icon = createImageIcon("com/rtg/graph/resources/realtimegenomics_logo.png", "RTG Logo");
  mIconLabel = new JLabel(icon);
  mIconLabel.setBackground(new Color(16, 159, 205));
  mIconLabel.setForeground(Color.WHITE);
  mIconLabel.setOpaque(true);
  mIconLabel.setFont(new Font("Arial", Font.BOLD, 24));
  mIconLabel.setHorizontalAlignment(JLabel.LEFT);
  mIconLabel.setIconTextGap(50);
  if (icon != null) {
    mIconLabel.setMinimumSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
  }
  mGraphType = new JComboBox<>(new String[] {ROC_PLOT, PRECISION_SENSITIVITY});
  mGraphType.setSelectedItem(precisionRecall ? PRECISION_SENSITIVITY : ROC_PLOT);
  configureUI();
}
 
源代码5 项目: osp   文件: OSPLog.java
/**
 * Creates the GUI.
 */
protected void createGUI() {
  // create the panel, text pane and scroller
  logPanel = new JPanel(new BorderLayout());
  logPanel.setPreferredSize(new Dimension(480, 240));
  setContentPane(logPanel);
  textPane = new JTextPane() {
    public void paintComponent(Graphics g) {
      if(OSPRuntime.antiAliasText) {
        Graphics2D g2 = (Graphics2D) g;
        RenderingHints rh = g2.getRenderingHints();
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      }
      super.paintComponent(g);
    }

  };
  textPane.setEditable(false);
  textPane.setAutoscrolls(true);
  JScrollPane textScroller = new JScrollPane(textPane);
  textScroller.setWheelScrollingEnabled(true);
  logPanel.add(textScroller, BorderLayout.CENTER);
  // create the colored styles
  black = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
  red = textPane.addStyle("red", black); //$NON-NLS-1$
  StyleConstants.setForeground(red, DARK_RED);
  blue = textPane.addStyle("blue", black); //$NON-NLS-1$
  StyleConstants.setForeground(blue, DARK_BLUE);
  green = textPane.addStyle("green", black); //$NON-NLS-1$
  StyleConstants.setForeground(green, DARK_GREEN);
  magenta = textPane.addStyle("magenta", black); //$NON-NLS-1$
  StyleConstants.setForeground(magenta, Color.MAGENTA);
  gray = textPane.addStyle("gray", black); //$NON-NLS-1$
  StyleConstants.setForeground(gray, Color.GRAY);
  // create the logger
  createLogger();
  // create the menus
  createMenus();
  pack();
  textPane.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
      try {
        if(OSPRuntime.isPopupTrigger(e)) {
          // show popup menu
          if(popup!=null) {
          	FontSizer.setFonts(popup, FontSizer.getLevel());
            popup.show(textPane, e.getX(), e.getY()+8);
          }
        }
      } catch(Exception ex) {
        System.err.println("Error in mouse action."); //$NON-NLS-1$
        System.err.println(ex.toString());
        ex.printStackTrace();
      }
    }

  });
}