的對話框代碼:Netbeans的:一個JButton按鈕設置斜面可見
d1=new JDialog(this,"Help Menu",true);
// Set size
d1.setSize(500,180);
// Set some layout
d1.setLayout(new FlowLayout());
d1.add(new JLabel("<html>Thank you for using the poster ordering system. <br> To begin, please select your desired poster size using the option menu provided. <br> Next, choose your desired poster style. <br> Now you can choose your quantity and background colour for your poster. <br> you are now finished! Your price will be displayed at the bottom right of the screen. <br> The pricing will show prices with and without VAT for your convenience.<br></html>"));
JButton button = new JButton("close");
d1.setVisible(true);
button.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
dispose();
}
});
它說,它已經達到了文件的末尾解析之前,並不會顯示在幫助對話框中的「關閉」按鈕。當我添加「JButton.setVisible(true);」它說:「非靜態方法setVisible(布爾)不能從靜態上下文引用」
任何建議將不勝感激。 我是Java新手,現在讓我感到困惑!這一個
JButton button = new JButton("close");
:
太好了!非常感謝,仍然在底部())掙扎; ),因爲它說:「解析之前到達文件的結尾? –
@PhilMarsh你關閉了你的類與」}「? –