本文整理了Java中javax.swing.JScrollPane.setWheelScrollingEnabled()
方法的一些代码示例,展示了JScrollPane.setWheelScrollingEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.setWheelScrollingEnabled()
方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:setWheelScrollingEnabled
暂无
代码示例来源:origin: antlr/antlrworks
public Container createTextArea() {
textArea = new JTextArea();
JScrollPane textAreaScrollPane = new JScrollPane(textArea);
textAreaScrollPane.setWheelScrollingEnabled(true);
return textAreaScrollPane;
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
JPanel pane = new JPanel();
JScrollPane scroller = new JScrollPane(pane);
frame.add(BorderLayout.CENTER, scroller);
scroller.setWheelScrollingEnabled(true);
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
frame.setVisible(true);
代码示例来源:origin: org.icepdf.os/icepdf-viewer
public void installTool() {
documentScrollPane.setWheelScrollingEnabled(false);
documentScrollPane.addMouseWheelListener(this);
}
代码示例来源:origin: org.icepdf.os/icepdf-viewer
public void uninstallTool() {
documentScrollPane.setWheelScrollingEnabled(true);
documentScrollPane.removeMouseWheelListener(this);
}
}
代码示例来源:origin: antlr/antlrworks
private Container createVisualizationPane() {
view = new CustomGView(this, context);
viewScrollPane = new JScrollPane(view);
viewScrollPane.setWheelScrollingEnabled(true);
return viewScrollPane;
}
代码示例来源:origin: stackoverflow.com
scrollPane.setWheelScrollingEnabled(true);
代码示例来源:origin: net.sourceforge.owlapi/oboformat-included-owlapi
/**
* Construct a new LogPanel using the given log message queue.
*
* @param logQueue
*/
public GuiLogPanel(BlockingQueue<String> logQueue) {
super();
this.logQueue = logQueue;
setLayout(new BorderLayout(5, 5));
add(new JLabel("LOGS"), BorderLayout.NORTH);
logTextPane = new JTextPane();
logTextPane.setEditable(false);
JScrollPane logScrollPane = new JScrollPane(logTextPane);
logScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
logScrollPane.setWheelScrollingEnabled(true);
add(logScrollPane, BorderLayout.CENTER);
thread.start();
}
代码示例来源:origin: jaltekruse/OpenNotebook
public void createTextViewer(String string) {
textFrame = new JFrame(string);
textFrame.setPreferredSize(new Dimension(640, 400));
JTextArea terminal = new JTextArea(14, 20);
Font terminalFont = new Font("newFont", 1, 12);
terminal.setFont(terminalFont);
terminal.setEditable(false);
JScrollPane termScrollPane = new JScrollPane(terminal);
termScrollPane.setWheelScrollingEnabled(true);
textFrame.add(termScrollPane);
textFrame.pack();
textFrame.setVisible(true);
// terminal.append(readTextDoc(string));
terminal.append(string);
termScrollPane.revalidate();
JScrollBar tempScroll = termScrollPane.getVerticalScrollBar();
tempScroll.setValue(0);
textFrame.pack();
textFrame.repaint();
textFrame.setVisible(true);
}
代码示例来源:origin: antlr/antlrworks
protected void createInterface(GElement graph) {
panel = new JPanel(new BorderLayout());
view = new CustomGView();
view.setAutoAdjustSize(true);
view.setRootElement(graph);
view.setBackground(Color.white);
view.setDrawBorder(false);
view.setDelegate(this);
Box b = Box.createHorizontalBox();
b.add(new JLabel("Zoom"));
b.add(createZoomSlider());
JScrollPane sp = new JScrollPane(view);
sp.setWheelScrollingEnabled(true);
panel.add(b, BorderLayout.NORTH);
panel.add(sp, BorderLayout.CENTER);
}
代码示例来源:origin: org.xworker/xworker_core
comp.setWheelScrollingEnabled(wheelScrollingEnabled);
代码示例来源:origin: antlr/antlrworks
public Component createListView() {
JPanel panel = new JPanel(new BorderLayout());
JScrollPane scrollPane = new JScrollPane(tree);
scrollPane.setWheelScrollingEnabled(true);
scrollPane.setBackground(Color.white);
Toolbar box = Toolbar.createHorizontalToolbar();
box.addElement(createExpandAllButton());
box.addElement(createCollapseAllButton());
box.add(Box.createHorizontalGlue());
box.addElement(createDisplayAsGraphButton());
//if(XJSystem.isMacOS())
// box.add(Box.createHorizontalStrut(15));
panel.add(scrollPane, BorderLayout.CENTER);
panel.add(box, BorderLayout.SOUTH);
return panel;
}
代码示例来源:origin: org.icepdf.os/icepdf-viewer
/**
* Handles ctl-wheel mouse for document zooming.
*
* @param e mouse wheel event.
*/
public void mouseWheelMoved(MouseWheelEvent e) {
int rotation = e.getWheelRotation();
// turn off scroll on zoom and then back on again next time
// the wheel is used with out the ctrl mask.
documentScrollPane.setWheelScrollingEnabled(false);
Point offset = documentScrollPane.getViewport().getViewPosition();
int viewWidth = documentScrollPane.getViewport().getWidth() / 2;
int viewHeight = documentScrollPane.getViewport().getHeight() / 2;
offset.setLocation(offset.x + viewWidth, offset.y + viewHeight);
if (rotation > 0) {
documentViewController.setZoomOut(offset);
} else {
documentViewController.setZoomIn(offset);
}
}
代码示例来源:origin: org.icepdf.os/icepdf-viewer
/**
* Handles ctl-wheel mouse for document zooming.
*
* @param e mouse wheel event.
*/
public void mouseWheelMoved(MouseWheelEvent e) {
int rotation = e.getWheelRotation();
// turn off scroll on zoom and then back on again next time
// the wheel is used with out the ctrl mask.
if ((e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK
||
(e.getModifiers() & InputEvent.META_MASK) == InputEvent.META_MASK) {
documentScrollPane.setWheelScrollingEnabled(false);
Point offset = documentScrollPane.getViewport().getViewPosition();
int viewWidth = documentScrollPane.getViewport().getWidth() / 2;
int viewHeight = documentScrollPane.getViewport().getHeight() / 2;
offset.setLocation(offset.x + viewWidth, offset.y + viewHeight);
if (rotation > 0) {
documentViewController.setZoomOut(offset);
} else {
documentViewController.setZoomIn(offset);
}
} else {
documentScrollPane.setWheelScrollingEnabled(true);
}
}
代码示例来源:origin: com.jidesoft/jide-oss
@Override
public void setWheelScrollingEnabled(boolean handleWheel) {
if (handleWheel && !isWheelScrollingEnabled())
this.addMouseWheelListener(this);
if (!handleWheel && isWheelScrollingEnabled())
this.removeMouseWheelListener(this);
super.setWheelScrollingEnabled(handleWheel);
}
}
代码示例来源:origin: antlr/antlrworks
public DBOutputPanel(DebuggerTab debuggerTab) {
super("Output", debuggerTab);
this.debuggerTab = debuggerTab;
outputTextPane = new TextPane();
outputTextPane.setBackground(Color.white);
outputTextPane.setBorder(null);
outputTextPane.setFont(new Font(AWPrefs.getEditorFont(), Font.PLAIN, AWPrefs.getEditorFontSize()));
outputTextPane.setText("");
outputTextPane.setEditable(false);
TextUtils.createTabs(outputTextPane);
JScrollPane textScrollPane = new JScrollPane(outputTextPane);
textScrollPane.setWheelScrollingEnabled(true);
mainPanel.add(textScrollPane, BorderLayout.CENTER);
}
代码示例来源:origin: antlr/antlrworks
public void awake() {
panel = new JPanel(new BorderLayout());
textPane = new JTextPane();
textPane.setBackground(Color.white);
textPane.setBorder(null);
textPane.setPreferredSize(new Dimension(300, 100));
textPane.setFont(new Font(AWPrefs.getEditorFont(), Font.PLAIN, AWPrefs.getEditorFontSize()));
TextUtils.createTabs(textPane);
TextUtils.setDefaultTextPaneProperties(textPane);
textScrollPane = new JScrollPane(textPane);
textScrollPane.setWheelScrollingEnabled(true);
treeModel = new EditorInterpreterTreeModel();
awTreePanel = new AWTreePanel(treeModel);
awTreePanel.setDelegate(this);
splitPane = new JSplitPane();
splitPane.setBorder(null);
splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setLeftComponent(textScrollPane);
splitPane.setRightComponent(awTreePanel);
splitPane.setContinuousLayout(true);
splitPane.setOneTouchExpandable(true);
panel.add(createControlPanel(), BorderLayout.NORTH);
panel.add(splitPane, BorderLayout.CENTER);
window.registerUndo(null, textPane);
}
代码示例来源:origin: antlr/antlrworks
public Component createGraphView() {
JPanel panel = new JPanel(new BorderLayout());
treeGraphView = new AWTreeGraphView(this);
treeGraphView.setAutoAdjustSize(true);
treeGraphView.setBackground(Color.white);
treeGraphView.setDrawBorder(false);
ParseTreeMouseAdapter adapter = new ParseTreeMouseAdapter();
treeGraphView.addMouseListener(adapter);
treeGraphView.addMouseMotionListener(adapter);
graphScrollPane = new JScrollPane(treeGraphView);
graphScrollPane.setWheelScrollingEnabled(true);
Toolbar box = Toolbar.createHorizontalToolbar();
box.addElement(new JLabel("Zoom"));
box.addElement(createZoomSlider());
box.add(Box.createHorizontalGlue());
box.addElement(createDisplayAsListButton());
//if(XJSystem.isMacOS())
// box.add(Box.createHorizontalStrut(15));
panel.add(graphScrollPane, BorderLayout.CENTER);
panel.add(box, BorderLayout.SOUTH);
return panel;
}
代码示例来源:origin: antlr/antlrworks
public DBInputTokenPanel(DebuggerTab debuggerTab) {
inputTextPane = new TextPane();
inputTextPane.setBackground(Color.white);
inputTextPane.setBorder(null);
inputTextPane.setFont(new Font(AWPrefs.getEditorFont(), Font.PLAIN, AWPrefs.getEditorFontSize()));
inputTextPane.setText("");
inputTextPane.setEditable(false);
TextUtils.createTabs(inputTextPane);
processorToken = new DBInputProcessorToken(debuggerTab, inputTextPane);
textScrollPane = new JScrollPane(inputTextPane);
textScrollPane.setWheelScrollingEnabled(true);
}
代码示例来源:origin: raydac/netbeans-mmd-plugin
this.scrollPane.getVerticalScrollBar().setUnitIncrement(16);
this.scrollPane.setWheelScrollingEnabled(true);
this.scrollPane.setAutoscrolls(true);
代码示例来源:origin: antlr/antlrworks
public EditorRules(GrammarWindow window) {
this.window = window;
rulesTree = new RuleTree();
rulesTree.setBorder(null);
// Apparently, if I don't set the tooltip here, nothing is displayed (weird)
rulesTree.setToolTipText("");
rulesTree.setDragEnabled(true);
rulesScrollPane = new JScrollPane(rulesTree);
rulesScrollPane.setWheelScrollingEnabled(true);
rulesTree.setDelegate(this);
rulesTree.setEnableDragAndDrop();
rulesTreeRootNode = new DefaultMutableTreeNode(new RuleTreeUserObject(window));
rulesTreeModel = new DefaultTreeModel(rulesTreeRootNode);
rulesTreeExpandedNodes = new ArrayList<String>();
rulesTree.setModel(rulesTreeModel);
rulesTree.addMouseListener(ml = new RuleTreeMouseListener());
rulesTree.addTreeSelectionListener(tsl = new RuleTreeSelectionListener());
rulesTree.setRootVisible(true);
rulesTree.setCellRenderer(new RulesTableRenderer());
rulesTree.setRowHeight(17);
rulesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
setSorted(AWPrefs.getPreferences().getBoolean(AWPrefs.PREF_TOOLBAR_SORT, false));
}
内容来源于网络,如有侵权,请联系作者删除!