Go Back   Java Programming Forums > Java Standard Edition Programming Help > AWT / Java Swing


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 20-04-2009, 09:22 AM
Junior Member
 

Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
orfano is on a distinguished road
Default JTextPane does not display after text initialized with ""

Lads,
We have migrated a swing application from Java 1.4.2 (IBM) to 1.5 (IBM).
In this application I have a Panel to display “account” information that contains two components (mine ones) that are subclasses of JTextPane. These components represents possible status of an account (an account can have status 1 and substatus 2 for example).
When this panel is accessed it always trigger a method called populated fields that in turns populate these specific components (see pseudo code below):
// initialize the texts with “” .
Comp1.setText(“”);
Comp2setText(“”);
// then populate them with data if the data is available. An account can have only status 1 or only status 2 or both.
If (there is data for Comp1)
Comp1.setText(data);
If(there is data for Comp2);
Comp2.setText(data);

My problem happens when I access this panel and there is data just for Comp1 then it displays it OK. (Account with only status 1)
Then I access another account that has data just for status 2 (Account with only status 2) In this case depending on the size of the Window it does not display . I have to resize the Window (increase it) until it displays.

If I initialized the Components with “ “ (one whitespace) instead of “” then it also works fine.
Also After I resize the window to make the status been displayed and then I access another account then this new account will not have any problem regarding to display. Actually the issue will disappear until I restart my swing application.

So I am trying to understand why resize or initialize the text with “ “ works. My issue here is that my components does other things linke underline text so when I start them as “ “ whenever one has no data to display it still displays a small underline _.
In order to migrate this application from 1.4.2 to 1.5 (IBM) we did change code but not the ones directly involved here. Could it be an java 1.5 issue?

Any help is very welcome.

The layoutmanager used is BorderLayout.
The Panel is initialized when the application is started.



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 20-04-2009, 12:36 PM
JavaPF's Avatar
mmm.. coffee
 
7 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,585
Thanks: 104
Thanked 93 Times in 86 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Mellow
Default Re: JTextPane does not display after text initialized with ""

Good afternoon orfano and welcome to the Java Programming Forums

Would it be possible to post all of the code so I can compile it and see the error for myself?
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
  #3 (permalink)  
Old 20-04-2009, 01:10 PM
Junior Member
 

Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
orfano is on a distinguished road
Default Re: JTextPane does not display after text initialized with ""

Hello there,

I am trying to reproduce it in a more short way as the whole code is huge and impossible to run without having the server part as well.
As soon as I got a short version of the issue I will post the code.


cheers,
Reply With Quote
  #4 (permalink)  
Old 20-04-2009, 01:35 PM
JavaPF's Avatar
mmm.. coffee
 
7 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,585
Thanks: 104
Thanked 93 Times in 86 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Mellow
Default Re: JTextPane does not display after text initialized with ""

Quote:
Originally Posted by orfano View Post
Hello there,

I am trying to reproduce it in a more short way as the whole code is huge and impossible to run without having the server part as well.
As soon as I got a short version of the issue I will post the code.

cheers,
It's hard for me to offer a solution without actually seeing the problem for myself.

What happens when you initialized the Components with null instead of "" or " " ?
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Exception in thread "main" java.lang.NullPointerException oscardog Exceptions 16 27-08-2010 08:30 PM
Exception in thread "main" java.util.IllegalFormatWidthException: 13 xtrive Exceptions 2 23-03-2010 05:38 AM
Drawing "Hello world" on screen shikh_albelad Java SE APIs 4 11-06-2009 08:21 AM
[SOLVED] Problem with Java: "GridLayout" laying out the top part of my assignment? antitru5t AWT / Java Swing 3 16-04-2009 03:26 PM


100 most searched terms
Search Cloud
actionlistener actionlistener in java addactionlistener addactionlister adding elements to two dimensional arraylist cannot find symbol method create an abstract class called shape with abstract methods+java double to integer double to integer in java double to integer java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread main java.lang.reflect.invocationtargetexception format double java get mouse position java how to convert list to map in java http://www.javaprogrammingforums.com/collections-generics/2688-grade-array-trouble.html http://www.javaprogrammingforums.com/object-oriented-programming/3713-limiting-decimal-places-double.html iphone java java actionlistener java addactionlistener java deallocate java double format java double to int java font attributes java format double java forum java forums java get mouse position java heap size exception java jbutton java program to find dimensions of a room java programming codes using astirisks java programming forum java programming forums java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.lang.reflect.invocationtargetexception jbutton actionlistener jtext bold jtextarea font jtextfield output from formula jxl.read.biff.biffexception: unable to recognize ole stream mean value decimal double java oops java assignments programmer forum smack api messagelistener transaction using gui and 2 dimensional array code in java two dimensional arraylist in java typecast in java

All times are GMT. The time now is 09:43 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.