버튼을 클릭 할 때 가시성을 false로 설정하려고하지만 컴파일러에 "호환되지 않는 유형"이 표시됩니다. 그것은 I 부울 결과를 반환하지 않는 JFrame
, JButton
, JLabel
, BorderLayout
, ActionEvent
및버튼을 클릭하여 가시성을 변경하십시오.
Object source = event.getSource();
if (source == changeTextButton)
{
if (label.getText().equals(LABEL1))
{
label.setText(LABEL2);
}
else
{
label.setText(LABEL1);
}
} // end of if (source == button)
if (source == closeButton)
{
if (frame.setVisible(true))
{
setVisible(false);
}
} // end of if (source == closeButton)
다음 중 어떤 줄이 오류입니까? –
"if (frame.setVisible (true))" – user3479783
다시 말하면이 문은 유효한 Java가 아닙니다. 말이 맞지 않는'if (void)'라고 말하는 것이 효과적입니다. –