Search in sources :

Example 6 with OurCombobox

use of edu.mit.csail.sdg.alloy4.OurCombobox in project org.alloytools.alloy by AlloyTools.

the class SimpleGUI method doLicense.

/**
 * This method displays the license box.
 */
private Runner doLicense() {
    if (wrap)
        return wrapMe();
    final String JAR = Util.jarPrefix();
    String alloytxt;
    try {
        alloytxt = Util.readAll(JAR + "LICENSES" + File.separator + "Alloy.txt");
    } catch (IOException ex) {
        return null;
    }
    final JTextArea text = OurUtil.textarea(alloytxt, 15, 85, false, false, new EmptyBorder(2, 2, 2, 2), new Font("Monospaced", Font.PLAIN, 12));
    final JScrollPane scroll = OurUtil.scrollpane(text, new LineBorder(Color.DARK_GRAY, 1));
    final JComboBox combo = new OurCombobox(new String[] { "Alloy", "Kodkod", "JavaCup", "SAT4J", "ZChaff", "MiniSat" }) {

        private static final long serialVersionUID = 0;

        @Override
        public void do_changed(Object value) {
            if (value instanceof String) {
                try {
                    String content = Util.readAll(JAR + "LICENSES" + File.separator + value + ".txt");
                    text.setText(content);
                } catch (IOException ex) {
                    text.setText("Sorry: an error has occurred in displaying the license file.");
                }
            }
            text.setCaretPosition(0);
        }
    };
    OurDialog.showmsg("Copyright Notices", "The source code for the Alloy Analyzer is available under the MIT license.", " ", "The Alloy Analyzer utilizes several third-party packages whose code may", "be distributed under a different license. We are extremely grateful to", "the authors of these packages for making their source code freely available.", " ", OurUtil.makeH(null, "See the copyright notice for: ", combo, null), " ", scroll);
    return null;
}
Also used : JScrollPane(javax.swing.JScrollPane) OurCombobox(edu.mit.csail.sdg.alloy4.OurCombobox) JTextArea(javax.swing.JTextArea) JComboBox(javax.swing.JComboBox) LineBorder(javax.swing.border.LineBorder) IOException(java.io.IOException) EmptyBorder(javax.swing.border.EmptyBorder) Font(java.awt.Font)

Aggregations

OurCombobox (edu.mit.csail.sdg.alloy4.OurCombobox)6 JComboBox (javax.swing.JComboBox)5 JPanel (javax.swing.JPanel)5 Dimension (java.awt.Dimension)3 OurCheckbox (edu.mit.csail.sdg.alloy4.OurCheckbox)2 DotColor (edu.mit.csail.sdg.alloy4graph.DotColor)2 DotStyle (edu.mit.csail.sdg.alloy4graph.DotStyle)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 FocusAdapter (java.awt.event.FocusAdapter)2 FocusEvent (java.awt.event.FocusEvent)2 KeyAdapter (java.awt.event.KeyAdapter)2 KeyEvent (java.awt.event.KeyEvent)2 JLabel (javax.swing.JLabel)2 JTextField (javax.swing.JTextField)2 EmptyBorder (javax.swing.border.EmptyBorder)2 DotPalette (edu.mit.csail.sdg.alloy4graph.DotPalette)1 DotShape (edu.mit.csail.sdg.alloy4graph.DotShape)1 Font (java.awt.Font)1 MouseAdapter (java.awt.event.MouseAdapter)1