/* Research Project: Graphical Database for Category Theory J. Bradbury, Dr. R. Rosebrugh, I. Rutherford Mount Allison University 2001 Updated: May 8th, 2003 (J. Tweedle) File: MonoFrame.java Description: This class implements a frame which allows the user to run the category tool "Monomorphism" on the current category. The code to test for monomorphisms was removed and put into the file Mono.java. The obselete Borland libraries were removed. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.beans.*; public class MonoFrame extends JInternalFrame { private CategoryInternalFrame categoryInternalFrame_; private Category cat = new Category(); private Mono mono; private JButton monoButton = new JButton(); private JButton closeButton = new JButton(); private JLabel monoLabel = new JLabel(); // private JTextArea viewbox = new JTextArea("", 3, 3); private JTextField monoPath = new JTextField(10); private JRadioButton allPathsButton = new JRadioButton("Check All Paths", true); private JRadioButton monoPathButton = new JRadioButton("Monomorphism Path"); private ButtonGroup monoGroup = new ButtonGroup(); // private JScrollPane areaScrollPane; public MonoFrame(CategoryInternalFrame categoryInternalFrame) { super(categoryInternalFrame.getTitle() + ": Monomorphism", true, true, false, false); categoryInternalFrame_ = categoryInternalFrame; cat.copyCategory(categoryInternalFrame_.getCategory()); mono = new Mono(cat); monoButton.setText("Mono?"); monoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { monoButton_actionPerformed(e); } }); closeButton.setText("Close"); monoLabel.setText("Monomorphism path:"); closeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { closeButton_actionPerformed(e); } }); monoGroup.add(allPathsButton); monoGroup.add(monoPathButton); Container contentPane = getContentPane(); contentPane.setLayout(new GridBagLayout()); contentPane.add(monoPathButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); contentPane.add(monoButton, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); contentPane.add(closeButton, new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); contentPane.add(monoPath, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); contentPane.add(allPathsButton, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); } public void closeButton_actionPerformed(ActionEvent e) { try{this.setClosed(true);} catch (PropertyVetoException PVE) {} } public void monoButton_actionPerformed(ActionEvent e) { String viewbox = ""; mono.setOutput(""); mono.setEndoPassed(false); if (allPathsButton.isSelected()) { int i, j; int path[] = new int[cat.ini.getMAXARR()]; int objects[] = new int[cat.num_objects]; HomTree pathtree; mono.setSupressOutput(true); mono.setNumMonos(0); for (i=0; i