This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I use netbeans to make some easy java programming. Most of the time I learn from the examples on the net, so I am not much more than a complete beginner. My problem:
Is there an easy way how to update JLabel using setText()? I have designed in Netbeans a main frame and then a dialog (jDialog_Submitted), that has a label (jLabel_Submitted, set to "some string" value as a default). I would like this label to change appropriately before the dialog appears. I use setText("my string"), however after calling this sequence I don't see any label at all.
jLabel_Submitted.setText("File was submitted.");
I read > 50 websites/forums in order to understand how to do this simple (?!) thing, but cannot find anything I would understand...
Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
Create the program manually and don't use the NetBeans GUI generator so you understand what it happening.
Joined: Jul 07, 2009
I first design the things visually (drag & drop from the palette of Swing containers) in NetBeans environment.
The hierarchy is as follows:
Then I just use the components as I need and add small portions of the code in editor. I thought that jLabel is always associated with jDialog and that just setting new text using jLabel_Submitted.setText("whatever") will work, but I guess one has to do some kind of "refresh" after this change...