Hi,
I wrote my assignment with simple awt-buttons at first.But, when i changed to JButtons,errors about setting JPanel with FlowLayout appear.
enc: Error.txt // code of errors
:)
Hi,
I wrote my assignment with simple awt-buttons at first.But, when i changed to JButtons,errors about setting JPanel with FlowLayout appear.
enc: Error.txt // code of errors
:)
first of all, use commas to separate parameters, not periods.
getContenPane().add(p1.BorderLayout.CENTER); //WRONG
getContenPane().add(p1,BorderLayout.CENTER); //RIGHT
Secondly, a container can only be 1 type of layout at a time. You're trying to use BorderLayout first, then FlowLayout, and finally GridLayout. If you haven't specified which one it is, then FlowLayout is the default.
getContentPane().setLayout(new BorderLayout());
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.