In this section we construct a simple Swing JFrame with a single JButton on it. Simple stuff so far, eh?
Now, for the Swing window, I'm just going to give you the 8 line chunk of code that creates
a JFrame and puts a JButton inside. This tutorial will NOT explain how to make
JFC/Swing GUI applications, I'm only 15 and I know Swing fairly well, I'm sure you can too.
Here it is:
JFrame frame = new JFrame("Sound1");
JPanel pane = new JPanel();
JButton button1 = new JButton("Click me!");
frame.getContentPane().add(pane);
pane.add(button1);
frame.pack();
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.show();
That makes the window and shows it. That also is the end of this section.
Comments