Logo Search packages:      
Sourcecode: jedit version File versions  Download package

org::gjt::sp::jedit::textarea::TextArea::TextArea ( IPropertyManager  propertyManager,
InputHandlerProvider  inputHandlerProvider 
) [inline, protected]

Creates a new JEditTextArea.

Parameters:
propertyManager the property manager that contains informations like shortcut bindings
inputHandlerProvider the inputHandlerProvider

Definition at line 78 of file TextArea.java.

References offsetXY, and org::gjt::sp::jedit::textarea::Gutter::setMouseActionsProvider().

      {
            this.inputHandlerProvider = inputHandlerProvider;
            enableEvents(AWTEvent.FOCUS_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);

            //{{{ Initialize some misc. stuff
            selectionManager = new SelectionManager(this);
            chunkCache = new ChunkCache(this);
            painter = new TextAreaPainter(this);
            gutter = new Gutter(this);
            gutter.setMouseActionsProvider(new MouseActions(propertyManager, "gutter"));
            listenerList = new EventListenerList();
            caretEvent = new MutableCaretEvent();
            blink = true;
            offsetXY = new Point();
            structureMatchers = new LinkedList<StructureMatcher>();
            structureMatchers.add(new StructureMatcher.BracketMatcher());
            //}}}

            //{{{ Initialize the GUI
            setLayout(new ScrollLayout());
            add(ScrollLayout.CENTER,painter);
            add(ScrollLayout.LEFT,gutter);

            // some plugins add stuff in a "right-hand" gutter
            verticalBox = new Box(BoxLayout.X_AXIS);
            verticalBox.add(vertical = new JScrollBar(Adjustable.VERTICAL));
            vertical.setRequestFocusEnabled(false);
            add(ScrollLayout.RIGHT,verticalBox);
            add(ScrollLayout.BOTTOM,
                  horizontal = new JScrollBar(Adjustable.HORIZONTAL));
            horizontal.setRequestFocusEnabled(false);

            horizontal.setValues(0,0,0,0);
            //}}}

            //{{{ this ensures that the text area's look is slightly
            // more consistent with the rest of the metal l&f.
            // while it depends on not-so-well-documented portions
            // of Swing, it only affects appearance, so future
            // breakage shouldn't matter
            if(UIManager.getLookAndFeel() instanceof MetalLookAndFeel)
            {
                  setBorder(new TextAreaBorder());
                  vertical.putClientProperty("JScrollBar.isFreeStanding",
                        Boolean.FALSE);
                  horizontal.putClientProperty("JScrollBar.isFreeStanding",
                        Boolean.FALSE);
                  //horizontal.setBorder(null);
            }
            //}}}

            //{{{ Add some event listeners
            vertical.addAdjustmentListener(new AdjustHandler());
            horizontal.addAdjustmentListener(new AdjustHandler());


            addFocusListener(new FocusHandler());
            addMouseWheelListener(new MouseWheelHandler());

            //}}}

            // This doesn't seem very correct, but it fixes a problem
            // when setting the initial caret position for a buffer
            // (eg, from the recent file list)
            focusedComponent = this;

            popupEnabled = true;
      } //}}}


Generated by  Doxygen 1.6.0   Back to index