this.setVisible(假);无效

时间:2018-03-31 18:34:17

标签: java

当我尝试在ActionListener中使用此方法时,我收到以下错误 DrawMap.java:71:错误:找不到符号                         this.setVisible(假);                             ^   symbol:方法setVisible(boolean) DrawMap.java:82:错误:找不到符号                         this.setVisible(假);                             ^   symbol:方法setVisible(boolean) 注意:某些输入文件使用或覆盖已弃用的API。 注意:使用-Xlint重新编译:弃用以获取详细信息。 2个错误

class DrawMap extends JComponent{
private JLabel LabelTitle,MapNo;
private JTextField MapField;
private JButton Draw,Shape,Load,Back,Logout;
private JPanel Panel5;
private String UserName,Password,City;
public boolean check;
private int r,g,b;
private int flag =0;

public DrawMap(String UserName,String Password,String City){

Random p = new Random();
r = p.nextInt(255);
g = p.nextInt(255);
b = p.nextInt(255);

this.UserName = UserName;
this.Password = Password;
this.City   = City;

/*Panel5 = new JPanel();
Panel5.setLayout(null);

this.add(Panel5);*/

JButton Draw = new JButton("Draw");
Draw.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
        check=true;
        repaint();
    }
});
Draw.setBounds(550,60,100,50);
add(Draw);

JButton Shape = new JButton("Shape");
Shape.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){

    }
});
Shape.setBounds(650,60,100,50);
add(Shape);

JButton Load = new JButton("Load");
Load.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){

    }
});
Load.setBounds(250,500,100,50);
add(Load);

JButton Back = new JButton("Back");
Back.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
        UserHome ush = new UserHome(UserName,Password,City);
        ush.setVisible(true);
        this.setVisible(false);
    }
});
Back.setBounds(350,500,100,50);
add(Back);

JButton Logout = new JButton("Logout");
Logout.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
        Login L = new Login();
        L.setVisible(true);
        this.setVisible(false);
    }
});
Logout.setBounds(450,500,100,50);
add(Logout);


}

0 个答案:

没有答案