i'm trying to disable some JButton with different account(something like permissions), here is my code to be more clear question...
try
{
stat = conn.prepareStatement(sql);
rs=stat.executeQuery();
while(rs.next())
{
System.out.println("found");
String _name= rs.getString("name");
String _pass = rs.getString("password");
String _stat = rs.getString("status");
if (_name == name && pass == _pass && _stat == "admin")
{
new SecondFrame().setVisible(true);//all buttons works as admin
}
else if(_name == name && pass == _pass && _stat == "moderator")
{
SecondFrame ob = new SecondFrame();
ob.admin_btn.setEnabled(false);//just user+moderator button works
}
else if(_name == name && pass == _pass && _stat == "user")
{
SecondFrame ob = new SecondFrame();
ob.admin_btn.setEnabled(false);
ob.moderator_btn.setEnabled(false);
// just user button works
}
}
}
catch (SQLException SQLe)
{
System.out.println("not executed"+SQLe);
}
... but i can't disable buttons like this(syntax is wrong), is there a way to make buttons disabled from this class?
thanks for help