void () { myEditorComponent = new EditorComponentImpl(this); // myStatusBar = new EditorStatusBarImpl(); myScrollPane = new JScrollPane2() { protected void processMouseWheelEvent(MouseWheelEvent e) { if (mySettings.isWheelFontChangeEnabled()) { boolean changeFontSize = SystemInfo.isMac ? !e.isControlDown() && e.isMetaDown() && !e.isAltDown() && !e.isShiftDown() : e.isControlDown() && !e.isMetaDown() && !e.isAltDown() && !e.isShiftDown(); if (changeFontSize) { setFontSize(myScheme.getEditorFontSize() + e.getWheelRotation()); return; } } super.processMouseWheelEvent(e); } }; myPanel = new JPanel() { public void addNotify() { super.addNotify(); if (((JComponent)getParent()).getBorder() != null) myScrollPane.setBorder(null); } }; //myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS)); myPanel.setLayout(new BorderLayout()); myVerticalScrollBar = new MyScrollBar(JScrollBar.VERTICAL); myHorizontalScrollBar = new MyScrollBar(JScrollBar.HORIZONTAL); myGutterComponent = new EditorGutterComponentImpl(this); myGutterComponent.setOpaque(true); myScrollPane.setVerticalScrollBar(myVerticalScrollBar); myScrollPane.setHorizontalScrollBar(myHorizontalScrollBar); myScrollPane.setViewportView(myEditorComponent); //myScrollPane.setBorder(null); myScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); myScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); myScrollPane.setRowHeaderView(myGutterComponent); stopOptimizedScrolling(); myEditorComponent.setTransferHandler(new MyTransferHandler()); myEditorComponent.setAutoscrolls(true); /* Default mode till 1.4.0 * myScrollPane.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); */ myPanel.add(myScrollPane); myEditorComponent.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent event) { if (Patches.APPLE_BUG_ID_3337563) return; // Everything is going through InputMethods under MacOS X in JDK releases earlier than 1.4.2_03-117.1 if (event.isConsumed()) { return; } if (processKeyTyped(event)) { event.consume(); } } }); MyMouseAdapter mouseAdapter = new MyMouseAdapter(); myEditorComponent.addMouseListener(mouseAdapter); myGutterComponent.addMouseListener(mouseAdapter); MyMouseMotionListener mouseMotionListener = new MyMouseMotionListener(); myEditorComponent.addMouseMotionListener(mouseMotionListener); myGutterComponent.addMouseMotionListener(mouseMotionListener); myEditorComponent.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { myCaretCursor.activate(); int caretLine = getCaretModel().getLogicalPosition().line; repaintLines(caretLine, caretLine); fireFocusGained(); } public void focusLost(FocusEvent e) { synchronized (ourCaretThread) { if (ourCaretThread.myEditor == EditorImpl.this) { ourCaretThread.myEditor = null; } } int caretLine = getCaretModel().getLogicalPosition().line; repaintLines(caretLine, caretLine); fireFocusLost(); } }); // myBorderEffect.reset(); try { myEditorComponent.getDropTarget().addDropTargetListener(new DropTargetAdapter() { public void drop(DropTargetDropEvent dtde) { } public void dragOver(DropTargetDragEvent dtde) { Point location = dtde.getLocation(); moveCaretToScreenPos(location.x, location.y); getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } }); } catch (TooManyListenersException e) { } }