簡體   English   中英

放置點不顯示建議 Java Swing GUI

[英]Putting dot doesnt show the suggestions Java Swing GUI

我正在嘗試使用 Java Swing GUI 編寫程序。 我的目的是檢查表是否可用。 所以我嘗試了這樣的代碼:

JButton btnNewButton = new JButton("Send!");
btnNewButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {    
        int numberofpeople = Integer.parseInt(numberppltxtField.getText());
        
        if (numberofpeople ==1) {
            if (tables1.getTables() > 0) { /* I have a object tables1 which represent the number of 1 person tables )
            table1.setTables(tables1.getTables() -1 );
        }
        
        else {
        jlblWarning.setText("We're full!"); } /* to change the label under the button.*/
    }

JLabel lblNewLabel_11 = new JLabel("New label");
lblNewLabel_11.setFont(new Font("Times New Roman", Font.BOLD, 12));
lblNewLabel_11.setBounds(876, 463, 197, 30);
frame.getContentPane().add(lblNewLabel_11);

(注意: lblNewLabel_11等於jlblWarning 。我嘗試再次創建。)

所以問題是當我寫 jlblWarning 並在這里放一個點時,我看不到 setText 建議。 此外,當我在沒有建議的情況下編寫它時,我仍然有錯誤。 你能幫我么?

注意:由於我在這里再次編寫代碼,而不是復制粘貼,因此可能會有一些語法錯誤。

您必須先定義jlblWarning

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM