So, I've always avoided using GUIs in java because, personally, I can't stand GUIs. But, I've started a project which requires me to use GUIs, and, unsurprisingly, I'm having problems.. I have this bit of code..
public class DefaultWindow extends Window
{
private DefaultWindow(Frame owner)
{
super(owner);
contained = owner;
}
public DefaultWindow()
{
this(new Frame(""));
contained.setBackground(Color.black);
contained.setLocation(0, 0);
contained.setSize(1280,720);
Button comp = new Button("Hello");
comp.setLocation(0, 0);
comp.setSize(10, 10);
add(comp);
pack();
contained.setVisible(true);
}
}
.. and it creates a 1280x720 window with a black background (which is good) and it also creates a floating button in the top left-hand corner of my screen.. How do I make the button be in the window?