Example usage for javax.swing JPanel setMinimumSize

List of usage examples for javax.swing JPanel setMinimumSize

Introduction

In this page you can find the example usage for javax.swing JPanel setMinimumSize.

Prototype

@BeanProperty(description = "The minimum size of the component.")
public void setMinimumSize(Dimension minimumSize) 

Source Link

Document

Sets the minimum size of this component to a constant value.

Usage

From source file:com.jamfsoftware.jss.healthcheck.ui.HealthReport.java

/**
 * Creates a new Health Report JPanel window from the Health Check JSON string.
 * Will throw errors if the JSON is not formatted correctly.
 *//*from   w ww . j a va  2  s. c o m*/
public HealthReport(final String JSON) throws Exception {
    LOGGER.debug("[DEBUG] - JSON String (Copy entire below line)");
    LOGGER.debug(JSON.replace("\n", ""));
    LOGGER.debug("Attempting to parse Health Report JSON");

    JsonElement report = new JsonParser().parse(JSON);
    JsonObject healthcheck = ((JsonObject) report).get("healthcheck").getAsJsonObject();
    Boolean show_system_info = true;
    JsonObject system = null;
    //Check if the check JSON contains system information and show/hide panels accordingly later.
    system = ((JsonObject) report).get("system").getAsJsonObject();

    final JsonObject data = ((JsonObject) report).get("checkdata").getAsJsonObject();

    this.JSSURL = extractData(healthcheck, "jss_url");

    if (extractData(system, "iscloudjss").contains("true")) {
        show_system_info = false;
        isCloudJSS = true;
    }

    PanelIconGenerator iconGen = new PanelIconGenerator();
    PanelGenerator panelGen = new PanelGenerator();

    //Top Level Frame
    final JFrame frame = new JFrame("JSS Health Check Report");

    //Top Level Content
    JPanel outer = new JPanel(new BorderLayout());

    //Two Blank Panels for the Sides
    JPanel blankLeft = new JPanel();
    blankLeft.add(new JLabel("        "));
    JPanel blankRight = new JPanel();
    blankRight.add(new JLabel("        "));
    blankLeft.setMinimumSize(new Dimension(100, 100));
    blankRight.setMinimumSize(new Dimension(100, 100));
    //Header
    JPanel header = new JPanel();
    header.add(new JLabel("Total Computers: " + extractData(healthcheck, "totalcomputers")));
    header.add(new JLabel("Total Mobile Devices: " + extractData(healthcheck, "totalmobile")));
    header.add(new JLabel("Total Users: " + extractData(healthcheck, "totalusers")));
    int total_devices = Integer.parseInt(extractData(healthcheck, "totalcomputers"))
            + Integer.parseInt(extractData(healthcheck, "totalmobile"));
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss");
    Date dateobj = new Date();
    header.add(new JLabel("JSS Health Check Report Performed On " + df.format(dateobj)));
    //Foooter
    JPanel footer = new JPanel();
    JButton view_report_json = new JButton("View Report JSON");
    footer.add(view_report_json);
    JButton view_activation_code = new JButton("View Activation Code");
    footer.add(view_activation_code);
    JButton test_again = new JButton("Run Test Again");
    footer.add(test_again);
    JButton view_text_report = new JButton("View Text Report");
    footer.add(view_text_report);
    JButton about_and_terms = new JButton("About and Terms");
    footer.add(about_and_terms);
    //Middle Content, set the background white and give it a border
    JPanel content = new JPanel(new GridLayout(2, 3));
    content.setBackground(Color.WHITE);
    content.setBorder(BorderFactory.createLineBorder(Color.BLACK));

    //Setup Outer Placement
    outer.add(header, BorderLayout.NORTH);
    outer.add(footer, BorderLayout.SOUTH);
    outer.add(blankLeft, BorderLayout.WEST);
    outer.add(blankRight, BorderLayout.EAST);
    outer.add(content, BorderLayout.CENTER);

    //Don't show system info if it is hosted.
    JPanel system_info = null;
    JPanel database_health = null;
    if (show_system_info) {
        //Read all of the System information variables from the JSON and perform number conversions.
        String[][] sys_info = { { "Operating System", extractData(system, "os") },
                { "Java Version", extractData(system, "javaversion") },
                { "Java Vendor", extractData(system, "javavendor") },
                { "Processor Cores", extractData(system, "proc_cores") },
                { "Is Clustered?", extractData(system, "clustering") },
                { "Web App Directory", extractData(system, "webapp_dir") },
                { "Free Memory",
                        Double.toString(
                                round((Double.parseDouble(extractData(system, "free_memory")) / 1000000000), 2))
                                + " GB" },
                { "Max Memory",
                        Double.toString(
                                round((Double.parseDouble(extractData(system, "max_memory")) / 1000000000), 2))
                                + " GB" },
                { "Memory currently in use", Double.toString(round(
                        (Double.parseDouble(extractData(system, "memory_currently_in_use")) / 1000000000), 2))
                        + " GB" },
                { "Total space",
                        Double.toString(
                                round((Double.parseDouble(extractData(system, "total_space")) / 1000000000), 2))
                                + " GB" },
                { "Free Space",
                        Double.toString(round(
                                (Double.parseDouble(extractData(system, "usable_space")) / 1000000000), 2))
                                + " GB" } };
        //Generate the system info panel.
        String systemInfoIcon = iconGen.getSystemInfoIconType(
                Integer.parseInt(extractData(healthcheck, "totalcomputers"))
                        + Integer.parseInt(extractData(healthcheck, "totalmobile")),
                extractData(system, "javaversion"), Double.parseDouble(extractData(system, "max_memory")));
        system_info = panelGen.generateContentPanelSystem("System Info", sys_info, "JSS Minimum Requirements",
                "http://www.jamfsoftware.com/resources/casper-suite-system-requirements/", systemInfoIcon);

        //Get all of the DB information.
        String[][] db_health = { { "Database Size", extractData(system, "database_size") + " MB" } };
        if (extractData(system, "database_size").equals("0")) {
            db_health[0][0] = "Unable to connect to database.";
        }

        String[][] large_sql_tables = extractArrayData(system, "largeSQLtables", "table_name", "table_size");
        String[][] db_health_for_display = ArrayUtils.addAll(db_health, large_sql_tables);
        //Generate the DB Health panel.
        String databaseIconType = iconGen.getDatabaseInfoIconType(total_devices,
                Double.parseDouble(extractData(system, "database_size")),
                extractArrayData(system, "largeSQLtables", "table_name", "table_size").length);
        database_health = panelGen.generateContentPanelSystem("Database Health", db_health_for_display,
                "Too Large SQL Tables", "https://google.com", databaseIconType);
        if (!databaseIconType.equals("green")) {
            this.showLargeDatabase = true;
        }
    }

    int password_strenth = 0;
    if (extractData(data, "password_strength", "uppercase?").contains("true")) {
        password_strenth++;
    }
    if (extractData(data, "password_strength", "lowercase?").contains("true")) {
        password_strenth++;
    }
    if (extractData(data, "password_strength", "number?").contains("true")) {
        password_strenth++;
    }
    if (extractData(data, "password_strength", "spec_chars?").contains("true")) {
        password_strenth++;
    }
    String password_strength_desc = "";
    if (password_strenth == 4) {
        password_strength_desc = "Excellent";
    } else if (password_strenth == 3 || password_strenth == 2) {
        password_strength_desc = "Good";
    } else if (password_strenth == 1) {
        this.strongerPassword = true;
        password_strength_desc = "Poor";
    } else {
        this.strongerPassword = true;
        password_strength_desc = "Needs Updating";
    }

    if (extractData(data, "loginlogouthooks", "is_configured").contains("false")) {
        this.loginInOutHooks = true;
    }

    try {
        if (Integer.parseInt(extractData(data, "device_row_counts", "computers").trim()) != Integer
                .parseInt(extractData(data, "device_row_counts", "computers_denormalized").trim())) {
            this.computerDeviceTableCountMismatch = true;
        }

        if (Integer.parseInt(extractData(data, "device_row_counts", "mobile_devices").trim()) != Integer
                .parseInt(extractData(data, "device_row_counts", "mobile_devices_denormalized").trim())) {
            this.mobileDeviceTableCountMismatch = true;
        }
    } catch (Exception e) {
        System.out.println("Unable to parse device row counts.");
    }

    if ((extractData(system, "mysql_version").contains("5.6.16")
            || extractData(system, "mysql_version").contains("5.6.20"))
            && (extractData(system, "os").contains("OS X") || extractData(system, "os").contains("Mac")
                    || extractData(system, "os").contains("OSX"))) {
        this.mysql_osx_version_bug = true;
    }

    //Get all of the information for the JSS ENV and generate the panel.
    String[][] env_info = {
            { "Checkin Frequency", extractData(data, "computercheckin", "frequency") + " Minutes" },
            { "Log Flushing", extractData(data, "logflushing", "log_flush_time") },
            { "Log In/Out Hooks", extractData(data, "loginlogouthooks", "is_configured") },
            { "Computer EA", extractData(data, "computerextensionattributes", "count") },
            { "Mobile Deivce EA", extractData(data, "mobiledeviceextensionattributes", "count") },
            { "Password Strength", password_strength_desc },
            { "SMTP Server", extractData(data, "smtpserver", "server") },
            { "Sender Email", extractData(data, "smtpserver", "sender_email") },
            { "GSX Connection", extractData(data, "gsxconnection", "status") } };
    String[][] vpp_accounts = extractArrayData(data, "vppaccounts", "name", "days_until_expire");
    String[][] ldap_servers = extractArrayData(data, "ldapservers", "name", "type", "address", "id");
    String envIconType = iconGen.getJSSEnvIconType(Integer.parseInt(extractData(healthcheck, "totalcomputers")),
            Integer.parseInt(extractData(data, "computercheckin", "frequency")),
            Integer.parseInt(extractData(data, "computerextensionattributes", "count")),
            Integer.parseInt(extractData(data, "mobiledeviceextensionattributes", "count")));
    JPanel env = panelGen.generateContentPanelEnv("JSS Environment", env_info, vpp_accounts, ldap_servers, "",
            "", envIconType);

    //Get all of the group information from the JSON, merge the arrays, and then generate the groups JPanel.
    String[][] groups_1 = ArrayUtils.addAll(
            extractArrayData(data, "computergroups", "name", "nested_groups_count", "criteria_count", "id"),
            extractArrayData(data, "mobiledevicegroups", "name", "nested_groups_count", "criteria_count",
                    "id"));
    String[][] groups_2 = ArrayUtils.addAll(groups_1,
            extractArrayData(data, "usergroups", "name", "nested_groups_count", "criteria_count", "id"));
    String groupIconType = iconGen.getGroupIconType("groups", countJSONObjectSize(data, "computergroups")
            + countJSONObjectSize(data, "mobiledevicegroups") + countJSONObjectSize(data, "usergroups"));
    JPanel groups = panelGen.generateContentPanelGroups("Groups", groups_2, "", "", groupIconType);
    if (groupIconType.equals("yellow") || groupIconType.equals("red")) {
        this.showGroupsHelp = true;
    }

    //Get all of the information for the printers, policies and scripts, then generate the panel.
    String[][] printers = extractArrayData(data, "printer_warnings", "model");
    String[][] policies = extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger");
    String[][] scripts = extractArrayData(data, "scripts_needing_update", "name");
    String[][] certs = { { "SSL Cert Issuer", extractData(data, "tomcat", "ssl_cert_issuer") },
            { "SLL Cert Expires", extractData(data, "tomcat", "cert_expires") },
            { "MDM Push Cert Expires", extractData(data, "push_cert_expirations", "mdm_push_cert") },
            { "Push Proxy Expires", extractData(data, "push_cert_expirations", "push_proxy") },
            { "Change Management Enabled?", extractData(data, "changemanagment", "isusinglogfile") },
            { "Log File Path:", extractData(data, "changemanagment", "logpath") } };
    String policiesScriptsIconType = iconGen.getPoliciesAndScriptsIconType(
            extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger").length,
            extractArrayData(data, "scripts_needing_update", "name").length);
    JPanel policies_scripts = panelGen.generateContentPanelPoliciesScripts(
            "Policies, Scripts, Certs and Change", policies, scripts, printers, certs, "", "",
            policiesScriptsIconType);
    if (extractArrayData(data, "policies_with_issues", "name", "ongoing", "checkin_trigger").length > 0) {
        this.showPolicies = true;
    }
    if (extractArrayData(data, "scripts_needing_update", "name").length > 0) {
        this.showScripts = true;
    }
    if (extractData(data, "changemanagment", "isusinglogfile").contains("false")) {
        this.showChange = true;
    }
    this.showCheckinFreq = iconGen.showCheckinFreq;
    this.showExtensionAttributes = iconGen.showCheckinFreq;
    this.showSystemRequirements = iconGen.showSystemRequirements;
    this.showScalability = iconGen.showScalability;
    //Update Panel Gen Variables
    updatePanelGenVariables(panelGen);

    //Generate the Help Section.
    content.add(panelGen.generateContentPanelHelp("Modifications to Consider", "", "", "blank"));
    //If contains system information, add those panels, otherwise just continue adding the rest of the panels.
    if (show_system_info) {
        content.add(system_info);
        content.add(database_health);
    }
    content.add(env);
    content.add(groups);
    content.add(policies_scripts);

    //View report action listner.
    //Opens a window with the health report JSON listed
    view_report_json.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel middlePanel = new JPanel();
            middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "Health Report JSON"));
            // create the middle panel components
            JTextArea display = new JTextArea(16, 58);
            display.setEditable(false);
            //Make a new GSON object so the text can be Pretty Printed.
            Gson gson = new GsonBuilder().setPrettyPrinting().create();
            String pp_json = gson.toJson(JSON.trim());
            display.append(JSON);
            JScrollPane scroll = new JScrollPane(display);
            scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            //Add Textarea in to middle panel
            middlePanel.add(scroll);

            JFrame frame = new JFrame();
            frame.add(middlePanel);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    //Action listener for the Terms, About and Licence button.
    //Opens a new window with the AS IS License, 3rd Party Libs used and a small about section
    about_and_terms.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel middlePanel = new JPanel();
            middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "About, Licence and Terms"));
            // create the middle panel components
            JTextArea display = new JTextArea(16, 58);
            display.setEditable(false);
            display.append(StringConstants.ABOUT);
            display.append("\n\nThird Party Libraries Used:");
            display.append(
                    " Apache Commons Codec, Google JSON (gson), Java X JSON, JDOM, JSON-Simple, MySQL-connector");
            display.append(StringConstants.LICENSE);
            JScrollPane scroll = new JScrollPane(display);
            scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            //Add Textarea in to middle panel
            middlePanel.add(scroll);

            JFrame frame = new JFrame();
            frame.add(middlePanel);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });

    //Listener for a button click to open a window containing the activation code.
    view_activation_code.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(frame, extractData(data, "activationcode", "code") + "\nExpires: "
                    + extractData(data, "activationcode", "expires"));
        }
    });

    view_text_report.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel middlePanel = new JPanel();
            middlePanel.setBorder(new TitledBorder(new EtchedBorder(), "Text Health Report"));
            // create the middle panel components
            JTextArea display = new JTextArea(16, 58);
            display.setEditable(false);
            //Make a new GSON object so the text can be Pretty Printed.
            display.append(new HealthReportHeadless(JSON).getReportString());
            JScrollPane scroll = new JScrollPane(display);
            scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            //Add Textarea in to middle panel
            middlePanel.add(scroll);

            JFrame frame = new JFrame();
            frame.add(middlePanel);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });

    //Listener for the Test Again button. Opens a new UserPrompt object and keeps the Health Report open in the background.
    test_again.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                new UserPrompt();
            } catch (Exception ex) {
                ex.printStackTrace();
            }

        }
    });

    frame.add(outer);
    frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setVisible(true);

    DetectVM vm_checker = new DetectVM();
    if (EnvironmentUtil.isMac()) {
        if (vm_checker.getIsVM()) {
            JOptionPane.showMessageDialog(new JFrame(),
                    "The tool has detected that it is running in a OSX Virtual Machine.\nThe opening of links is not supported on OSX VMs.\nPlease open the tool on a non-VM computer and run it again OR\nyou can also copy the JSON from the report to a non-VM OR view the text report.\nIf you are not running a VM, ignore this message.",
                    "VM Detected", JOptionPane.ERROR_MESSAGE);
        }
    }

}

From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPUrlConfigGui.java

protected JPanel getProtocolAndMethodPanel() {

    // Implementation

    if (showImplementation) {
        httpImplementation = new JLabeledChoice(UPMPConstant.upmp_implementation, // $NON-NLS-1$
                UPMPSamplerFactory.getImplementations());
        httpImplementation.addValue("");
    }/*  w w w. j a  v  a  2 s . co  m*/
    // PROTOCOL
    protocol = new JTextField(4);
    JLabel protocolLabel = new JLabel(JMeterUtils.getResString("protocol")); // $NON-NLS-1$
    protocolLabel.setLabelFor(protocol);

    // CONTENT_ENCODING
    contentEncoding = new JTextField(10);
    JLabel contentEncodingLabel = new JLabel(JMeterUtils.getResString("content_encoding")); // $NON-NLS-1$
    contentEncodingLabel.setLabelFor(contentEncoding);

    if (notConfigOnly) {
        method = new JLabeledChoice(JMeterUtils.getResString("method"), // $NON-NLS-1$
                UPMPSamplerBase.getValidMethodsAsArray());
    }

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));

    if (showImplementation) {
        panel.add(httpImplementation);
    }
    panel.add(protocolLabel);
    panel.add(protocol);
    panel.add(Box.createHorizontalStrut(5));

    if (notConfigOnly) {
        panel.add(method);
    }
    panel.setMinimumSize(panel.getPreferredSize());
    panel.add(Box.createHorizontalStrut(5));

    panel.add(contentEncodingLabel);
    panel.add(contentEncoding);
    panel.setMinimumSize(panel.getPreferredSize());
    return panel;
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

private JPanel buildLateral(final String topLabel, final Dimension dimension1,
        final Dimension dimensionFilterLateral, JScrollPane scrollList, JList list, boolean left) {
    JPanel leftPanel = new JPanel(new GridBagLayout());
    leftPanel.setOpaque(false);/*from  ww w  .j  a  va2 s.  c o  m*/
    leftPanel.setMinimumSize(dimension1);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;
    JPanel left_filtro = buildPanelFilter(topLabel, textfieldSize - 21, dimensionFilterLateral, list, left);
    leftPanel.add(left_filtro, gbc);
    gbc.gridy++;

    leftPanel.add(scrollList, gbc);

    return leftPanel;
}

From source file:FontPicker.java

public FontChooser(Frame parent) {
    super(parent, "Font Chooser", true);
    setSize(450, 450);// ww  w.  j a  v a  2 s  .  c  om
    attributes = new SimpleAttributeSet();

    // Make sure that any way the user cancels the window does the right
    // thing
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            closeAndCancel();
        }
    });

    // Start the long process of setting up our interface
    Container c = getContentPane();

    JPanel fontPanel = new JPanel();
    fontName = new JComboBox(new String[] { "TimesRoman", "Helvetica", "Courier" });
    fontName.setSelectedIndex(1);
    fontName.addActionListener(this);
    fontSize = new JTextField("12", 4);
    fontSize.setHorizontalAlignment(SwingConstants.RIGHT);
    fontSize.addActionListener(this);
    fontBold = new JCheckBox("Bold");
    fontBold.setSelected(true);
    fontBold.addActionListener(this);
    fontItalic = new JCheckBox("Italic");
    fontItalic.addActionListener(this);

    fontPanel.add(fontName);
    fontPanel.add(new JLabel(" Size: "));
    fontPanel.add(fontSize);
    fontPanel.add(fontBold);
    fontPanel.add(fontItalic);

    c.add(fontPanel, BorderLayout.NORTH);

    // Set up the color chooser panel and attach a change listener so that
    // color
    // updates get reflected in our preview label.
    colorChooser = new JColorChooser(Color.black);
    colorChooser.getSelectionModel().addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            updatePreviewColor();
        }
    });
    c.add(colorChooser, BorderLayout.CENTER);

    JPanel previewPanel = new JPanel(new BorderLayout());
    previewLabel = new JLabel("Here's a sample of this font.");
    previewLabel.setForeground(colorChooser.getColor());
    previewPanel.add(previewLabel, BorderLayout.CENTER);

    // Add in the Ok and Cancel buttons for our dialog box
    JButton okButton = new JButton("Ok");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            closeAndSave();
        }
    });
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            closeAndCancel();
        }
    });

    JPanel controlPanel = new JPanel();
    controlPanel.add(okButton);
    controlPanel.add(cancelButton);
    previewPanel.add(controlPanel, BorderLayout.SOUTH);

    // Give the preview label room to grow.
    previewPanel.setMinimumSize(new Dimension(100, 100));
    previewPanel.setPreferredSize(new Dimension(100, 100));

    c.add(previewPanel, BorderLayout.SOUTH);
}

From source file:com.floreantpos.ui.views.SwitchboardView.java

/**
 * 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.final DataUpdateInfo
 *///  w  ww .java 2 s .  co m
// <editor-fold defaultstate="collapsed" desc=" Generated Code
// <editor-fold defaultstate="collapsed"
// desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    setLayout(new java.awt.BorderLayout(10, 10));

    javax.swing.JPanel centerPanel = new javax.swing.JPanel(new java.awt.BorderLayout(5, 5));
    javax.swing.JPanel ticketsAndActivityPanel = new javax.swing.JPanel(new java.awt.BorderLayout(5, 5));

    ticketsListPanelBorder = BorderFactory.createTitledBorder(null, POSConstants.OPEN_TICKETS_AND_ACTIVITY,
            TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION);

    ticketsAndActivityPanel.setBorder(new CompoundBorder(ticketsListPanelBorder, new EmptyBorder(2, 2, 2, 2)));

    ticketsAndActivityPanel.add(ticketList, java.awt.BorderLayout.CENTER);

    JPanel activityPanel = createActivityPanel();

    ticketsAndActivityPanel.add(activityPanel, java.awt.BorderLayout.SOUTH);

    btnAssignDriver.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doAssignDriver();
        }
    });

    btnCloseOrder.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doCloseOrder();
        }
    });

    centerPanel.add(ticketsAndActivityPanel, java.awt.BorderLayout.CENTER);

    JPanel rightPanel = new JPanel(new BorderLayout(20, 20));
    TitledBorder titledBorder2 = BorderFactory.createTitledBorder(null, "-", TitledBorder.CENTER, //$NON-NLS-1$
            TitledBorder.DEFAULT_POSITION);
    rightPanel.setBorder(new CompoundBorder(titledBorder2, new EmptyBorder(2, 2, 6, 2)));

    orderPanel = new JPanel(new MigLayout("ins 2 2 0 2, fill, hidemode 3, flowy", "fill, grow", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    rendererOrderPanel();

    rightPanel.add(orderPanel);
    rightPanel.setMinimumSize(PosUIManager.getSize(120, 0));

    centerPanel.add(rightPanel, java.awt.BorderLayout.EAST);

    add(centerPanel, java.awt.BorderLayout.CENTER);
}

From source file:net.sf.jabref.gui.plaintextimport.TextInputDialog.java

private JPanel setUpFieldListPanel() {
    JPanel inputPanel = new JPanel();

    // Panel Layout
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints con = new GridBagConstraints();
    con.weightx = 0;/*from w ww .ja  v  a  2 s.c  o m*/
    con.insets = new Insets(5, 5, 0, 5);
    con.fill = GridBagConstraints.HORIZONTAL;

    inputPanel.setLayout(gbl);

    // Border
    TitledBorder titledBorder1 = new TitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153), 2),
            Localization.lang("Work options"));
    inputPanel.setBorder(titledBorder1);
    inputPanel.setMinimumSize(new Dimension(10, 10));

    JScrollPane fieldScroller = new JScrollPane(fieldList);
    fieldScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);

    // insert buttons
    insertButton.addActionListener(event -> insertTextForTag(override.isSelected()));

    // Radio buttons
    append.setToolTipText(Localization.lang("Append the selected text to BibTeX field"));
    append.setMnemonic(KeyEvent.VK_A);
    append.setSelected(true);

    override.setToolTipText(Localization.lang("Override the BibTeX field by the selected text"));
    override.setMnemonic(KeyEvent.VK_O);
    override.setSelected(false);

    //Group the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(append);
    group.add(override);

    JPanel radioPanel = new JPanel(new GridLayout(0, 1));
    radioPanel.add(append);
    radioPanel.add(override);

    // insert sub components
    JLabel label1 = new JLabel(Localization.lang("Available BibTeX fields"));
    con.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(label1, con);
    inputPanel.add(label1);

    con.gridwidth = GridBagConstraints.REMAINDER;
    con.gridheight = 8;
    con.weighty = 1;
    con.fill = GridBagConstraints.BOTH;
    gbl.setConstraints(fieldScroller, con);
    inputPanel.add(fieldScroller);

    con.fill = GridBagConstraints.HORIZONTAL;
    con.weighty = 0;
    con.gridwidth = 2;
    gbl.setConstraints(radioPanel, con);
    inputPanel.add(radioPanel);

    con.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(insertButton, con);
    inputPanel.add(insertButton);
    return inputPanel;
}

From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java

/**
 * Creates the whole navigation panel which contains the navigation tree and the user list at the bottom.
 * @return the navigation panel/*from   w  w w  .j ava 2 s  .co m*/
 */
private JPanel createNavigationPanel() {
    JPanel navigationPanel = new JPanel();
    final PanelBuilder mainPB = new PanelBuilder(
            new FormLayout("min(210px;p)", "p,3dlu,p,3dlu,f:p:g,2px,p,10px,p"), navigationPanel);
    final CellConstraints cc = new CellConstraints();

    JPanel navTreePanel = createFullTreeNavPanel(); // navigation jTree gets created here 
    navTreePanel.setMinimumSize(new Dimension(200, 200));

    PanelBuilder btnPB = new PanelBuilder(new FormLayout("p,4px,p,4px,p,4px,p,4px,p,f:p:g", "p"));
    JButton addUserBtn = UIHelper.createIconBtn("add-person", IconManager.IconSize.NonStd,
            "SEC_ADDNEWUSERGRP_TT", null); // I18N
    JButton addExtUserBtn = UIHelper.createIconBtn("addext-person", IconManager.IconSize.NonStd,
            "SEC_ADDEXTUSERGRP_TT", null); // I18N
    JButton addToAdminBtn = UIHelper.createIconBtn("AdminGroup", IconManager.IconSize.Std24,
            "SEC_ADDADMUSERGRP_TT", null); // I18N
    JButton delUserBtn = UIHelper.createIconBtn("del-person", IconManager.IconSize.NonStd, "SEC_DELUSRGRP_TT",
            null);
    btnPB.add(addUserBtn, cc.xy(1, 1));
    btnPB.add(addExtUserBtn, cc.xy(3, 1));
    btnPB.add(addToAdminBtn, cc.xy(5, 1));
    btnPB.add(delUserBtn, cc.xy(7, 1));

    navTreeContextMgr.setBtn(addUserBtn, addExtUserBtn, addToAdminBtn, delUserBtn);

    // Other components that were added to the tree panel are now created here
    // It's better to include the scrollpane with the navigation JTree in a separate panel
    // to let it shrink correctly (bug 6409)

    //String helpStr = getResourceString("ADD_USER_HINT");
    //JLabel userDnDHelp = createLabel(helpStr);

    final PanelBuilder tbRightPB = new PanelBuilder(new FormLayout("f:p:g,p", "p"));
    mainPB.add(tbRightPB.getPanel(), cc.xy(1, 6));

    int y = 1;
    PanelBuilder lpb = new PanelBuilder(new FormLayout("p,10px,p:g", "p,2px,p,2px,p,2px,p,2px,p,2px"));
    lpb.addSeparator(getResourceString("SEC_LGND"), cc.xyw(1, y, 3));
    y += 2;

    Discipline discipline = AppContextMgr.getInstance().getClassObject(Discipline.class);
    String[] lbl = { "SEC_DSP", "SEC_COLL", "SEC_ADMINGRP", "SEC_PERSON" };
    String[] icn = { discipline.getType(), "Collection", "AdminGroup", "person" };
    for (int i = 0; i < lbl.length; i++) {
        lpb.add(createLabel("", IconManager.getIcon(icn[i], IconManager.STD_ICON_SIZE)), cc.xy(1, y));
        lpb.add(createI18NLabel(lbl[i]), cc.xy(3, y));
        y += 2;
    }

    mainPB.add(btnPB.getPanel(), cc.xy(1, 7));
    mainPB.add(lpb.getPanel(), cc.xy(1, 9));

    DocumentListener searchDL = new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            FilteredTreeModel model = (FilteredTreeModel) tree.getModel();
            Filter filter = (StringUtils.isNotEmpty(searchText.getText())) ? new Filter(searchText.getText())
                    : null;
            model.setFilter(filter);
        }
    };

    searchText = new JAutoCompTextField(isMacOS() ? 15 : 22);
    searchText.getDocument().addDocumentListener(searchDL);
    SearchBox searchBox = new SearchBox(searchText, null);

    final PanelBuilder toolbarPB = new PanelBuilder(new FormLayout("l:p,1dlu,p,1dlu,p,1dlu,p,15dlu,r:p", "p"));
    toolbarPB.add(searchBox, cc.xy(1, 1));

    mainPB.add(toolbarPB.getPanel(), cc.xy(1, 3));
    mainPB.add(navTreePanel, cc.xy(1, 5));

    return navigationPanel;
}

From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java

private final JPanel buildLeftPanel() throws ClassNotFoundException {
    JPanel panel = new JPanel(new BorderLayout());
    Dimension size = new Dimension(WINDOW_WIDTH / 4, (int) (WINDOW_HEIGHT * (2 / 3.0)));

    panel.setBorder(new TitledBorder("Programs"));
    panel.setSize(size);/*w  w w.  ja  va 2  s . c  om*/
    panel.setPreferredSize(size);
    panel.setMinimumSize(size);

    panel.add(new JScrollPane(programTree), BorderLayout.CENTER);

    return panel;
}

From source file:net.sf.firemox.DeckBuilder.java

/**
 * Creates new form DeckBuilder//ww  w  . j  a  v  a2 s  . c o m
 */
private DeckBuilder() {
    super("DeckBuilder");
    form = this;
    timerPanel = new TimerGlassPane();
    cardLoader = new CardLoader(timerPanel);
    timer = new Timer(200, cardLoader);
    setGlassPane(timerPanel);
    try {
        setIconImage(Picture.loadImage(IdConst.IMAGES_DIR + "deckbuilder.gif"));
    } catch (Exception e) {
        // IGNORING
    }

    // Load settings
    loadSettings();

    // Initialize components
    final JMenuItem newItem = UIHelper.buildMenu("menu_db_new", 'n', this);
    newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));

    final JMenuItem loadItem = UIHelper.buildMenu("menu_db_load", 'o', this);
    loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));

    final JMenuItem saveAsItem = UIHelper.buildMenu("menu_db_saveas", 'a', this);
    saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));

    final JMenuItem saveItem = UIHelper.buildMenu("menu_db_save", 's', this);
    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));

    final JMenuItem quitItem = UIHelper.buildMenu("menu_db_exit", this);
    quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK));

    final JMenuItem deckConstraintsItem = UIHelper.buildMenu("menu_db_constraints", 'c', this);
    deckConstraintsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));

    final JMenuItem aboutItem = UIHelper.buildMenu("menu_help_about", 'a', this);
    aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.SHIFT_MASK));

    final JMenuItem convertDCK = UIHelper.buildMenu("menu_convert_DCK_MP", this);

    final JMenu mainMenu = UIHelper.buildMenu("menu_file");
    mainMenu.add(newItem);
    mainMenu.add(loadItem);
    mainMenu.add(saveAsItem);
    mainMenu.add(saveItem);
    mainMenu.add(new JSeparator());
    mainMenu.add(quitItem);

    super.optionMenu = new JMenu("Options");

    final JMenu convertMenu = UIHelper.buildMenu("menu_convert");
    convertMenu.add(convertDCK);

    final JMenuItem helpItem = UIHelper.buildMenu("menu_help_help", 'h', this);
    helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));

    final JMenu helpMenu = new JMenu("?");
    helpMenu.add(helpItem);
    helpMenu.add(deckConstraintsItem);
    helpMenu.add(aboutItem);

    final JMenuBar menuBar = new JMenuBar();
    menuBar.add(mainMenu);
    initAbstractMenu();
    menuBar.add(optionMenu);
    menuBar.add(convertMenu);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
    addWindowListener(this);

    // Build the panel containing amount of available cards
    final JLabel amountLeft = new JLabel("<html>0/?", SwingConstants.RIGHT);

    // Build the left list
    allListModel = new MListModel<MCardCompare>(amountLeft, false);
    leftList = new ThreadSafeJList(allListModel);
    leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    leftList.setLayoutOrientation(JList.VERTICAL);
    leftList.getSelectionModel().addListSelectionListener(this);
    leftList.addMouseListener(this);
    leftList.setVisibleRowCount(10);

    // Initialize the text field containing the amount to add
    addQtyTxt = new JTextField("1");

    // Build the "Add" button
    addButton = new JButton(LanguageManager.getString("db_add"));
    addButton.setMnemonic('a');
    addButton.setEnabled(false);

    // Build the panel containing : "Add" amount and "Add" button
    final Box addPanel = Box.createHorizontalBox();
    addPanel.add(addButton);
    addPanel.add(addQtyTxt);
    addPanel.setMaximumSize(new Dimension(32010, 26));

    // Build the panel containing the selected card name
    cardNameTxt = new JTextField();
    new HireListener(cardNameTxt, addButton, this, leftList);

    final JLabel searchLabel = new JLabel(LanguageManager.getString("db_search") + " : ");
    searchLabel.setLabelFor(cardNameTxt);

    // Build the panel containing search label and card name text field
    final Box searchPanel = Box.createHorizontalBox();
    searchPanel.add(searchLabel);
    searchPanel.add(cardNameTxt);
    searchPanel.setMaximumSize(new Dimension(32010, 26));

    listScrollerLeft = new JScrollPane(leftList);
    MToolKit.addOverlay(listScrollerLeft);

    // Build the left panel containing : list, available amount, "Add" panel
    final JPanel srcPanel = new JPanel(null);
    srcPanel.add(searchPanel);
    srcPanel.add(listScrollerLeft);
    srcPanel.add(amountLeft);
    srcPanel.add(addPanel);
    srcPanel.setMinimumSize(new Dimension(220, 200));
    srcPanel.setLayout(new BoxLayout(srcPanel, BoxLayout.Y_AXIS));

    // Initialize constraints
    constraintsChecker = new ConstraintsChecker();
    constraintsChecker.setBorder(new EtchedBorder());
    final JScrollPane constraintsCheckerScroll = new JScrollPane(constraintsChecker);
    MToolKit.addOverlay(constraintsCheckerScroll);

    // create a pane with the oracle text for the present card
    oracleText = new JLabel();
    oracleText.setPreferredSize(new Dimension(180, 200));
    oracleText.setVerticalAlignment(SwingConstants.TOP);

    final JScrollPane oracle = new JScrollPane(oracleText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    MToolKit.addOverlay(oracle);

    // build some Pie Charts and a panel to display it
    initSets();
    datasets = new ChartSets();
    final JTabbedPane tabbedPane = new JTabbedPane();
    for (ChartFilter filter : ChartFilter.values()) {
        final Dataset dataSet = filter.createDataSet(this);
        final JFreeChart chart = new JFreeChart(null, null,
                filter.createPlot(dataSet, painterMapper.get(filter)), false);
        datasets.addDataSet(filter, dataSet);
        ChartPanel pieChartPanel = new ChartPanel(chart, true);
        tabbedPane.add(pieChartPanel, filter.getTitle());
    }
    // add the Constraints scroll panel and Oracle text Pane to the tabbedPane
    tabbedPane.add(constraintsCheckerScroll, LanguageManager.getString("db_constraints"));
    tabbedPane.add(oracle, LanguageManager.getString("db_text"));
    tabbedPane.setSelectedComponent(oracle);

    // The toollBar for color filtering
    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    final JButton clearButton = UIHelper.buildButton("clear");
    clearButton.addActionListener(this);
    toolBar.add(clearButton);
    final JToggleButton toggleColorlessButton = new JToggleButton(
            UIHelper.getTbsIcon("mana/colorless/small/" + MdbLoader.unknownSmlMana), true);
    toggleColorlessButton.setActionCommand("0");
    toggleColorlessButton.addActionListener(this);
    toolBar.add(toggleColorlessButton);
    for (int index = 1; index < IdCardColors.CARD_COLOR_NAMES.length; index++) {
        final JToggleButton toggleButton = new JToggleButton(
                UIHelper.getTbsIcon("mana/colored/small/" + MdbLoader.coloredSmlManas[index]), true);
        toggleButton.setActionCommand(String.valueOf(index));
        toggleButton.addActionListener(this);
        toolBar.add(toggleButton);
    }

    // sorted card type combobox creation
    final List<String> idCards = new ArrayList<String>(Arrays.asList(CardFactory.exportedIdCardNames));
    Collections.sort(idCards);
    final Object[] cardTypes = ArrayUtils.addAll(new String[] { LanguageManager.getString("db_types.any") },
            idCards.toArray());
    idCardComboBox = new JComboBox(cardTypes);
    idCardComboBox.setSelectedIndex(0);
    idCardComboBox.addActionListener(this);
    idCardComboBox.setActionCommand("cardTypeFilter");

    // sorted card properties combobox creation
    final List<String> properties = new ArrayList<String>(
            CardFactory.getPropertiesName(DeckConstraints.getMinProperty(), DeckConstraints.getMaxProperty()));
    Collections.sort(properties);
    final Object[] cardProperties = ArrayUtils
            .addAll(new String[] { LanguageManager.getString("db_properties.any") }, properties.toArray());
    propertiesComboBox = new JComboBox(cardProperties);
    propertiesComboBox.setSelectedIndex(0);
    propertiesComboBox.addActionListener(this);
    propertiesComboBox.setActionCommand("propertyFilter");

    final JLabel colors = new JLabel(" " + LanguageManager.getString("colors") + " : ");
    final JLabel types = new JLabel(" " + LanguageManager.getString("types") + " : ");
    final JLabel property = new JLabel(" " + LanguageManager.getString("properties") + " : ");

    // filter Panel with colors toolBar and card type combobox
    final Box filterPanel = Box.createHorizontalBox();
    filterPanel.add(colors);
    filterPanel.add(toolBar);
    filterPanel.add(types);
    filterPanel.add(idCardComboBox);
    filterPanel.add(property);
    filterPanel.add(propertiesComboBox);

    getContentPane().add(filterPanel, BorderLayout.NORTH);

    // Destination section :

    // Build the panel containing amount of available cards
    final JLabel rightAmount = new JLabel("0/?", SwingConstants.RIGHT);
    rightAmount.setMaximumSize(new Dimension(220, 26));

    // Build the right list
    rightListModel = new MCardTableModel(new MListModel<MCardCompare>(rightAmount, true));
    rightListModel.addTableModelListener(this);
    rightList = new JTable(rightListModel);
    rightList.setShowGrid(false);
    rightList.setTableHeader(null);
    rightList.getSelectionModel().addListSelectionListener(this);
    rightList.getColumnModel().getColumn(0).setMaxWidth(25);
    rightList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

    // Build the panel containing the selected deck
    deckNameTxt = new JTextField("loading...");
    deckNameTxt.setEditable(false);
    deckNameTxt.setBorder(null);
    final JLabel deckLabel = new JLabel(LanguageManager.getString("db_deck") + " : ");
    deckLabel.setLabelFor(deckNameTxt);
    final Box deckNamePanel = Box.createHorizontalBox();
    deckNamePanel.add(deckLabel);
    deckNamePanel.add(deckNameTxt);
    deckNamePanel.setMaximumSize(new Dimension(220, 26));

    // Initialize the text field containing the amount to remove
    removeQtyTxt = new JTextField("1");

    // Build the "Remove" button
    removeButton = new JButton(LanguageManager.getString("db_remove"));
    removeButton.setMnemonic('r');
    removeButton.addMouseListener(this);
    removeButton.setEnabled(false);

    // Build the panel containing : "Remove" amount and "Remove" button
    final Box removePanel = Box.createHorizontalBox();
    removePanel.add(removeButton);
    removePanel.add(removeQtyTxt);
    removePanel.setMaximumSize(new Dimension(220, 26));

    // Build the right panel containing : list, available amount, constraints
    final JScrollPane deskListScroller = new JScrollPane(rightList);
    MToolKit.addOverlay(deskListScroller);
    deskListScroller.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    deskListScroller.setMinimumSize(new Dimension(220, 200));
    deskListScroller.setMaximumSize(new Dimension(220, 32000));

    final Box destPanel = Box.createVerticalBox();
    destPanel.add(deckNamePanel);
    destPanel.add(deskListScroller);
    destPanel.add(rightAmount);
    destPanel.add(removePanel);
    destPanel.setMinimumSize(new Dimension(220, 200));
    destPanel.setMaximumSize(new Dimension(220, 32000));

    // Build the panel containing the name of card in picture
    cardPictureNameTxt = new JLabel("<html><i>no selected card</i>");
    final Box cardPictureNamePanel = Box.createHorizontalBox();
    cardPictureNamePanel.add(cardPictureNameTxt);
    cardPictureNamePanel.setMaximumSize(new Dimension(32010, 26));

    // Group the detail panels
    final JPanel viewCard = new JPanel(null);
    viewCard.add(cardPictureNamePanel);
    viewCard.add(CardView.getInstance());
    viewCard.add(tabbedPane);
    viewCard.setLayout(new BoxLayout(viewCard, BoxLayout.Y_AXIS));

    final Box mainPanel = Box.createHorizontalBox();
    mainPanel.add(destPanel);
    mainPanel.add(viewCard);

    // Add the main panel
    getContentPane().add(srcPanel, BorderLayout.WEST);
    getContentPane().add(mainPanel, BorderLayout.CENTER);

    // Size this frame
    getRootPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));
    getRootPane().setMinimumSize(getRootPane().getPreferredSize());
    pack();
}

From source file:electroStaticUI.UserInput.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private void getChargeData() {
    numberOfCharges = Integer.parseInt(getNumberOfCharges.getText());
    DefaultValues.allocatePointChargeArray(numberOfCharges);
    chargesToCalc = new PointCharge[numberOfCharges];
    mapper = new CustomMapper(DefaultValues.getCircOrRect());
    chargeDataFrame = new JFrame();
    chargeDataFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JPanel chargeDataPanel = new JPanel();
    chargeDataFrame.setTitle("Data For Charge #: " + (1 + okButtonPushes));
    JLabel chargeLabel = new JLabel("Charge");
    JLabel chargeUnitLabel = new JLabel("C");
    charge = new JTextField(10);
    charge.setEditable(true);/*from w  w  w. j ava2s  .  c  o m*/
    chargeModComboBox = new JComboBox(chargeModList);
    chargeModComboBox.setSelectedIndex(5);
    chargeModComboBox.setVisible(true);
    JLabel xPositionLabel = new JLabel("X Value");
    xPosition = new JTextField(10);
    xPosition.setEditable(true);
    JLabel yPositionLabel = new JLabel("Y Value");
    yPosition = new JTextField(10);
    yPosition.setEditable(true);
    //JLabel zPositionLabel = new JLabel("Z Value");
    //JTextField zPosition = new JTextField(5);
    //zPosition.setEditable(true);
    JButton okButton = new JButton("OK");
    chargeDataPanel.add(chargeLabel);
    chargeDataPanel.add(charge);
    chargeDataPanel.add(chargeModComboBox);
    chargeDataPanel.add(chargeUnitLabel);
    chargeDataPanel.add(xPositionLabel);
    chargeDataPanel.add(xPosition);
    chargeDataPanel.add(yPositionLabel);
    chargeDataPanel.add(yPosition);
    chargeDataPanel.add(okButton);
    chargeDataPanel.setMinimumSize(new Dimension(600, 100));
    chargeDataPanel.setVisible(true);
    chargeDataFrame.add(chargeDataPanel);
    chargeDataFrame.setVisible(true);
    chargeDataFrame.setMinimumSize(new Dimension(600, 100));
    xPosition.setText("0");
    yPosition.setText("0");
    charge.setText("0");
    /*
     * okButton anonymous action listener takes the data entered into the JTextfields and creates point charges from it.
     */
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //do {
            //chargesToCalc[okButtonPushes] = new PointCharge(Double.parseDouble(charge.getText()), Double.parseDouble(xPosition.getText()), Double.parseDouble(yPosition.getText()));
            int chargeModIndex = chargeModComboBox.getSelectedIndex();
            DefaultValues.setChargeModIndex(chargeModIndex);
            chargeValue = Double.parseDouble(charge.getText());
            xValue = Double.parseDouble(xPosition.getText());
            yValue = Double.parseDouble(yPosition.getText());
            chargesToCalc[okButtonPushes] = new PointCharge(chargeValue, xValue, yValue);
            charge.setText("0");
            xPosition.setText("0");
            yPosition.setText("0");
            okButtonPushes++;
            chargeDataFrame.setTitle("Data For Charge #: " + (1 + okButtonPushes));
            if (okButtonPushes == numberOfCharges) {
                confirm = JOptionPane.showConfirmDialog(null,
                        "You have entered " + okButtonPushes
                                + " charges. Press OK to confirm. \nPress Cancel to re-enter the charges",
                        null, JOptionPane.OK_CANCEL_OPTION);
                if (confirm == JOptionPane.OK_OPTION) {
                    DefaultValues.setCurrentPointCharges(chargesToCalc);
                    ElectroStaticUIContainer.removeGraphFromdisplayPanel();
                    theCalculator = new CalculatorPanel();
                    calcVec = new VectorCalculator(mapper);
                    volts = new VoltageAtPoint(mapper.getFieldPoints());
                    manGraph = new ManualPolygons(mapper);
                    chart = manGraph.delaunayBuild();
                    drawVecs = new DrawElectricFieldLines(mapper);
                    ElectroStaticUIContainer.add3DGraphToDisplayPanel(chart);
                    ElectroStaticUIContainer.addVectorGraphToDisplayPanel(drawVecs.getChart());
                    setVectorChartToSave();
                    setChart3dToSave();
                    rotateIt = new ChartMouseController(chart);
                    okButtonPushes = 0;
                    chargeDataFrame.removeAll();
                    chargeDataFrame.dispose();
                } else if (confirm == JOptionPane.CANCEL_OPTION)
                    okButtonPushes = 0;
            }

        }
        //while(okButtonPushes < numberOfCharges);

        //}
    });
}