//Listener for the preorder button
jbtPreOrder.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e){
key = Integer.parseInt(jtfKey.getText());
if (!tree.isEmpty()){
JOptionPane.showMessageDialog(null, "Enter something in the tree");
}
else {
JOptionPane.showMessageDialog(null, key + " ");
preorder(key.left);
preorder(key.right);
}
}
});
In the preorder it says int cannot be dereferenced even when the variable is global.