Here is my code to create new user. If I try to create new user without logging in it will show a message please log in first. Then I will log in and attempt to create new user. My problem here is the previous text area displayed is still enabled. I'm not able to enter data into my text boxes. I tried using remove() function but no use.
if(e.getSource()==createButton){
//adminCard.remove(previlege);
if(UID==0||users.size()==0){
JPanel newUserCard = new JPanel(new FlowLayout());
name = new JPanel( new GridLayout(1, 4));
name.add(new JLabel(" "));
userName=new JTextField(20);
name.add(userName);
name.add(new JLabel(" Name"));
pword = new JPanel( new GridLayout(1, 4));
pword.add(new JLabel(" "));
pwd=new JTextField(20);
pword.add(pwd);
pword.add(new JLabel(" Password"));
loginNamePanel = new JPanel( new GridLayout(1, 4));
loginNamePanel.add(new JLabel(" "));
loginName=new JTextField(20);
loginNamePanel.add(loginName);
loginNamePanel.add(new JLabel("UserName"));
JPanel confirmpwd = new JPanel( new GridLayout(1, 3));
confirmpwd.add(new JLabel(" "));
confirmPassword=new JTextField(20);
confirmpwd.add(confirmPassword);
confirmpwd.add(new JLabel(" Confirm Password"));
newUserCard.add(name);
newUserCard.add( loginNamePanel);
newUserCard.add(pword);
newUserCard.add(confirmpwd);
newUserCard.add(submit);
displayUsers(users);
// JSplitPane sw=new JSplitPane
JSplitPane splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,newUserCard,userPane);
//splitPane.setDividerLocation(0.8);
splitPane.setOneTouchExpandable(true);
//splitPane.repaint();
userPane.setMaximumSize(new Dimension(10,20));
//adminCard.re
adminCard.add(splitPane);
adminCard.validate();
submit.addActionListener(this);
}
if(loginState==false && users.size()!=0){
JTextArea previlege=new JTextArea("Please login in order to create new users");
adminCard.add(previlege);
adminCard.validate();
}