Re: Very simple GUI problem
try some different values for gridx and gridy positions
Re: Very simple GUI problem
Quote:
c.gridwidth = GridBagConstraints.RELATIVE;
Try changing this line with;
Code :
c.gridwidth = GridBagConstraints.EAST;
There are many other solutions too.
Re: Very simple GUI problem
Quote:
Originally Posted by
Mr.777
Try changing this line with;
Code :
c.gridwidth = GridBagConstraints.EAST;
There are many other solutions too.
Complete wrong. The gridwidth property specifies how many columns on which the cell will span. So the solution is to set c.gridwidth = 2;
Re: Very simple GUI problem
Quote:
Originally Posted by
Bob_Sadarka
Complete wrong. The gridwidth property specifies how many columns on which the cell will span. So the solution is to set c.gridwidth = 2;
Well, first read my post carefully. I've clearly mentioned that there can be many other solutions too.
Also, will you care explaining why this solution is completely wrong?
Re: Very simple GUI problem
Quote:
Originally Posted by
Mr.777
Well, first read my post carefully. I've clearly mentioned that there can be many other solutions too.
Also, will you care explaining why this solution is completely wrong?
The gridwidth property specifies the number of cells in a row a component should occupy. The EAST property should be used to specify the anchor - when a component is smaller than the display area this manages where the component should be anchored. EAST is defined as 13, so in affect setting the gridwidth to EAST sets the gridwidth to 13.
Re: Very simple GUI problem
Quote:
Originally Posted by
copeg
The gridwidth property specifies the number of cells in a row a component should occupy. The EAST property should be used to specify the anchor - when a component is smaller than the display area this manages where the component should be anchored. EAST is defined as 13, so in affect setting the gridwidth to EAST sets the gridwidth to 13.
Yeah and when i tried my given solution, it worked fine and resulted as user wanted. Also i mentioned that there might be other solutions too.
So, you mean, my given solution is completely Wrong? I will ofcourse take your opinion seriously as you've more knowledge than me.
Re: Very simple GUI problem
Quote:
Originally Posted by
Mr.777
Yeah and when i tried my given solution, it worked fine and resulted as user wanted. Also i mentioned that there might be other solutions too.
So, you mean, my given solution is completely Wrong? I will ofcourse take your opinion seriously as you've more knowledge than me.
Fair enough. Wrong is often relative, as in this case (eg it compiles and fixes the problem, but may not be best practice). The position properties of GridBagLayout should not be used for width properties, as they may result in unwanted behavior (such as a gridwith of 13). Width should be defined by the width one wishes - EAST/WEST/etc... make no sense when it comes to defining width.
Re: Very simple GUI problem
Quote:
Originally Posted by
copeg
Fair enough. Wrong is often relative, as in this case (eg it compiles and fixes the problem, but may not be best practice). The position properties of GridBagLayout should not be used for width properties, as they may result in unwanted behavior (such as a gridwith of 13). Width should be defined by the width one wishes - EAST/WEST/etc... make no sense when it comes to defining width.
Great. Thanks a lot.