/* Research Project: Graphical Database for Category Theory J. Bradbury, Dr. R. Rosebrugh, I. Rutherford Mount Allison University 2001 Updated: May 8th, 2003 File: IsoFrame.java Description: This class implements a frame which allows the user to run the category tool "Isomorphism" on the current category. The code used to test for isomorphisms was removed and put into the file Iso.java. The obselete Borland libraries were removed. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.beans.*; public class IsoFrame extends JInternalFrame { private CategoryInternalFrame categoryInternalFrame_; private Iso iso; private Category cat; private JPanel buttonPanel = new JPanel(); private JButton isoButton = new JButton(); private JButton closeButton = new JButton(); private JComboBox choice1 = new JComboBox(); private JComboBox choice2 = new JComboBox(); private JLabel firstPathLabel = new JLabel(); private JCheckBox checkbox2 = new JCheckBox(); private JTextField path2 = new JTextField(10); private JTextField path1 = new JTextField(10); private JRadioButton specifyPathsButton = new JRadioButton(); private JRadioButton specifyObjectsButton = new JRadioButton(); private ButtonGroup specifyGroup; public IsoFrame(CategoryInternalFrame categoryInternalFrame) { super(categoryInternalFrame.getTitle() + ": Isomorphism Tool", true, true, false, false); categoryInternalFrame_ = categoryInternalFrame; cat = categoryInternalFrame_.getCategory(); iso = new Iso(cat); specifyGroup = new ButtonGroup(); specifyGroup.add(specifyPathsButton); specifyGroup.add(specifyObjectsButton); BoxLayout boxLay = new BoxLayout(buttonPanel, BoxLayout.X_AXIS); buttonPanel.add(isoButton); buttonPanel.add(closeButton); isoButton.setText("Iso?"); closeButton.setText("Close"); specifyPathsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { specifyPathsButton_action(); } }); specifyObjectsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { specifyObjectsButton_action(); } }); specifyPathsButton.setSelected(true); firstPathLabel.setText("1st path"); checkbox2.setText("2nd path"); checkbox2.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(ItemEvent e) { checkbox2_itemStateChanged(e); } }); Container contentPane = getContentPane(); contentPane.setLayout(new GridBagLayout()); contentPane.add(specifyPathsButton, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 3, 3, 3), 0, 0)); contentPane.add(specifyObjectsButton, new GridBagConstraints(0, 2, 1, 2, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 3, 3, 3), 0, 0)); contentPane.add(buttonPanel, new GridBagConstraints(0, 4, 3, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 3, 3, 3), 0, 0)); contentPane.add(choice1, new GridBagConstraints(1, 2, 2, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0)); contentPane.add(choice2, new GridBagConstraints(1, 3, 2, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0)); contentPane.add(firstPathLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0)); contentPane.add(checkbox2, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(10, 10, 10, 10), 0, 0)); contentPane.add(path1, new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0)); contentPane.add(path2, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0)); isoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { isoButton_actionPerformed(e); } }); closeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { closeButton_actionPerformed(e); } }); choice1.setBackground(Color.white); choice2.setBackground(Color.white); choice1.addItem("Check all objects"); choice2.addItem("Check all objects"); for (int i=0; i