Open GoogleCodeExporter opened 9 years ago
I can't find what part you are talking about. Could you please post the label
class
or just the function.
Original comment by shi...@gmail.com
on 24 Jan 2010 at 5:19
You can apply the patch attached to the message. If you are using Eclipse, just
click
with the right button on your project, and go to Team -> apply patch...
Original comment by luiz.mi...@gmail.com
on 24 Jan 2010 at 6:18
I tried applying the patch, but it gave me an error. It couldn't find the code
in
the patch. Attached is my label.java... Please tell me where to find this. It
seems
that checkbox.java has a problem because of that function in Label.java.It will
incorrectly display the label if the String is more than one line. I found a
workaround, but if I can fix the function it would work out better.
checkbox.java -> paintComponent
....................................................
int lx = (int)( checkboxSide * 1.5 );
- int lw = width-lx;
+ int lw = width;
int[] lDimensions = label.getPreferredSize( theme, lw, height );
int lh = lDimensions[1];
int ly = (height - lh) / 2;
label.paint( g, theme, getScreen(), lx, ly, lw, lh, selected );
..................................................................
Here is my label.java - > getPreferredSize()
..............................................................
protected int[] getPreferredComponentSize (Theme theme, int viewportWidth, int
viewportHeight)
{
int width = 0;
height = 0;
if ( text != null )
{
// Get the font.
Font font = getFont( theme );
// Parse the text by line breaks.
if ( (lines == null) || (widthForLines != viewportWidth) )
{
lines = breakIntoLines( font, text, viewportWidth );
widthForLines = viewportWidth;
}
// Get the width and height.
int fontHeight = font.getHeight();
int paragraphSpacing = fontHeight / 2;
for ( int i = 0; i < lines.length; i++ )
{
if ( lines[i] == null )
{
// Space between paragraphs.
height += paragraphSpacing;
}
else
{
int lineWidth = font.stringWidth( lines[i] );
if ( lineWidth > width )
{
width = lineWidth;
}
height += fontHeight;
}
}
}
return new int[] { width, height };
}
.........................................................................
Original comment by juliocas...@gmail.com
on 24 Jan 2010 at 7:00
Ok, I checked out the code from the svn again and applied the patch. The Label
class
is attached to this comment.
Original comment by luiz.mi...@gmail.com
on 24 Jan 2010 at 7:39
Attachments:
I guess I have an older version of the library?????
Original comment by juliocas...@gmail.com
on 24 Jan 2010 at 7:42
I don't know, but actually the patch has a little reference problem. You have to
apply it directly to the src/org/j4me/ui/components folder, otherwise it can't
find
the code.
However, I worked with J4ME in 2008 (look the date of the first comment), so I
can't
remeber much about this code...
Original comment by luiz.mi...@gmail.com
on 24 Jan 2010 at 7:56
Original issue reported on code.google.com by
luiz.mi...@gmail.com
on 31 Aug 2008 at 2:45Attachments: