Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Word wrapping in JTextPane

I have a word wrapping issue when using JTextPane. I think it's my IDE (JCreator) but when i use the source everyone else is using I get several errors. Sorry for the line breaks... Could it be my IDE or can someone please let me know the right way of doing this. TIA -Roland

The source I am using can be found at http://java-sl.com/tip_html_letter_wrap.html

lol.. I forgot the space! Thanks all. It is going to proceed. I have been programming all night and am a little groggy. Best of luck -Roland

> --------------------Configuration: inigui - JDK version <Default> - <Default>--------------------
> C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:283: error: ')' expected
>               gentextp.setEditorKit( newHTMLEditorKit(){ 
>                                                        ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:285: error: ';' expected
>            public ViewFactory getViewFactory(){ 
>                                             ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:330: error: illegal
> start of type
>         }); 
>          ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: <identifier> expected
>         panel.setLayout(new GridLayout(1, 1));
>                        ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: illegal
> start of type
>         panel.setLayout(new GridLayout(1, 1));
>                         ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: ')' expected
>         panel.setLayout(new GridLayout(1, 1));
>                            ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: ';' expected
>         panel.setLayout(new GridLayout(1, 1));
>                                       ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: illegal
> start of type
>         panel.setLayout(new GridLayout(1, 1));
>                                        ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: <identifier>
> expected
>         panel.setLayout(new GridLayout(1, 1));
>                                         ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: ';' expected
>         panel.setLayout(new GridLayout(1, 1));
>                                          ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: illegal
> start of type
>         panel.setLayout(new GridLayout(1, 1));
>                                            ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:337: error: <identifier>
> expected
>         panel.setLayout(new GridLayout(1, 1));
>                                             ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:339: error: illegal
> start of type
>         return panel;
>         ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:339: error: ';' expected
>         return panel;
>               ^ C:\ucdhb2\gaia\inigui\inigui2\src\inigui.java:341: error: class, interface, or enum expected }  ^ 15 errors
like image 486
Confident Avatar asked Dec 19 '25 00:12

Confident


1 Answers

The linked code needs space chars in 3 places to compile.

E.G.

final JEditorPane htmlTextPane = newJEditorPane(); 

should be:

final JEditorPane htmlTextPane = new JEditorPane(); 

Look at the line numbers identified by the compiler for the others.

like image 94
Andrew Thompson Avatar answered Dec 20 '25 18:12

Andrew Thompson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!