I know this question was asked before, but there was no answer to it.
In Java, when I am adding components to the frame, all the elements after adding a JTextField are not rendered when the application is initialized. They are rendered after you refresh the screen e.g. minimize and maximize the screen. In the following only the textfield is rendered. It looks like some Java rendering issue.
My code is as follows:
private void initialize() {
frame = new JFrame();
frame.setVisible(true);
frame.setBounds(100, 100, 569, 321);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
txtGenerationRate = new JTextField();
txtGenerationRate.setBounds(322, 29, 86, 20);
frame.getContentPane().add(txtGenerationRate);
txtGenerationRate.setColumns(10);
lblAmountOfSolarPanelsText = new JLabel("Amount of solar panels:");
lblAmountOfSolarPanelsText.setBounds(10, 57, 159, 14);
frame.getContentPane().add(lblAmountOfSolarPanelsText);
frame.setVisible(true); // added it for the second time, just to make sure
}
Can anyone help, please?
Piotr