I work in jave, IntelliJ.
I create a Frame (Window) in which I place various objects such as: Panel, Label, Button and TextArea. The problem is just in the last (as I understood). No matter what size my window is (at least setSize (1000, 1000)) ;, in the minimized mode it does not show objects starting from TextArea and everything below.
If you expand it completely (or simply resize the window by pulling a corner), then all of my elements magically appear
] 2 I don’t understand what the problem is, and you won’t ask Google such a vague question. Thank you in advance!
PanelClass() { super("Name"); // setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(300 , 400); setVisible(true); setLayout(new FlowLayout(FlowLayout.CENTER)); JPanel Panel_with_img = new JPanel(); add(Panel_with_img); Panel_with_img.add(new JLabel("img")); JPanel Panel_with_list = new JPanel(new GridLayout(5, 1)); add(Panel_with_list); Panel_with_list.add(new JLabel("Висельница")); Panel_with_list.add(new JLabel("Слово: ")); JLabel Lable_slovo = new JLabel("_ _ _"); Panel_with_list.add(Lable_slovo); Panel_with_list.add(new JLabel("Использованы: ")); JPanel Panel_for_letter = new JPanel(new FlowLayout(FlowLayout.LEADING)); Panel_for_letter.add(new JLabel("Буква: ")); JTextArea Label_Enter = new JTextArea("___"); Panel_for_letter.add(Label_Enter); JButton Button_enter = new JButton("Ввод"); Panel_for_letter.add(Button_enter); Panel_with_list.add(Panel_for_letter); }
setSizeandsetVisibleafter creating and adding all the components, or callrevalidate()to recalculate the size and position. - zRrr 2:51 pm