This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi guys, im trying to separate my swing in different classes, but what i get is a new window, i just want to add different jlabels, jbuttoms and other things from a new classes to my constructor class, i dont know if its possible or not, heres my resumed code.
My main class
here my constructor class:
And here my new class, where i want to add new JLabels to my constructor class:
How can i call this JLabel from my principal class?
I know i can use the dimension variable in all classes sharing it btw, but i was just trying some things ;/
Hope you guys can help me, im pretty confused right now
I don't really understand what you mean. But there are two suggestions you might consider:
- Pass your container instance (JFrame or JPanel) to your nuevo class, then add the labels to the container.
- Have a getter methods for the labels in your nuevo class, and use these getters from your container class to access the label objects.
PM Me If You Want to get Urgent Help on Java Programming
Joined: Jun 15, 2013
oh well, thanks for your answer, i just want to modularize my program into classes, grouping them in functions, so, when i call those functions from my actionperformed button, they appear in the container.