Professional Documents
Culture Documents
Box Java
Box Java
JAVA:-
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/*<applet code= box.class width=500 height=500></applet>*/
public class box extends JApplet
{
JProgressBar jp1=new JProgressBar();
JSeparator js1=new JSeparator(JSeparator.HORIZONTAL);
JLabel jlabel=new JLabel("");
String d="";
public void init()
{
Container contentPane =getContentPane();
contentPane.setLayout(new FlowLayout());
JPanel jpanel1=new JPanel();
JPanel jpanel2=new JPanel();
JPanel jpanel3=new JPanel();
JPanel jpanel4=new JPanel();
JPanel jpanel5=new JPanel();
JPanel jpanel6=new JPanel();
//jp1=new JProgressBar();
//jp1.setValue(10);
jpanel1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Options"));
jpanel1.setLayout(new BoxLayout(jpanel1,BoxLayout.Y_AXIS));
jpanel1.add(Box.createVerticalStrut(10));
jpanel1.add(jbutton);
jpanel1.add(Box.createVerticalStrut(10));
jpanel1.add(jbutton1);
jpanel1.add(Box.createVerticalStrut(10));
jpanel1.add(jbutton2);
jpanel1.add(Box.createVerticalStrut(10));
jpanel1.add(jbutton3);
jpanel1.add(Box.createVerticalStrut(10));
jpanel2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Picture"));
jbutton6.setBounds(50,50,200,100);
jpanel2.add(jbutton6);
jpanel2.add(jbutton7);
jpanel2.add(jbutton8);
jpanel2.add(jbutton9);
jpanel2.setLayout(new BoxLayout(jpanel2,BoxLayout.X_AXIS));
jpanel2.add(Box.createRigidArea(new Dimension(20,330)));
//jpanel2.add(jpanel3);
jpanel2.add(Box.createRigidArea(new Dimension(200,330)));
jpanel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Your
Choice"));
jpanel3.setLayout(new BoxLayout(jpanel3,BoxLayout.X_AXIS));
jpanel3.add(Box.createHorizontalStrut(10));
jpanel3.add(jbutton4);
jpanel3.add(Box.createHorizontalStrut(10));
jpanel3.add(jbutton5);
jpanel3.add(Box.createHorizontalStrut(10));
//jp1.setStringPainted(true);
jbutton4.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
jp1.setValue(jp1.getValue() +25);
//d=jp1.getValue();
// jlabel("d");
}
});
contentPane.add(jpanel1);
contentPane.add(jpanel2);
contentPane.add(js1);
contentPane.add(jpanel3);
contentPane.add(jp1);
contentPane.add(jlabel);
}
}
TOPIC:- Image Game.