Good day,
I'm pretty new in the endless programming world of Java and my question might sound stupid but as I haven't found any answer by myself...
So, I've created a JFrame composed of several JPanel objects. Each of these latter JPanel contains one or several elements such as buttons or labels. I'd like to use a font (e.g. plain Tahoma 11) being different from the defaulted one for every text being displayed in my JFrame WITHOUT having to apply such a definiton to every element contained in there. In other words, I'd like to get rid of the following code (i.e. loads of redundancy) by replacing it by only 1 line of code that would apply to all components:
Is it possible and, if yes, how could I proceed? Thanks very much in advance for a potential answer!Code:btnOpen.setFont(new Font("Tahoma", 0, 11)); btnForward.setFont(new Font("Tahoma", 0, 11)); btnClose.setFont(new Font("Tahoma", 0, 11)); lblName.setFont(new Font("Tahoma", 0, 11)); lblSurame.setFont(new Font("Tahoma", 0, 11));
Loris


Reply With Quote


Bookmarks