
respected sir, i would like to known how to make coding on a button while working on netbeans, so that a new window will open after clicking on that button? thank you

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class ButtonExample{
ButtonExample(){
JFrame f=new JFrame();
JButton b=new JButton("Click");
f.setLayout(null);
f.add(b);
b.setBounds(20,20,100,20);
f.setVisible(true);
f.setSize(300,100);
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
JFrame frame=new JFrame();
frame.add(new JLabel("Hello World"));
frame.setVisible(true);
frame.setSize(300,100);
}
});
}
public static void main(String[] args){
new ButtonExample();
}
}

<input type="submit" value="open new window" onclick="window.open('xyz.html', 'null', 'width=800,height=600,resizable=no');" />
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.