The main use of this program is to illustrate rigid area and other box
layout stuff*/
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
class DontSend extends JFrame
{
JButton buttonDontSend, buttonSend;
JLabel labelWarning;
JLabel labelNote;
JPanel labelPane , buttonPane ;
DontSend()
{
super("Error Report");
Container c = getContentPane();
labelPane = new JPanel();
buttonPane = new JPanel();
labelPane.setLayout( new BoxLayout(labelPane, BoxLayout.PAGE_AXIS));
labelWarning = new JLabel("<html>There seems to be some unkowm error
while trying to do what you did"+
"<br>This is an unknown error and
Windooose recommends you do smoething about it "+
"<br>or you will have to face the consequences");
labelWarning .setBackground(Color.RED);
labelWarning .setForeground(Color.BLACK);
labelWarning .setFont(new Font("SansSerif" , Font.PLAIN, 15));
labelNote = new JLabel("<html>If you are so concerned with this great
error ,we would recommend you to inform"+
"<br>someone about this fantastic error. Click send report to inform
windoose about this "+
"<br>wonderful error.It will be a feast for our eyes<html>");
labelNote.setBackground(Color.white);
labelNote.setFont(new Font("SansSerif" , Font.PLAIN, 15));
labelPane.add(labelWarning);
labelPane.add(Box.createRigidArea(new Dimension(0,25)));
labelPane.add(labelNote);
//setting the layout and also putting the buttons
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonSend = new JButton("Send report");
buttonDontSend = new JButton("Don't Send");
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(buttonSend );
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(buttonDontSend );
c.add(labelPane , BorderLayout.CENTER);
c.add(buttonPane, BorderLayout.PAGE_END);
} // end of constructor
} // end of class
class DontSendTest
{
public static void main(String args[])
{
DontSend ds = new DontSend ();
ds.setSize(550,280);
ds.setVisible(true);
ds.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//*************************************************************************