

This is an example how to create a statusbar in a JFrame using Java
First create a JLabel component like this:
JLabel status = new JLabel("This is a statusBar example");
And add the following code below in your program:
status.setPreferredSize(new Dimension(100, 16));
getContentPane().add(status, BorderLayout.SOUTH);



The code shows you how to create a menu in a JFrame.
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
public class MenuDemo extends JFrame{
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu(”Menu”);
JMenuItem openItem = new JMenuItem(”Open file”);
JMenuItem exitItem = new JMenuItem(”Exit”);
public MenuDemo(){
getContentPane().setLayout(null);
menuBar.add(menu);
menu.add(openItem);
menu.add(exitItem);
add(menuBar);
setJMenuBar(menuBar);
setTitle(”Menu demo”);
setSize(200,200);
setVisible(true);
}
public static void main(String[] args){
new MenuDemo();
}
}

More Options ...

Categories
Tag Cloud
Blog RSS
Comments RSS


Void (Default)
Life
Earth
Wind
Water
Fire
Lightweight