JFrame -Schaltfläche
import javax.swing.*;
import java.awt.*;
public class MyFrame {
MyFrame()
JFrame frame = new JFrame("Title");
frame.setTitle("JFrame title"); // Frame title
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Exit out of app
frame.setResizable(true); // Prevent frame from being resized, or not
frame.setSize(500,500); // Sets x and y
frame.setVisible(true); //makes frame visible
button = new JButton(); // creates button
Border border = BorderFactory.createLineBorder(Color.green, 3); // specifies border
button.setBounds(200, 100, 100, 50); // button properties
button.setBorder(border); // gives button border
button.setText("A nice button"); // button text
MyFrame.add(button); //adds button to frame
}}
ayaan