![]() |
JLabel question
i am trying to display the output in jlabels for this shipping cost program i have coded. I have created individual jlabels for the package ID, weight, and shipping cost and tried to display them with the mainPanel. I had no problems making labels for the input in my designFrame method, but when I try to make new labels for the mainPanel in displayoutput they simply do not display. here is the code:
:
import javax.swing.*; |
Re: JLabel question
Haha. Now you have me invested in your problem. I've worked on more complicated GUIs but none that involved adding components to a window that was already open. There's probably an easy solution. If you were using a better Layout, rather than the default, that would be good too.
|
Re: JLabel question
Call validate() after adding the components to the panel.
The sizes of components on different systems will mess up your layout, as will resizing the window. Look into other layout managers and/or consider grouping elements in multiple panels. You should also think about altering the visibility components in question (via setVisible()) rather than adding/removing them from the panel. |
Re: JLabel question
I suggest, in your case, using BorderLayout, and making two panels. Then add your components to whatever sector you want.
H/o |
| All times are GMT -5. The time now is 4:16 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC