The source code for the QuickPanel class is here. See the applet in action. Check the source code for the QuickLabelPanel here and see the applet in action.
| /* * Filename: QuickPanelsApplet.java * Written By: Sunit Katkar * E-Mail:sunitkatkar@hotmail.com * Home-Page : www.vidyut.com/sunit * Java Page : www.vidyut.com/sunit/JavaPage.html *************************************************************** * Description: * QuickPanel and QuickLabelPanel classes put a little visual * enhancement to the otherwise invisible Panel **************************************************************** * Copyright (c) 1997 Sunit Katkar All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * for NON-COMMERCIAL or COMMERCIAL purposes and without fee * is hereby granted. I am not responsible for system crashes or * or other system issues as a result of this code. *****************************************************************/ import java.awt.*;
import java.applet.*;
public class QuickPanelsApplet extends Applet {
public QuickPanel gpnl1,gpnl2,gpnl3;
public QuickLabelPanel gpnl4, gpnl5;
public QuickButton1 btn1,btn2,btn3,btn4;
public Label lbl1,lbl2,lbl3,lbl4,lbl5;
public QuickPanel fillerpnl1,fillerpnl2;
public void init()
{
setLayout(new BorderLayout(2,2));
setBackground (Color.black);
addNotify();
gpnl1 = new QuickPanel(QuickPanel.SUNK);
gpnl1.setLayout(new FlowLayout(FlowLayout.CENTER));
gpnl1.setBackground (Color.lightGray);
gpnl2 = new QuickPanel(QuickPanel.RAISE);
gpnl2.setLayout(new FlowLayout(FlowLayout.CENTER));
gpnl2.setBackground (Color.lightGray);
gpnl3 = new QuickPanel(QuickPanel.ETCH);
gpnl3.setLayout(new FlowLayout(FlowLayout.CENTER));
gpnl3.setBackground (Color.lightGray);
fillerpnl1 = new QuickPanel();
fillerpnl2 = new QuickPanel(QuickPanel.ETCH);
fillerpnl1.setBackground (Color.lightGray);
fillerpnl2.setBackground (Color.lightGray);
gpnl4 = new QuickLabelPanel("QuickLabelPanel");
gpnl4.setLayout(new FlowLayout(FlowLayout.CENTER));
gpnl4.setBackground (Color.lightGray);
gpnl5 = new QuickLabelPanel("Another One");
gpnl5.setLayout(new FlowLayout(FlowLayout.CENTER));
gpnl5.setBackground (Color.lightGray);
btn1 = new QuickButton1("Welcome","Welcome","Dialog",12,Color.red);
btn2 = new QuickButton1("to","Welcome","Dialog",12,Color.red);
btn3 = new QuickButton1("Sunit's","QuickPanels","Dialog",12,Color.blue);
btn4 = new QuickButton1("QuickPanels","QuickPanels","Dialog",12,new Color(0,102,0));
lbl1 = new Label("This is a sunken QuickPanel",Label.CENTER);
lbl2 = new Label("This is a raised QuickPanel",Label.CENTER);
lbl3 = new Label("This is a etched QuickPanel",Label.CENTER);
lbl4 = new Label("QuickPanels - Panels with visible borders",Label.CENTER);
lbl5 = new Label("Try clicking the buttons",Label.CENTER);
lbl1.setFont(new Font("Dialog",Font.BOLD,12));
lbl2.setFont(new Font("Dialog",Font.BOLD,12));
lbl3.setFont(new Font("Dialog",Font.BOLD,12));
lbl4.setFont(new Font("Dialog",Font.BOLD,12));
lbl5.setFont(new Font("Dialog",Font.BOLD,12));
lbl1.setForeground(Color.blue);
lbl2.setForeground(Color.red);
lbl3.setForeground(Color.blue);
lbl4.setForeground(new Color(0,102,0));
lbl5.setForeground(new Color(0,102,0));
gpnl1.add(lbl1);
gpnl2.add(lbl4);
gpnl2.add(lbl2);
gpnl2.add(lbl5);
gpnl3.add(lbl3);
gpnl4.add(btn1);
gpnl4.add(btn2);
gpnl5.add(btn3);
gpnl5.add(btn4);
gpnl2.add(gpnl4);
gpnl2.add(gpnl5);
add("North",gpnl1);
add("Center",gpnl2);
add("South",gpnl3);
add("East",fillerpnl1);
add("West",fillerpnl2);
show();
}
public boolean handleEvent(Event evt)
{
switch (evt.id) {
case (Event.ACTION_EVENT):
if(evt.target == btn1)
{
lbl5.setText("'Welcome' button clicked");
}
if(evt.target == btn2)
{
lbl5.setText("'to' button clicked");
}
if(evt.target == btn3)
{
lbl5.setText("'Sunit's' button clicked");
}
if(evt.target == btn4)
{
lbl5.setText("'QuickPanels' button clicked");
}
break;
default :
break;
}
return true;
}
} //Applet ends
|