// Medusa is a graph viewer which allows interactive editing of networks
// (edges and nodes) and also connects to databases.
//
// Copyright (C) 2006 Sean Hooper
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330,
// Boston, MA 02111-1307 USA
package medusa;
import java.awt.Dimension;
import java.awt.event.ItemListener;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.event.ItemEvent;
import javax.swing.JLabel;
import javax.swing.JCheckBox;
import java.awt.FlowLayout;
import javax.swing.border.SoftBevelBorder;
import javax.swing.border.BevelBorder;
/*
* ShowEdgePanel.java
*
* Created on April 5, 2006, 5:44 PM
*/
/**
*
* @author hooper
*/
public class ShowEdgePanel extends javax.swing.JPanel
implements ItemListener{
private java.awt.Color labelColor;
private String text;
private int labelWidth=40;
private int labelHeight=40;
private int number=0;
private ShowEdgeMultiPanel parent;
/** Creates new form ShowEdgePanel */
public ShowEdgePanel() {
labelColor=new java.awt.Color(200,200,200);
text="empty";
initComponents();
}
public ShowEdgePanel(java.awt.Color labelColor, String text,
int labelWidth, int labelHeight, int number, ShowEdgeMultiPanel parent){
this.parent=parent;
this.labelColor=labelColor;
this.text=text;
this.labelWidth=labelWidth;
this.labelHeight=labelHeight;
this.number=number;
initComponents();
//addItemListener(this);
}
public void itemStateChanged(ItemEvent e){
//handleClassStateChange(e);
//System.out.println("dispatching "+getNumber());
//parent.dispatchEvent(e);
parent.handleEdgeEvent(getNumber(), edgeNameCheckBox.isSelected());
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
numberLabel = new javax.swing.JLabel();
edgeColorLabel = new javax.swing.JLabel();
edgeColorLabel.setBackground(labelColor);
Dimension d = new Dimension(labelWidth,labelHeight);
edgeColorLabel.setMaximumSize(d);
edgeColorLabel.setMinimumSize(d);
edgeColorLabel.setOpaque(true);
edgeColorLabel.setPreferredSize(d);
edgeNameCheckBox = new javax.swing.JCheckBox();
setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));
numberLabel.setText("jLabel1");
if (number>0){ numberLabel.setText(Integer.toString(number)); } else{ numberLabel.setText(" "); }
add(numberLabel);
edgeColorLabel.setBorder(new javax.swing.border.SoftBevelBorder
(javax.swing.border.BevelBorder.RAISED));
add(edgeColorLabel);
//edgeNameCheckBox.setText("sample interaction");
edgeNameCheckBox.setOpaque(false);
edgeNameCheckBox.setSelected(true);
edgeNameCheckBox.setText(text);
edgeNameCheckBox.addItemListener(this);
add(edgeNameCheckBox);
}//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel edgeColorLabel;
private javax.swing.JCheckBox edgeNameCheckBox;
private javax.swing.JLabel numberLabel;
// End of variables declaration//GEN-END:variables
public String toString(){
return text;
}
public int getNumber(){
return number;
}
}
Ads help maintain this website.