13 Apr 2008 @ 1:15 PM 

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);

Tags Tags: , , , , , ,
Categories: Java
Posted By: HappyFace
Last Edit: 13 Apr 2008 @ 01 15 PM

E-mailPermalinkComments (0)
 12 Apr 2008 @ 8:09 PM 

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();
}
}

Tags Tags: , , , ,
Categories: Java
Posted By: HappyFace
Last Edit: 12 Apr 2008 @ 08 11 PM

E-mailPermalinkComments (0)
\/ More Options ...
Change Theme...
  • Role »
  • Posts »
  • Comments »
Change Theme...
  • VoidVoid (Default)
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLightweight