Example usage for javax.swing JCheckBox addActionListener

List of usage examples for javax.swing JCheckBox addActionListener

Introduction

In this page you can find the example usage for javax.swing JCheckBox addActionListener.

Prototype

public void addActionListener(ActionListener l) 

Source Link

Document

Adds an ActionListener to the button.

Usage

From source file:com.diversityarrays.kdxplore.boxplot.BoxPlotPanel.java

private Box generateControls() {

    for (JCheckBox jcb : Arrays.asList(showOutliers, showMean, showMedian)) {
        ActionListener optionsActionListener = new ActionListener() {
            @Override/*from w  w w .j a va2 s . c  o  m*/
            public void actionPerformed(ActionEvent e) {
                generateGraph(Why.OPTION_CHANGED);
                setSpinnerRanges();
            }
        };
        jcb.addActionListener(optionsActionListener);
        jcb.setSelected(true);
    }

    JLabel infoLabel = new JLabel(Msg.LABEL_SHOW_PARAMETERS());
    infoLabel.setBorder(new EmptyBorder(3, 3, 3, 3));

    Box hbox = Box.createHorizontalBox();
    hbox.add(syncedOption);
    hbox.add(minSpinner);
    hbox.add(new JLabel(" - ")); //$NON-NLS-1$
    hbox.add(maxSpinner);
    hbox.add(infoLabel);
    hbox.add(showOutliers);
    hbox.add(showMean);
    hbox.add(showMedian);

    return hbox;
}

From source file:be.agiv.security.demo.Main.java

private void invokeClaimsAwareService() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    JPanel contentPanel = new JPanel(gridBagLayout);

    final JLabel ipStsLabel = new JLabel("IP-STS:");
    gridBagConstraints.gridx = 0;/*from w  ww .j av a2  s .co  m*/
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.WEST;
    gridBagConstraints.ipadx = 5;
    gridBagLayout.setConstraints(ipStsLabel, gridBagConstraints);
    contentPanel.add(ipStsLabel);

    final JTextField ipStsTextField = new JTextField(
            "https://auth.beta.agiv.be/ipsts/Services/DaliSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(ipStsTextField, gridBagConstraints);
    contentPanel.add(ipStsTextField);

    JLabel realmLabel = new JLabel("Realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(realmLabel, gridBagConstraints);
    contentPanel.add(realmLabel);

    JTextField realmTextField = new JTextField(AGIVSecurity.BETA_REALM, 30);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(realmTextField, gridBagConstraints);
    contentPanel.add(realmTextField);

    final CredentialPanel credentialPanel = new CredentialPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(credentialPanel, gridBagConstraints);
    contentPanel.add(credentialPanel);

    final JLabel rStsLabel = new JLabel("R-STS:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 1;
    gridBagLayout.setConstraints(rStsLabel, gridBagConstraints);
    contentPanel.add(rStsLabel);

    final JTextField rStsTextField = new JTextField(
            "https://auth.beta.agiv.be/sts/Services/SalvadorSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(rStsTextField, gridBagConstraints);
    contentPanel.add(rStsTextField);

    JLabel serviceRealmLabel = new JLabel("Service realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(serviceRealmLabel, gridBagConstraints);
    contentPanel.add(serviceRealmLabel);

    JTextField serviceRealmTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_REALM, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(serviceRealmTextField, gridBagConstraints);
    contentPanel.add(serviceRealmTextField);

    JLabel urlLabel = new JLabel("Service URL:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(urlLabel, gridBagConstraints);
    contentPanel.add(urlLabel);

    JTextField urlTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_LOCATION, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(urlTextField, gridBagConstraints);
    contentPanel.add(urlTextField);

    final JCheckBox noWsPolicyCheckBox = new JCheckBox("WSDL without WS-Policy");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(noWsPolicyCheckBox, gridBagConstraints);
    contentPanel.add(noWsPolicyCheckBox);

    final JCheckBox useWsSecureConversationCheckBox = new JCheckBox("Use WS-SecureConversation");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(useWsSecureConversationCheckBox, gridBagConstraints);
    contentPanel.add(useWsSecureConversationCheckBox);

    final JCheckBox usePreviousSecurityCheckBox = new JCheckBox("Use previous AGIV Security");
    final JCheckBox cancelPreviousSecureConversationToken = new JCheckBox("Cancel previous conversation token");
    usePreviousSecurityCheckBox.setEnabled(null != this.agivSecurity);
    cancelPreviousSecureConversationToken.setEnabled(false);
    usePreviousSecurityCheckBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            LOG.debug("use previous security: " + usePreviousSecurityCheckBox.isSelected());
            boolean newSecurity = !usePreviousSecurityCheckBox.isSelected();
            ipStsLabel.setEnabled(newSecurity);
            ipStsTextField.setEditable(newSecurity);
            credentialPanel.setEnabled(newSecurity);
            rStsLabel.setEnabled(newSecurity);
            rStsTextField.setEnabled(newSecurity);
            cancelPreviousSecureConversationToken.setEnabled(!newSecurity);
        }
    });
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(usePreviousSecurityCheckBox, gridBagConstraints);
    contentPanel.add(usePreviousSecurityCheckBox);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(cancelPreviousSecureConversationToken, gridBagConstraints);
    contentPanel.add(cancelPreviousSecureConversationToken);

    JPanel expiresPanel = new JPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 2;
    gridBagLayout.setConstraints(expiresPanel, gridBagConstraints);
    contentPanel.add(expiresPanel);

    JLabel expiresLabelLabel = new JLabel("Secure conversation token expires:");
    expiresLabelLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabelLabel);

    JLabel expiresLabel = new JLabel();
    expiresLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabel);
    if (null != this.agivSecurity) {
        if (false == this.agivSecurity.getSecureConversationTokens().isEmpty()) {
            SecurityToken secureConversationToken = this.agivSecurity.getSecureConversationTokens().values()
                    .iterator().next();
            expiresLabel.setText(secureConversationToken.getExpires().toString());
        }
    }

    int dialogResult = JOptionPane.showConfirmDialog(this, contentPanel, "Claims Aware Service",
            JOptionPane.OK_CANCEL_OPTION);
    if (dialogResult == JOptionPane.CANCEL_OPTION) {
        return;
    }

    final String location = urlTextField.getText();
    final String serviceRealm = serviceRealmTextField.getText();
    final String ipStsLocation = ipStsTextField.getText();
    final String rStsLocation = rStsTextField.getText();
    final String username = credentialPanel.getUsername();
    final String password = credentialPanel.getPassword();
    final File pkcs12File = credentialPanel.getPKCS12File();
    final String realm = realmTextField.getText();

    ExecutorService executor = Executors.newFixedThreadPool(1);
    FutureTask<ArrayOfClaimInfo> futureTask = new FutureTask<ArrayOfClaimInfo>(
            new Callable<ArrayOfClaimInfo>() {

                public ArrayOfClaimInfo call() throws Exception {
                    Service service;
                    if (noWsPolicyCheckBox.isSelected()) {
                        service = ClaimsAwareServiceFactory.getInstanceNoWSPolicy();
                    } else {
                        service = ClaimsAwareServiceFactory.getInstance();
                    }
                    IService iservice = service.getWS2007FederationHttpBindingIService(new AddressingFeature());
                    BindingProvider bindingProvider = (BindingProvider) iservice;

                    if (false == usePreviousSecurityCheckBox.isSelected()) {
                        if (null != username) {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    username, password);
                        } else {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    pkcs12File, password);
                        }
                        Main.this.agivSecurity.addSTSListener(Main.this);
                        if (Main.this.proxyEnable) {
                            agivSecurity.setProxy(Main.this.proxyHost, Main.this.proxyPort,
                                    Main.this.proxyType);
                        }
                    }
                    if (cancelPreviousSecureConversationToken.isSelected()) {
                        Main.this.agivSecurity.cancelSecureConversationTokens();
                    }
                    Main.this.agivSecurity.enable(bindingProvider, location,
                            useWsSecureConversationCheckBox.isSelected(), serviceRealm);

                    ArrayOfClaimInfo result = iservice.getData(0);
                    return result;
                }
            }) {

        @Override
        protected void done() {
            try {
                ArrayOfClaimInfo result = get();
                List<ClaimInfo> claims = result.getClaimInfo();
                StringBuffer message = new StringBuffer();
                for (ClaimInfo claim : claims) {
                    message.append(claim.getName());
                    message.append(" = ");
                    message.append(claim.getValue());
                    message.append("\n");
                }

                JOptionPane.showMessageDialog(Main.this, message.toString(), "Claims Aware Service Result",
                        JOptionPane.INFORMATION_MESSAGE);
            } catch (final Exception e) {
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {

                        public void run() {
                            Main.this.statusBar.setErrorStatus(e.getMessage());
                        }
                    });
                } catch (Exception e1) {
                }
                showException(e);
            }
        }
    };
    executor.execute(futureTask);
}

From source file:EnvironmentExplorer.java

Box lightPanel() {
    Box panel = new Box(BoxLayout.Y_AXIS);

    // add the ambient light checkbox to the panel
    JCheckBox ambientCheckBox = new JCheckBox("Ambient Light");
    ambientCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkbox = (JCheckBox) e.getSource();
            lightAmbient.setEnable(checkbox.isSelected());
        }//from www .j av a2 s . co m
    });
    ambientCheckBox.setSelected(true);
    panel.add(new LeftAlignComponent(ambientCheckBox));

    String[] lightTypeValues = { "None", "Directional", "Positional", "Spot" };
    IntChooser lightTypeChooser = new IntChooser("Light Type:", lightTypeValues);
    lightTypeChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            switch (value) {
            case 0:
                lightDirectional.setEnable(false);
                lightPoint.setEnable(false);
                lightSpot.setEnable(false);
                break;
            case 1:
                lightDirectional.setEnable(true);
                lightPoint.setEnable(false);
                lightSpot.setEnable(false);
                break;
            case 2:
                lightDirectional.setEnable(false);
                lightPoint.setEnable(true);
                lightSpot.setEnable(false);
                break;
            case 3:
                lightDirectional.setEnable(false);
                lightPoint.setEnable(false);
                lightSpot.setEnable(true);
                break;
            }
        }
    });
    lightTypeChooser.setValueByName("Directional");
    panel.add(lightTypeChooser);

    // Set up the sliders for the attenuation

    // top row
    panel.add(new LeftAlignComponent(new JLabel("Light attenuation:")));

    FloatLabelJSlider constantSlider = new FloatLabelJSlider("Constant ", 0.1f, 0.0f, 3.0f, attenuation.x);
    constantSlider.setMajorTickSpacing(1.0f);
    constantSlider.setPaintTicks(true);
    constantSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            attenuation.x = e.getValue();
            lightPoint.setAttenuation(attenuation);
            lightSpot.setAttenuation(attenuation);
        }
    });
    panel.add(constantSlider);

    FloatLabelJSlider linearSlider = new FloatLabelJSlider("Linear   ", 0.1f, 0.0f, 3.0f, attenuation.y);
    linearSlider.setMajorTickSpacing(1.0f);
    linearSlider.setPaintTicks(true);
    linearSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            attenuation.y = e.getValue();
            lightPoint.setAttenuation(attenuation);
            lightSpot.setAttenuation(attenuation);
        }
    });
    panel.add(linearSlider);

    FloatLabelJSlider quadradicSlider = new FloatLabelJSlider("Quadradic", 0.1f, 0.0f, 3.0f, attenuation.z);
    quadradicSlider.setMajorTickSpacing(1.0f);
    quadradicSlider.setPaintTicks(true);
    quadradicSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            attenuation.z = e.getValue();
            lightPoint.setAttenuation(attenuation);
            lightSpot.setAttenuation(attenuation);
        }
    });
    panel.add(quadradicSlider);

    // Set up the sliders for the attenuation
    // top row
    panel.add(new LeftAlignComponent(new JLabel("Spot light:")));

    // spread angle is 0-180 degrees, no slider scaling
    FloatLabelJSlider spotSpreadSlider = new FloatLabelJSlider("Spread Angle ", 1.0f, 0.0f, 180.0f,
            spotSpreadAngle);
    spotSpreadSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            spotSpreadAngle = e.getValue();
            lightSpot.setSpreadAngle((float) Math.toRadians(spotSpreadAngle));
        }
    });
    panel.add(spotSpreadSlider);

    // concentration angle is 0-128 degrees
    FloatLabelJSlider spotConcentrationSlider = new FloatLabelJSlider("Concentration", 1.0f, 0.0f, 128.0f,
            spotConcentration);
    spotConcentrationSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            spotConcentration = e.getValue();
            lightSpot.setConcentration(spotConcentration);
        }
    });
    panel.add(spotConcentrationSlider);

    return panel;
}

From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java

/**
 * Setup the General Tab Pane/* w  ww  . j  a va  2 s  .c om*/
 * 
 * @return JPanel for pane
 */
private JPanel setupGeneralTab() {

    JPanel generalTab = new JPanel();
    generalTab.setLayout(new BorderLayout());

    /* -- Create Main Panels -- */

    JPanel centerPanel = new JPanel();
    JPanel northPanel = new JPanel();
    JPanel southPanel = new JPanel();

    generalTab.add(centerPanel, BorderLayout.CENTER);
    generalTab.add(northPanel, BorderLayout.NORTH);

    /* -- Create Center Contents -- */

    // Statistics Panel
    JPanel statsPanel = setupStatsPanel();

    // Log Panel
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new BorderLayout());
    logPanel.setBorder(BorderFactory.createTitledBorder("Log Output"));
    JTextPane logTextPane = new JTextPane();
    logTextPane.setEditable(false);
    logTextPane.setBackground(Color.BLACK);
    logTextPane.setForeground(Color.WHITE);

    logPanel.add(new JScrollPane(logTextPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
    addUIElement("general.log", logTextPane); // Add to component map

    JPanel logOptionsPanel = new JPanel();
    logPanel.add(logOptionsPanel, BorderLayout.SOUTH);
    logOptionsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    final JCheckBox logScrollCheckbox = new JCheckBox("Auto-Scroll Log");
    logScrollCheckbox.setSelected(true);
    logScrollCheckbox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JTextPaneAppender.setAutoScroll(logScrollCheckbox.isSelected());
        }

    });
    logOptionsPanel.add(logScrollCheckbox);

    // Enable Logging
    JTextPaneAppender.setTextPane(logTextPane);

    centerPanel.setLayout(new BorderLayout(10, 10));
    centerPanel.add(statsPanel, BorderLayout.NORTH);
    centerPanel.add(logPanel, BorderLayout.CENTER);

    /* -- Create Buttons (South) -- */

    generalTab.add(southPanel, BorderLayout.SOUTH);

    final JButton shutdownButton = new JButton("Shutdown");
    shutdownButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doShutdownCluster();
        }
    });

    southPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 10));
    southPanel.add(shutdownButton);
    addUIElement("general.shutdown", shutdownButton); // Add to components map

    return generalTab;
}

From source file:lu.lippmann.cdb.datasetview.tabs.ScatterPlotTabView.java

private void update0(final Instances dataSet, int xidx, int yidx, int coloridx, final boolean asSerie) {
    System.out.println(xidx + " " + yidx);

    this.panel.removeAll();

    if (xidx == -1)
        xidx = 0;/*from ww w. j av a2  s.com*/
    if (yidx == -1)
        yidx = 1;
    if (coloridx == -1)
        coloridx = 0;

    final Object[] numericAttrNames = WekaDataStatsUtil.getNumericAttributesNames(dataSet).toArray();

    final JComboBox xCombo = new JComboBox(numericAttrNames);
    xCombo.setBorder(new TitledBorder("x"));
    xCombo.setSelectedIndex(xidx);
    final JComboBox yCombo = new JComboBox(numericAttrNames);
    yCombo.setBorder(new TitledBorder("y"));
    yCombo.setSelectedIndex(yidx);
    final JCheckBox jcb = new JCheckBox("Draw lines");
    jcb.setSelected(asSerie);
    final JComboBox colorCombo = new JComboBox(numericAttrNames);
    colorCombo.setBorder(new TitledBorder("color"));
    colorCombo.setSelectedIndex(coloridx);
    colorCombo.setVisible(dataSet.classIndex() < 0);

    xCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(),
                    colorCombo.getSelectedIndex(), jcb.isSelected());
        }
    });

    yCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(),
                    colorCombo.getSelectedIndex(), jcb.isSelected());
        }
    });

    colorCombo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(),
                    colorCombo.getSelectedIndex(), jcb.isSelected());
        }
    });

    jcb.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            update0(dataSet, xCombo.getSelectedIndex(), yCombo.getSelectedIndex(),
                    colorCombo.getSelectedIndex(), jcb.isSelected());
        }
    });

    final JXPanel comboPanel = new JXPanel();
    comboPanel.setLayout(new GridLayout(1, 0));
    comboPanel.add(xCombo);
    comboPanel.add(yCombo);
    comboPanel.add(colorCombo);
    comboPanel.add(jcb);
    this.panel.add(comboPanel, BorderLayout.NORTH);

    final java.util.List<Integer> numericAttrIdx = WekaDataStatsUtil.getNumericAttributesIndexes(dataSet);
    final ChartPanel scatterplotChartPanel = buildChartPanel(dataSet, numericAttrIdx.get(xidx),
            numericAttrIdx.get(yidx), numericAttrIdx.get(coloridx), asSerie);

    this.panel.add(scatterplotChartPanel, BorderLayout.CENTER);

    this.panel.repaint();
    this.panel.updateUI();
}

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

protected void changeMaxFileSize() {
    final JPanel panel = new JPanel();
    boolean keineLimitierung = iliasProperties.getMaxFileSize() == Long.MAX_VALUE;

    panel.setLayout(new GridLayout(1, 0));

    panel.add(new JLabel("Maximale Dateigre in MB"));

    final JCheckBox cb = new JCheckBox("Keine Limitierung");
    cb.setSelected(keineLimitierung);/*from  w  w w .j  a  va  2  s .co m*/
    panel.add(cb);

    final JTextField fieldFileSize = new JTextField(
            String.valueOf(iliasProperties.getMaxFileSize() / (1024 * 1024)));
    panel.add(fieldFileSize);

    fieldFileSize.setVisible(!cb.isSelected());

    cb.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            fieldFileSize.setVisible(!cb.isSelected());

        }
    });

    if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainFrame, panel,
            "Maximale Dateigre ndern", JOptionPane.OK_CANCEL_OPTION)) {

        if (cb.isSelected()) {
            iliasProperties.setMaxFileSize(Long.MAX_VALUE);
        } else {
            iliasProperties.setMaxFileSize(Long.parseLong(fieldFileSize.getText()) * 1024 * 1024);
        }
        saveProperties(iliasProperties);
    }

}

From source file:gtu._work.ui.DirectoryCompareUI.java

private void addDiffMergeChkBox() {
    diffMergeChkBox = new JCheckBox[DiffMergeStatus.values().length];
    int ii = 0;/*  w  w w .j  a  v a 2 s.  c  o  m*/
    for (DiffMergeStatus dif : DiffMergeStatus.values()) {
        diffMergeChkBox[ii] = new JCheckBox();
        JCheckBox tempChk = diffMergeChkBox[ii];
        ii++;

        tempChk.setText(dif.toString());
        tempChk.setSelected(true);
        jPanel3.add(tempChk);
        tempChk.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                totalScanFiles(null);
            }
        });
    }
}

From source file:com.diversityarrays.kdxplore.curate.fieldview.InterceptFieldLayoutView.java

public void openFieldLayoutView(Component trigger, String title,
        @SuppressWarnings("rawtypes") MutableComboBoxModel comboBoxModel, CurationData curationData,
        CurationTableModel curationTableModel, SelectedValueStore selectedValueStore,
        PlotCellChoicesPanel plotCellChoicesPanel, JPopupMenu popuMenu, Font smallFont,
        Action curationHelpAction, MessagePrinter messages, Closure<String> selectionClosure,
        CurationContext curationContext, CurationMenuProvider curationMenuProvider,

        FieldLayoutTableModel fieldLayoutTableModel, CellSelectableTable fieldLayoutTable,
        FieldViewSelectionModel fieldViewSelectionModel,

        JButton undockButton) {/*from  w ww.j  a  va2  s  .co  m*/
    if (fieldLayoutFrame != null) {
        fieldLayoutFrame.toFront();
        return;
    }

    JCheckBox alwaysOnTopOption = new JCheckBox(Msg.OPTION_KEEP_ON_TOP(), true);

    viewPanel = new FieldLayoutViewPanel(comboBoxModel, alwaysOnTopOption, curationData, curationTableModel,
            selectedValueStore, plotCellChoicesPanel, popuMenu, smallFont, curationHelpAction, messages,
            selectionClosure, curationContext, curationMenuProvider,

            fieldLayoutTableModel, fieldLayoutTable, fieldViewSelectionModel,

            undockButton);

    viewPanel.addRefreshListener(refreshListener);

    viewPanel.addTraitInstanceSelectionListener(itemListener);
    viewPanel.addCellSelectionListener(cellSelectionListener);

    fieldLayoutFrame = new JFrame(title);
    fieldLayoutFrame.setAlwaysOnTop(alwaysOnTopOption.isSelected());
    fieldLayoutFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    fieldLayoutFrame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            viewPanel.doPostOpenActions();
        }

        @Override
        public void windowClosed(WindowEvent e) {
            try {
                viewPanel.removeCellSelectionListener(cellSelectionListener);
            } finally {
                fieldLayoutFrame.removeWindowListener(this);
                fieldLayoutFrame = null;
            }
        }
    });
    fieldLayoutFrame.setContentPane(viewPanel);
    fieldLayoutFrame.pack();
    fieldLayoutFrame.setLocationRelativeTo(trigger);
    fieldLayoutFrame.setVisible(true);
    fieldLayoutFrame.toFront();

    alwaysOnTopOption.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            fieldLayoutFrame.setAlwaysOnTop(alwaysOnTopOption.isSelected());
        }
    });
}

From source file:it.iit.genomics.cru.igb.bundles.mi.view.MIResultPanel.java

public MIResultPanel(IgbService service, String summary, List<MIResult> results, String label, MIQuery query) {
    setLayout(new BorderLayout());

    this.label = label;

    igbLogger = IGBLogger.getInstance(label);

    colorer = TaxonColorer.getColorer(query.getTaxid());

    Box menuBox = new Box(BoxLayout.X_AXIS);

    Box buttonBox = new Box(BoxLayout.Y_AXIS);
    Box buttonBox1 = new Box(BoxLayout.X_AXIS);

    Box buttonBox3 = new Box(BoxLayout.X_AXIS);
    buttonBox.add(buttonBox1);/*from   ww w.  j a v  a 2 s.  c o  m*/

    buttonBox.add(buttonBox3);

    JTextPane querySummary = new JTextPane();
    querySummary.setContentType("text/html");
    querySummary.setEditable(false);
    querySummary.setText(summary);

    menuBox.add(querySummary);

    menuBox.add(buttonBox);

    final JFrame logFrame = new JFrame("MI Bundle Log");
    logFrame.setVisible(false);
    Dimension preferredSize = new Dimension(800, 500);

    logFrame.setPreferredSize(preferredSize);
    logFrame.setMinimumSize(preferredSize);

    logFrame.add(new LogPanel(igbLogger));

    JButton log = new JButton();

    if (igbLogger.hasError()) {
        log.setBackground(Color.red);
    }

    log.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/console.png"));

    log.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            logFrame.setVisible(true);
        }

    });

    buttonBox1.add(log);

    JButton networkButton = new JButton("");
    networkButton.setIcon(new ImageIcon(getClass().getResource("/network.jpg")));
    networkButton.addActionListener(new DisplayNetworkActionListener());

    buttonBox1.add(networkButton);

    buttonBox1.add(new JSeparator(JSeparator.VERTICAL));

    buttonBox1.add(new JLabel("Save: "));
    JButton exportButton = new JButton("text");
    exportButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png"));
    exportButton.addActionListener(new ExportActionListener());

    if (false == MICommons.testVersion) {
        buttonBox1.add(exportButton);
    }

    JButton exportXgmmlButton = new JButton("xgmml");
    exportXgmmlButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png"));
    exportXgmmlButton.addActionListener(new ExportXgmmlActionListener());
    if (false == MICommons.testVersion) {
        buttonBox1.add(exportXgmmlButton);
    }

    buttonBox1.add(new JSeparator(JSeparator.VERTICAL));

    buttonBox1.add(new JLabel("View structure: "));

    structures = new StructuresPanel(service, label);

    buttonBox1.add(structures.getJmolButton());
    buttonBox1.add(structures.getLinkButton());

    // Filters
    ButtonGroup scoreGroup = new ButtonGroup();
    JRadioButton scoreButton0 = new JRadioButton("<html>" + HTML_SCORE_0 + "</html>");
    JRadioButton scoreButton1 = new JRadioButton("<html>" + HTML_SCORE_1 + "</html>");
    JRadioButton scoreButton2 = new JRadioButton("<html>" + HTML_SCORE_2 + "</html>");
    JRadioButton scoreButton3 = new JRadioButton("<html>" + HTML_SCORE_3 + "</html>");
    scoreButton0.setSelected(true);

    ScoreListener scoreListener = new ScoreListener();
    scoreButton0.addActionListener(scoreListener);
    scoreButton1.addActionListener(scoreListener);
    scoreButton2.addActionListener(scoreListener);
    scoreButton3.addActionListener(scoreListener);

    scoreGroup.add(scoreButton0);
    scoreGroup.add(scoreButton1);
    scoreGroup.add(scoreButton2);
    scoreGroup.add(scoreButton3);

    buttonBox1.add(new JSeparator(JSeparator.VERTICAL));
    buttonBox1.add(new JLabel("Score: "));
    buttonBox1.add(scoreButton0);
    buttonBox1.add(scoreButton1);
    buttonBox1.add(scoreButton2);
    buttonBox1.add(scoreButton3);

    buttonBox3.add(new JLabel("Interaction type: "));

    JCheckBox EvidencePhysicalButton = new JCheckBox(HTML_CHECKBOX_PHYSICAL);
    JCheckBox EvidenceAssociationButton = new JCheckBox(HTML_CHECKBOX_ASSOCIATION);
    JCheckBox EvidenceEnzymaticButton = new JCheckBox(HTML_CHECKBOX_ENZYMATIC);
    JCheckBox EvidenceOtherButton = new JCheckBox(HTML_CHECKBOX_OTHER);
    JCheckBox EvidenceUnspecifiedButton = new JCheckBox(HTML_CHECKBOX_UNSPECIFIED);
    JCheckBox EvidenceStructureButton = new JCheckBox(HTML_CHECKBOX_STRUCTURE);

    EvidencePhysicalButton.setSelected(true);
    EvidenceAssociationButton.setSelected(true);
    EvidenceEnzymaticButton.setSelected(true);
    EvidenceOtherButton.setSelected(true);
    EvidenceUnspecifiedButton.setSelected(true);
    EvidenceStructureButton.setSelected(true);

    buttonBox3.add(EvidencePhysicalButton);
    buttonBox3.add(EvidenceAssociationButton);
    buttonBox3.add(EvidenceEnzymaticButton);
    buttonBox3.add(EvidenceOtherButton);
    buttonBox3.add(EvidenceUnspecifiedButton);
    buttonBox3.add(EvidenceStructureButton);

    EvidenceTypeListener evidenceListener = new EvidenceTypeListener();
    EvidencePhysicalButton.addActionListener(evidenceListener);
    EvidenceAssociationButton.addActionListener(evidenceListener);
    EvidenceEnzymaticButton.addActionListener(evidenceListener);
    EvidenceOtherButton.addActionListener(evidenceListener);
    EvidenceUnspecifiedButton.addActionListener(evidenceListener);
    EvidenceStructureButton.addActionListener(evidenceListener);

    Box tableBox = new Box(BoxLayout.Y_AXIS);

    MITableModel model = new MITableModel(results);

    miTable = new MITable(model, service, query);

    miTable.setFillsViewportHeight(true);

    miTable.setStructuresPanel(structures);

    tableBox.add(miTable.getTableHeader());
    tableBox.add(miTable);

    JScrollPane tableScroll = new JScrollPane(tableBox);

    tableScroll.setMinimumSize(new Dimension(800, 50));
    tableScroll.setPreferredSize(new Dimension(800, 50));
    tableScroll.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

    structures.setMinimumSize(new Dimension(200, 500));
    structures.setPreferredSize(new Dimension(200, 500));
    structures.setMaximumSize(new Dimension(200, Short.MAX_VALUE));

    resultBox = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tableScroll, structures);
    resultBox.setOneTouchExpandable(true);

    add(menuBox, BorderLayout.NORTH);
    add(resultBox, BorderLayout.CENTER);

}

From source file:edu.ku.brc.specify.config.SpecifyExceptionTracker.java

@Override
protected FeedBackSenderItem getFeedBackSenderItem(final Class<?> cls, final Exception exception) {
    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,f:p:g", "p,8px,p,2px, p,4px,p,2px,f:p:g"));

    Vector<Taskable> taskItems = new Vector<Taskable>(TaskMgr.getInstance().getAllTasks());
    Collections.sort(taskItems, new Comparator<Taskable>() {
        @Override//from ww  w .  j  ava2  s  . com
        public int compare(Taskable o1, Taskable o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });

    final JTextArea commentsTA = createTextArea(3, 60);
    final JTextArea stackTraceTA = createTextArea(15, 60);
    final JCheckBox moreBtn;

    commentsTA.setWrapStyleWord(true);
    commentsTA.setLineWrap(true);

    //JLabel desc = createI18NLabel("UNHDL_EXCP", SwingConstants.LEFT);
    JEditorPane desc = new JEditorPane("text/html", getResourceString("UNHDL_EXCP"));
    desc.setEditable(false);
    desc.setOpaque(false);
    //desc.setFont(new Font(Font.SANS_SERIF, Font.BOLD, (new JLabel("X")).getFont().getSize()));

    JScrollPane sp = new JScrollPane(stackTraceTA, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    int y = 1;
    pb.add(desc, cc.xyw(1, y, 4));
    y += 2;
    pb.add(createI18NFormLabel("UNHDL_EXCP_CMM"), cc.xy(1, y));
    y += 2;
    pb.add(createScrollPane(commentsTA, true), cc.xyw(1, y, 4));
    y += 2;

    forwardImgIcon = IconManager.getIcon("Forward"); //$NON-NLS-1$
    downImgIcon = IconManager.getIcon("Down"); //$NON-NLS-1$
    moreBtn = new JCheckBox(getResourceString("LOGIN_DLG_MORE"), forwardImgIcon); //$NON-NLS-1$
    setControlSize(moreBtn);
    JButton copyBtn = createI18NButton("UNHDL_EXCP_COPY");

    PanelBuilder innerPB = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,2px,p:g,2px,p"));
    innerPB.add(createI18NLabel("UNHDL_EXCP_STK"), cc.xy(1, 1));
    innerPB.add(sp, cc.xyw(1, 3, 3));
    innerPB.add(copyBtn, cc.xy(1, 5));
    stackTracePanel = innerPB.getPanel();
    stackTracePanel.setVisible(false);

    pb.add(moreBtn, cc.xyw(1, y, 4));
    y += 2;
    pb.add(stackTracePanel, cc.xyw(1, y, 4));
    y += 2;

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    exception.printStackTrace(new PrintStream(baos));

    stackTraceTA.setText(baos.toString());

    moreBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (stackTracePanel.isVisible()) {
                stackTracePanel.setVisible(false);
                moreBtn.setIcon(forwardImgIcon);
            } else {
                stackTracePanel.setVisible(true);
                moreBtn.setIcon(downImgIcon);
            }
            if (dlg != null) {
                dlg.pack();
            }
        }
    });

    copyBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String taskName = getTaskName();
            FeedBackSenderItem item = new FeedBackSenderItem(taskName, "", "", commentsTA.getText(),
                    stackTraceTA.getText(), cls.getName());
            NameValuePair[] pairs = createPostParameters(item);

            StringBuilder sb = new StringBuilder();
            for (NameValuePair pair : pairs) {
                if (!pair.getName().equals("bug")) {
                    sb.append(pair.getName());
                    sb.append(": ");
                    if (pair.getName().equals("comments") || pair.getName().equals("stack_trace")) {
                        sb.append("\n");
                    }
                    sb.append(pair.getValue());
                    sb.append("\n");
                }
            }

            // Copy to Clipboard
            UIHelper.setTextToClipboard(sb.toString());
        }
    });

    pb.setDefaultDialogBorder();
    dlg = new CustomDialog((Frame) null, getResourceString("UnhandledExceptionTitle"), true,
            CustomDialog.OK_BTN, pb.getPanel());
    dlg.setOkLabel(getResourceString("UNHDL_EXCP_SEND"));

    dlg.createUI();
    stackTracePanel.setVisible(false);

    centerAndShow(dlg);

    String taskName = getTaskName();
    FeedBackSenderItem item = new FeedBackSenderItem(taskName, "", "", commentsTA.getText(),
            stackTraceTA.getText(), cls.getName());
    return item;
}