Comments (10)
This is strange. The component should have its size already, unless there is
something wrong.
Can you send/paste me the whole code, instead of just the steps above?
Original comment by [email protected]
on 30 Dec 2008 at 10:57
from jsyntaxpane.
Original comment by [email protected]
on 30 Dec 2008 at 10:57
from jsyntaxpane.
In my project, I encountered the problem when dynamically adding or removing
JEditorPane in tabs of a JTabbedPane.
Please find attach the smallest piece of code that I was able to write in order
to
reproduce the NullPointerException. You have to click on the JButton in order to
generate the NPE.
P.S: thanks a lot for your wonderful piece of code!
Original comment by [email protected]
on 30 Dec 2008 at 1:06
Attachments:
from jsyntaxpane.
I just fixed it in the latest release (r64). It missed the binary release by
just a
few minutes.
You also need to call the doLayout method on the container just after the add is
called. Otherwise it wont display immediately.
c.add(scrPane, BorderLayout.CENTER);
c.doLayout();
Original comment by [email protected]
on 30 Dec 2008 at 1:39
- Changed state: Fixed
- Added labels: Type-Defect
from jsyntaxpane.
I tried the latest release (r64). There is no more NPE. Unfortunately, there is
still
a problem, the lines are not correctly numbered. For instance, if you try to
execute
my previous TestIssue47 class while providing a multi-line content as parameter
of
the setText method (setText("xxx\nxxx\nxxx");), only the first line is numbered
;(.
Original comment by [email protected]
on 30 Dec 2008 at 3:21
from jsyntaxpane.
In that case, maybe other things could fail. You should call the setContentType
after calling doLayout on the component. Let me know if that does not work.
Original comment by [email protected]
on 30 Dec 2008 at 4:16
from jsyntaxpane.
Unfortunately, it seems the problem is not related to the doLayout() as
illustrated
in the code attached to this comment. In this example, doLayout() is called
before
the setContentType(), and latter the setText() is called.
Original comment by [email protected]
on 30 Dec 2008 at 6:07
Attachments:
from jsyntaxpane.
The problem is that the LineNumbersRuler component is a CaretListener, but the
Caret
is not moved by the initial setText. I implemented a CaretListener because at
time
of registering the LineNumbersRuler to the component, the Editor's
SyntaxDocument is
yet available.
I'll look at a better solution. Seems like listening for the components
propertyChange and implementing a DocumentListener will be needed.
Original comment by [email protected]
on 31 Dec 2008 at 5:14
- Changed state: Accepted
from jsyntaxpane.
Fixed in r65. I did the above, and also don't call the modelToView, relying on
the
Document Elements now.
Many thanks for keeping me honest :-)
Original comment by [email protected]
on 31 Dec 2008 at 8:12
- Changed state: Fixed
from jsyntaxpane.
It works like a charm !
Thank you very much for your effort and one more time thank you for providing
us such
a useful component.
Original comment by [email protected]
on 31 Dec 2008 at 9:12
from jsyntaxpane.
Related Issues (20)
- Doesn't play nice with Groovy's SwingBuilder HOT 2
- sql.flex - SQL identifiers can contain #
- PATCH: Allow kit config to specify multiple fonts
- Can't change font in jsyntaxpane HOT 1
- "Find next" bug when no searches have been performed
- Popup menu text not being set
- java.lang.NullPointerException when double click on autocomlete in GroovySyntaxKit HOT 2
- HTML/JavaScript/PHP/CSS Combo-Content-Type
- Do not install the popup menu
- Feature Request - Save Content To Disk
- Unable to access ComboCompletitonAction to create own autocomplites
- LineNumbersRuler font doesn't follow JEditorPane font
- Ctrl-F find enhancement
- NPE when the ruler is installed before the scrollPane
- Question
- SQL display error ("T" = 7) looks like '"T" = 7)
- Some forks/patches
- Cannot properly place text cursor with Japanese characters
- Performance problem for loading large files (>3MB) - and a fix HOT 2
- New, bugfixed, updated version available at GitHub
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsyntaxpane.