Interested in this question: I create in one class JFrame , in another, for example, JMenuBar . I also create a variable of this class in a class with a JFrame , but the menu bar does not appear.
That's interesting, is it possible to do that? If necessary? Simply, it is more convenient to edit components when necessary. Roughly speaking, it looks like this:
public class MyFrame extends JFrame{ private MyMenuBar menuBar; public MyFrame(){ // описываем класс } menuBar = new MyMenuBar(); setJMenuBar(menubar); } public class MyMenuBar extends JMenuBar{ public MyMenuBar(){ // описываем класс } }