portions from one of my major graphical password project
* unfortunately, due to the privacy issues, I can only show you part of my project, but the entire project consists of 6 classes + over 5000 lines of java code
==============================================================================================
private void addComponent(Container container,Component c,int x,int y,int
width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}
/** Listens to the combo box. */
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
String catagory = (String)cb.getSelectedItem();
updateLabel(catagory);
}
protected void updateLabel(String theme) {
if (theme.equals("Cartoon")){
jLabel35.setIcon(new ImageIcon("C:\\Documents and Settings\\csc8820\\Desktop\\suo\\RAF\\ICON\\hardware\\UPSTruck.JPG"));
jLabel36.setIcon(new ImageIcon("C:\\Documents and Settings\\csc8820\\Desktop\\suo\\RAF\\ICON\\hardware\\UPSTruck2.JPG"));
}
if (theme.equals("People")){
abel31.setIcon(new ImageIcon("C:\\Documents and Settings\\csc8820\\Desktop\\suo\\RAF\\ICON\\star\\p23.JPG"));
}
if (theme.equals("Theme Choices")){
}
jLabel3.setToolTipText("A drawing of a " + theme.toLowerCase());
//ImageIcon icon = createImageIcon("C:\\Documents and
Settings\\csc8820\\Desktop\\suo\\RAF\\ICON\\cartoon\\" + theme + "\\");
//if (icon != null) {
// jLabel3.setText(null);
//} else {
// jLabel3.setText("Image not found");
//}
}
/*private void addComponent(Container container,Component c,int x,int y,int
width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}*/
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = RAF_v60_suo.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
private void jTable3_componentAdded(ContainerEvent e)
{
System.out.println("\njTable3_componentAdded(ContainerEvent e) called.");
// TODO: Add any handling code here
}
private void jTable3_componentRemoved(ContainerEvent e)
{
System.out.println("\njTable3_componentRemoved(ContainerEvent e) called.");
// TODO: Add any handling code here
}
private void jTable3_mouseClicked(MouseEvent e)
{
System.out.println("\njTable3_mouseClicked(MouseEvent e) called.");
// TODO: Add any handling code here
}
private void jTable3_mousePressed(MouseEvent e)
{
System.out.println("\njTable3_mousePressed(MouseEvent e) called.");
// TODO: Add any handling code here
}
private void jTable3_mouseReleased(MouseEvent e)
{
System.out.println("\njTable3_mouseReleased(MouseEvent e) called.");
// TODO: Add any handling code here
}
private void jTable3_mouseDragged(MouseEvent e)
{
System.out.println("\njTable3_mouseDragged(MouseEvent e) called.");
// TODO: Add any handling code here
}
private void jTable3_mouseMoved(MouseEvent e)
{
System.out.println("\njTable3_mouseMoved(MouseEvent e) called.");
// TODO: Add any handling code here
}
private void jTable3_propertyChange(PropertyChangeEvent e)
{
System.out.println("\njTable3_propertyChange(PropertyChangeEvent e) called.");
System.out.println(">>" + "PropertyName:" + e.getPropertyName() + ";\tOldValue:"
+ e.getOldValue() + ";\tNewValue:" + e.getNewValue());
// TODO: Add any handling code here
}
private void jTable3_keyTyped(KeyEvent e)
{
System.out.println("\njTable3_keyTyped(KeyEvent e) called.");
// TODO: Add any handling code here
}
/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
JFrame frame = new JFrame("RAF");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent newContentPane = new RAF_v60_suo();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
class newModel extends DefaultTableModel
{
public newModel(Object[][] data, Object[] columns)
{
super(data, columns);
}
public boolean isCellEditable(int row, int col)
{
return false;
}
public Class getColumnClass(int column)
{
Vector v = (Vector) dataVector.elementAt(0);
return v.elementAt(column).getClass();
}
}