This is very basic code but i just need some help to understand..
i have a button and i want to place it on the EAST side of the Panel.. any suggestions..
public class ButtonText {
public static void main(String[] args) {
Frame frame=new Frame("Button Frame");
Button button = new Button("Submit");
frame.setLayout(new FlowLayout());
frame.add(button, BorderLayout.EAST);
frame.setSize(200,100);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
which looks like this https://i.stack.imgur.com/WHX4Y.jpg
any help would be greatly appreciated thank you!
To lay your user interface out with a border layout manager, you need to set your frame’s layout to an instance of BorderLayout. A default FlowLayout sets components out from left to right and onto next lines if necessary.