Results 1 to 5 of 5
- 08-16-2012, 07:50 PM #1
Senior Member
- Join Date
- Dec 2011
- Posts
- 102
- Rep Power
- 0
GridBagLayout-forcing content left.
Before troubling you, I've searched information about this and found some1 else who had the same problem.
One of the guys who answered him proposed a solution that worked (I've tried it myself).
The thing is, I couldn't understand what exactly the change in the code did to make it work!
here's the link:
gridBagLayout anchor ... wanna move all components to top left
Take a look at reply #12 - the guy added "d" after declaring the c.weight=1
Without the "d" it just won't work
no matter what else I've tried, the content stayed in the middle.
So what exactly this 'd' stands for? how does it help ?
Thanks :)
- 08-16-2012, 08:16 PM #2
Re: GridBagLayout-forcing content left.
Um, I am not sure yet, but I can tell you that, if you place a 'd' character after a number in Java, it will cast it as a double. Or something similar to that. For example:
if you doJava Code:double number = 1d;
you get an error saying lose of precision because the number is a double and you trying to fit it into an integer.Java Code:int number = 1d;
Same goes with floats.
Maybe, making the number a double precision primitive type makes the weight work.Java Code:float number = 1f;
My API:Java Code:cat > a.out || cat > main.class
- 08-16-2012, 09:11 PM #3
Senior Member
- Join Date
- Dec 2011
- Posts
- 102
- Rep Power
- 0
Re: GridBagLayout-forcing content left.
Ye,
I thought it maybe has something to do with that, because we use these letters for "printf".
But now I've tried just writing 1 without 'd' and it worked! when I write 0 is doesn't work.
- 08-16-2012, 09:29 PM #4
Re: GridBagLayout-forcing content left.
That's an entirely different kettle of fish. Don't confuse them just because the same letter is used.
Chapter*3.*Lexical Structure - go through the entire section.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 08-16-2012, 09:40 PM #5
Similar Threads
-
Slope of an images top left corner as P1, then the top left corner + the width as P2
By natdizzle in forum AWT / SwingReplies: 1Last Post: 04-27-2012, 03:47 AM -
GridBagLayout - forcing all components to stay on top
By Serpenthelm in forum AWT / SwingReplies: 3Last Post: 01-05-2012, 06:52 PM -
Reversing dojo slider to make it slide from right to left rather left to right as giv
By gurpreet.singh in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 05-05-2011, 01:49 PM -
square moves left and down but not up or left
By natdizzle in forum AWT / SwingReplies: 3Last Post: 02-04-2011, 05:20 PM -
gridBagLayout anchor ... wanna move all components to top left
By alinaqvi90 in forum AWT / SwingReplies: 16Last Post: 11-17-2010, 01:02 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks