public Container createTextArea() { textArea = new JTextArea(); JScrollPane textAreaScrollPane = new JScrollPane(textArea); textAreaScrollPane.setWheelScrollingEnabled(true); return textAreaScrollPane; }
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);
public void installTool() { documentScrollPane.setWheelScrollingEnabled(false); documentScrollPane.addMouseWheelListener(this); }
public void uninstallTool() { documentScrollPane.setWheelScrollingEnabled(true); documentScrollPane.removeMouseWheelListener(this); } }
private Container createVisualizationPane() { view = new CustomGView(this, context); viewScrollPane = new JScrollPane(view); viewScrollPane.setWheelScrollingEnabled(true); return viewScrollPane; }
scrollPane.setWheelScrollingEnabled(true);
/** * 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(); }
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); }
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); }
comp.setWheelScrollingEnabled(wheelScrollingEnabled);
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; }
/** * 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); } }
/** * 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); } }
@Override public void setWheelScrollingEnabled(boolean handleWheel) { if (handleWheel && !isWheelScrollingEnabled()) this.addMouseWheelListener(this); if (!handleWheel && isWheelScrollingEnabled()) this.removeMouseWheelListener(this); super.setWheelScrollingEnabled(handleWheel); } }
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); }
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); }
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; }
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); }
this.scrollPane.getVerticalScrollBar().setUnitIncrement(16); this.scrollPane.setWheelScrollingEnabled(true); this.scrollPane.setAutoscrolls(true);
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)); }