Midi Synthesis in Java

The Swing Window

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.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou