I'm currently learning the Java programming language and as part of my Java course I'm writing an application . My classes don't extend JFrame ,instead they extend EasyApp (http://ibcomp.fis.edu/Java/EasyApp.html , please scroll down to see the code ) . The problem , I 'm having now is that when I create a new button and then click it , a new window opens up :
(Here is part of my code : )
JButton stud = addButton1(io0, 35, 1223,901, 120, this);
ImageIcon io1 = new ImageIcon(getClass().getResource("2.png"));
....
public MatchingGame() {
setTitle("Matching game");
stud.setBorder(BorderFactory.createEmptyBorder());
stud.setContentAreaFilled(false);
..... public void actions(Object source,String command) {
if (source == stud )
{ new Register();
..... When clicking the button stud a new window appears which I don't want ;I know this is because I'm creating an instance of the class Register but I have no idea how to resolve this issue . Thanks in advance for your answers !