Example usage for javax.swing.event HyperlinkEvent getURL

List of usage examples for javax.swing.event HyperlinkEvent getURL

Introduction

In this page you can find the example usage for javax.swing.event HyperlinkEvent getURL.

Prototype

public URL getURL() 

Source Link

Document

Gets the URL that the link refers to.

Usage

From source file:com.microsoft.alm.plugin.idea.git.ui.pullrequest.CreatePullRequestModel.java

private void notifySuccess(final Project project, final String title, final String message) {
    VcsNotifier.getInstance(project).notifyImportantInfo(title, message, new NotificationListener() {
        @Override/*from   w  w  w.  jav  a  2 s  .  co m*/
        public void hyperlinkUpdate(@NotNull final Notification n, @NotNull final HyperlinkEvent e) {
            BrowserUtil.browse(e.getURL());
        }
    });

    // Update the PR tab and any other UI that is listening for PR Changed events
    EventContextHelper.triggerPullRequestChanged(EventContextHelper.SENDER_CREATE_PULL_REQUEST, project);
}

From source file:com.enderville.enderinstaller.ui.Installer.java

@Override
public void hyperlinkUpdate(final HyperlinkEvent e) {
    if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
        return;/*from  w  ww.  java 2  s .  c  o m*/
    }
    SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() {

        @Override
        protected Object doInBackground() throws Exception {
            try {
                String url = e.getURL().toExternalForm();
                Desktop.getDesktop().browse(URI.create(url));
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }
    };
    worker.execute();
}

From source file:com.mirth.connect.client.ui.NotificationDialog.java

private void initComponents() {
    setLayout(new MigLayout("insets 12", "[]", "[fill][]"));

    notificationPanel = new JPanel();
    notificationPanel.setLayout(new MigLayout("insets 0 0 0 0, fill", "[200!][]", "[25!]0[]"));
    notificationPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    archiveAll = new JLabel("Archive All");
    archiveAll.setForeground(java.awt.Color.blue);
    archiveAll.setText("<html><u>Archive All</u></html>");
    archiveAll.setToolTipText("Archive all notifications below.");
    archiveAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

    newNotificationsLabel = new JLabel();
    newNotificationsLabel.setFont(newNotificationsLabel.getFont().deriveFont(Font.BOLD));
    headerListPanel = new JPanel();
    headerListPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR);
    headerListPanel.setLayout(new MigLayout("insets 2, fill"));
    headerListPanel.setBorder(BorderFactory.createLineBorder(borderColor));

    list = new JList();
    list.setCellRenderer(new NotificationListCellRenderer());
    list.addListSelectionListener(new ListSelectionListener() {
        @Override//from  w ww. java  2  s.c  o m
        public void valueChanged(ListSelectionEvent event) {
            if (!event.getValueIsAdjusting()) {
                currentNotification = (Notification) list.getSelectedValue();
                if (currentNotification != null) {
                    notificationNameTextField.setText(currentNotification.getName());
                    contentTextPane.setText(currentNotification.getContent());
                    archiveSelected();
                }
            }
        }
    });
    listScrollPane = new JScrollPane();
    listScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    listScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor));
    listScrollPane.setViewportView(list);
    listScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    archiveLabel = new JLabel();
    archiveLabel.setForeground(java.awt.Color.blue);
    archiveLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

    notificationNameTextField = new JTextField();
    notificationNameTextField.setFont(notificationNameTextField.getFont().deriveFont(Font.BOLD));
    notificationNameTextField.setEditable(false);
    notificationNameTextField.setFocusable(false);
    notificationNameTextField.setBorder(BorderFactory.createEmptyBorder());
    notificationNameTextField.setBackground(UIConstants.HIGHLIGHTER_COLOR);
    DefaultCaret nameCaret = (DefaultCaret) notificationNameTextField.getCaret();
    nameCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    headerContentPanel = new JPanel();
    headerContentPanel.setLayout(new MigLayout("insets 2, fill"));
    headerContentPanel.setBorder(BorderFactory.createLineBorder(borderColor));
    headerContentPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR);

    contentTextPane = new JTextPane();
    contentTextPane.setContentType("text/html");
    contentTextPane.setEditable(false);
    contentTextPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent evt) {
            if (evt.getEventType() == EventType.ACTIVATED && Desktop.isDesktopSupported()) {
                try {
                    if (Desktop.isDesktopSupported()) {
                        Desktop.getDesktop().browse(evt.getURL().toURI());
                    } else {
                        BareBonesBrowserLaunch.openURL(evt.getURL().toString());
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    });
    DefaultCaret contentCaret = (DefaultCaret) contentTextPane.getCaret();
    contentCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    contentScrollPane = new JScrollPane();
    contentScrollPane.setViewportView(contentTextPane);
    contentScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor));

    archiveLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            int index = list.getSelectedIndex();
            if (currentNotification.isArchived()) {
                notificationModel.setArchived(false, index);
                unarchivedCount++;
            } else {
                notificationModel.setArchived(true, index);
                unarchivedCount--;
            }
            archiveSelected();
            updateUnarchivedCountLabel();
        }
    });

    archiveAll.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            for (int i = 0; i < notificationModel.getSize(); i++) {
                notificationModel.setArchived(true, i);
            }
            unarchivedCount = 0;
            archiveSelected();
            updateUnarchivedCountLabel();
        }
    });

    notificationCheckBox = new JCheckBox("Show new notifications on login");
    notificationCheckBox.setBackground(UIConstants.BACKGROUND_COLOR);

    if (checkForNotifications == null || BooleanUtils.toBoolean(checkForNotifications)) {
        checkForNotificationsSetting = true;
        if (showNotificationPopup == null || BooleanUtils.toBoolean(showNotificationPopup)) {
            notificationCheckBox.setSelected(true);
        } else {
            notificationCheckBox.setSelected(false);
        }
    } else {
        notificationCheckBox.setSelected(false);
    }

    notificationCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (notificationCheckBox.isSelected() && !checkForNotificationsSetting) {
                alertSettingsChange();
            }
        }
    });

    closeButton = new JButton("Close");
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doSave();
        }
    });

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            doSave();
        }
    });
}

From source file:de.ist.clonto.Ontogui.java

private void initComponents() {

    AnalysisjPanel = new javax.swing.JPanel();
    loadOntologyButton = new javax.swing.JButton();
    loadQueryButton = new javax.swing.JButton();
    ontologyNameField = new javax.swing.JTextField();
    smellNameField = new javax.swing.JTextField();
    metricsCombobox = new javax.swing.JComboBox<>();
    backupOntologyButton = new javax.swing.JButton();
    runQueryButton = new javax.swing.JButton();
    runMetricsButton = new javax.swing.JButton();
    badSmellComboBox = new javax.swing.JComboBox<>();
    runSmellAnalysisButton = new javax.swing.JButton();
    TransformationjPanel = new javax.swing.JPanel();
    ContextjScrollPane = new javax.swing.JScrollPane();
    contextArea = new javax.swing.JTextArea();
    descriptionjScrollPane = new javax.swing.JScrollPane();
    descriptionArea = new javax.swing.JTextArea();
    displayRefactoringButton = new javax.swing.JButton();
    runRefactoringButton = new javax.swing.JButton();
    refactorCombobox = new javax.swing.JComboBox<>();
    pruningCombobox = new javax.swing.JComboBox<>();
    displayPruningButton = new javax.swing.JButton();
    runPruningButton = new javax.swing.JButton();
    checkbox1 = new java.awt.Checkbox();
    jScrollPane1 = new javax.swing.JScrollPane();
    queryResultArea = new javax.swing.JEditorPane();
    queryResultArea.addHyperlinkListener(new HyperlinkListener() {
        @Override//from w  w w .  ja v a2s  .c  o m
        public void hyperlinkUpdate(HyperlinkEvent e) {
            System.out.print(e.getURL());
        }
    });

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setExtendedState(JFrame.MAXIMIZED_BOTH);

    AnalysisjPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Analysis"));

    loadOntologyButton.setText("load ontology");
    loadOntologyButton.setToolTipText("Load an existing tdb dataset");
    loadOntologyButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            loadOntology(evt);
        }
    });

    loadQueryButton.setText("load query");
    loadQueryButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            loadQuery(evt);
        }
    });

    ontologyNameField.setEditable(false);
    ontologyNameField.setText("<ontology name>");

    smellNameField.setEditable(false);
    smellNameField.setText("<query name>");

    metricsCombobox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "type:Depth",
            "type:CategoryInOut", "type:ComputerLanguagesDistanceMeasures", "type:NOC", "type:subdomainratio",
            "graph:CategoriesPerEntityMaxAvg", "graph:EntitiesPerCategoryMaxAvg", "graph:graphMetrics" }));
    metricsCombobox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            metricsComboboxActionPerformed(evt);
        }
    });

    backupOntologyButton.setText("backup");
    backupOntologyButton.setToolTipText(
            "Create a backup of the selected tdb dataset." + "Selected folder will be cleaned first.");
    backupOntologyButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            backupOntologyButtonActionPerformed(evt);
        }
    });

    runQueryButton.setText("run query");
    runQueryButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            runQueryButtonActionPerformed(evt);
        }
    });

    runMetricsButton.setText("run metric");
    runMetricsButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            runMetricsButtonActionPerformed(evt);
        }
    });

    badSmellComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Distant Type",
            "Eponymous Type", "Semantically Distant Type", "Semantically Distant Entity", "Multi Topic",
            "Off Topic", "Double Reachable Type", "Double Reachable Entity", "Cycle", "Lazy Type Metric based",
            "Lazy Type Instance Containment", "Missing Type", "Redundant Subtype", "Redundant Instance" }));
    badSmellComboBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            badSmellComboBoxActionPerformed(evt);
        }
    });

    runSmellAnalysisButton.setText("run smell");
    runSmellAnalysisButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            runSmellAnalysisButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout AnalysisjPanelLayout = new javax.swing.GroupLayout(AnalysisjPanel);
    AnalysisjPanel.setLayout(AnalysisjPanelLayout);
    AnalysisjPanelLayout.setHorizontalGroup(AnalysisjPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(AnalysisjPanelLayout.createSequentialGroup().addGap(20, 20, 20)
                    .addGroup(AnalysisjPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(AnalysisjPanelLayout.createSequentialGroup().addGroup(AnalysisjPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(ontologyNameField, javax.swing.GroupLayout.DEFAULT_SIZE, 137,
                                            Short.MAX_VALUE)
                                    .addComponent(smellNameField))
                                    .addGroup(AnalysisjPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addGroup(AnalysisjPanelLayout.createSequentialGroup()
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(loadOntologyButton)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(backupOntologyButton,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 80,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    AnalysisjPanelLayout.createSequentialGroup()
                                                            .addPreferredGap(
                                                                    javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(loadQueryButton,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addGap(121, 121, 121))))
                            .addGroup(AnalysisjPanelLayout.createSequentialGroup()
                                    .addGroup(AnalysisjPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(metricsCombobox, 0, 1, Short.MAX_VALUE)
                                            .addComponent(badSmellComboBox, 0, 240, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(AnalysisjPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(runMetricsButton,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 85,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(runQueryButton,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 85,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(runSmellAnalysisButton,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 85,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(0, 0, Short.MAX_VALUE)));
    AnalysisjPanelLayout.setVerticalGroup(
            AnalysisjPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(AnalysisjPanelLayout.createSequentialGroup().addContainerGap()
                            .addGroup(AnalysisjPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(ontologyNameField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(backupOntologyButton).addComponent(loadOntologyButton))
                            .addGap(3, 3, 3)
                            .addGroup(AnalysisjPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(smellNameField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(loadQueryButton).addComponent(runQueryButton))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(AnalysisjPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(metricsCombobox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(runMetricsButton))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(AnalysisjPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(badSmellComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(runSmellAnalysisButton))
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    TransformationjPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Transformation"));

    contextArea.setEditable(false);
    contextArea.setColumns(20);
    contextArea.setRows(5);
    contextArea.setText("<Context:>");
    ContextjScrollPane.setViewportView(contextArea);

    descriptionArea.setEditable(false);
    descriptionArea.setColumns(20);
    descriptionArea.setRows(5);
    descriptionArea.setText("<Transformations:>");
    descriptionjScrollPane.setViewportView(descriptionArea);

    displayRefactoringButton.setText("Display Refactoring");
    displayRefactoringButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            displayTransformationInfo(false);
        }
    });

    runRefactoringButton.setText("Execute Refactoring");
    runRefactoringButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            runRefactoringButtonActionPerformed(evt);
        }
    });

    refactorCombobox.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "Rename Element", "Change Topic", "Move Entity", "Move Type", "Add Missing Subtype",
                    "Add Missing Instance", "Unite Information", "Extract Entity", "Extract Subtype",
                    "Remove Redundant Instances", "Remove Redundant Subtypes" }));
    refactorCombobox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            refactorComboboxActionPerformed(evt);
        }
    });

    pruningCombobox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Abandon Type (selective)",
            "Abandon Entity", "Abandon Type (no rescue)", "Abandon Information", "Remove Instance",
            "Remove Subtype", "Abandon Type (rescue all)", "Cleanup Unreachable All",
            "Cleanup Unreachable Type", "Cleanup Unreachable Ent", "Lift Cycle", "Custom" }));
    pruningCombobox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            pruningComboboxActionPerformed(evt);
        }
    });

    displayPruningButton.setText("Display Pruning");
    displayPruningButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            displayTransformationInfo(true);
        }
    });

    runPruningButton.setText("Execute Pruning");
    runPruningButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            runPruningButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout TransformationjPanelLayout = new javax.swing.GroupLayout(TransformationjPanel);
    TransformationjPanel.setLayout(TransformationjPanelLayout);
    TransformationjPanelLayout.setHorizontalGroup(TransformationjPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TransformationjPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(TransformationjPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(TransformationjPanelLayout.createSequentialGroup()
                                    .addGroup(TransformationjPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(pruningCombobox,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 180,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(refactorCombobox,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 180,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(18, 18, 18)
                                    .addGroup(TransformationjPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(displayPruningButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(displayRefactoringButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(TransformationjPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addComponent(runRefactoringButton,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(runPruningButton,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(TransformationjPanelLayout.createSequentialGroup()
                                    .addComponent(ContextjScrollPane)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(descriptionjScrollPane)))
                    .addContainerGap()));
    TransformationjPanelLayout.setVerticalGroup(TransformationjPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TransformationjPanelLayout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(TransformationjPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(descriptionjScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(TransformationjPanelLayout.createSequentialGroup()
                                    .addComponent(ContextjScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(TransformationjPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(refactorCombobox,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(displayRefactoringButton)
                                            .addComponent(runRefactoringButton))))
                    .addGap(2, 2, 2)
                    .addGroup(TransformationjPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(pruningCombobox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(displayPruningButton).addComponent(runPruningButton))));

    checkbox1.setLabel("prettyprint");

    queryResultArea.setEditable(false);
    jScrollPane1.setViewportView(queryResultArea);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(AnalysisjPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup().addGap(27, 27, 27).addComponent(checkbox1,
                            javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(TransformationjPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGap(3, 3, 3))
            .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1)
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                    .addComponent(AnalysisjPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(checkbox1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(TransformationjPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane1).addContainerGap()));

    pack();
}

From source file:de.ailis.xadrian.components.ComplexEditor.java

/**
 * @see HyperlinkListener#hyperlinkUpdate(HyperlinkEvent)
 *//*  www.  ja  v a2 s  .  co  m*/
@Override
public void hyperlinkUpdate(final HyperlinkEvent e) {
    if (e.getEventType() != EventType.ACTIVATED)
        return;

    final URL url = e.getURL();
    final String protocol = url.getProtocol();

    if ("file".equals(protocol)) {
        final String action = url.getHost();
        if ("addFactory".equals(action)) {
            addFactory();
        } else if ("removeFactory".equals(action)) {
            removeFactory(Integer.parseInt(url.getPath().substring(1)));
        } else if ("disableFactory".equals(action)) {
            disableFactory(Integer.parseInt(url.getPath().substring(1)));
        } else if ("enableFactory".equals(action)) {
            enableFactory(Integer.parseInt(url.getPath().substring(1)));
        } else if ("acceptFactory".equals(action)) {
            acceptFactory(Integer.parseInt(url.getPath().substring(1)));
        } else if ("changeQuantity".equals(action)) {
            changeQuantity(Integer.parseInt(url.getPath().substring(1)));
        } else if ("increaseQuantity".equals(action)) {
            increaseQuantity(Integer.parseInt(url.getPath().substring(1)));
        } else if ("decreaseQuantity".equals(action)) {
            decreaseQuantity(Integer.parseInt(url.getPath().substring(1)));
        } else if ("changeYield".equals(action)) {
            changeYield(Integer.parseInt(url.getPath().substring(1)));
        } else if ("changeSuns".equals(action)) {
            changeSuns();
        } else if ("changeSector".equals(action)) {
            changeSector();
        } else if ("changePrice".equals(action)) {
            changePrices(this.complex.getGame().getWareFactory().getWare(url.getPath().substring(1)));
        } else if ("toggleShowingProductionStats".equals(action)) {
            toggleShowingProductionStats();
        } else if ("toggleShowingStorageCapacities".equals(action)) {
            toggleShowingStorageCapacities();
        } else if ("toggleShowingShoppingList".equals(action)) {
            toggleShowingShoppingList();
        } else if ("toggleShowingComplexSetup".equals(action)) {
            toggleShowingComplexSetup();
        } else if ("buildFactory".equals(action)) {
            buildFactory(url.getPath().substring(1));
        } else if ("destroyFactory".equals(action)) {
            destroyFactory(url.getPath().substring(1));
        } else if ("buildKit".equals(action)) {
            buildKit();
        } else if ("destroyKit".equals(action)) {
            destroyKit();
        }
    }
}

From source file:edu.ku.brc.specify.ui.AppBase.java

/**
 * Shows the About dialog./*from   w  ww  . j  a v  a2s  .  co  m*/
 */
public void doAbout() {
    AppContextMgr acm = AppContextMgr.getInstance();
    boolean hasContext = acm.hasContext();

    int baseNumRows = 9;
    String serverName = AppPreferences.getLocalPrefs().get("login.servers_selected", null);
    if (serverName != null) {
        baseNumRows++;
    }

    CellConstraints cc = new CellConstraints();
    PanelBuilder infoPB = new PanelBuilder(new FormLayout("p,6px,f:p:g",
            "p,4px,p,4px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", baseNumRows)));

    JLabel iconLabel = new JLabel(IconManager.getIcon("SpecifyLargeIcon"), SwingConstants.CENTER); //$NON-NLS-1$
    PanelBuilder iconPB = new PanelBuilder(new FormLayout("p", "20px,t:p,f:p:g"));
    iconPB.add(iconLabel, cc.xy(1, 2));

    if (hasContext) {
        DBTableIdMgr tableMgr = DBTableIdMgr.getInstance();
        boolean hasReged = !RegisterSpecify.isAnonymous() && RegisterSpecify.hasInstitutionRegistered();

        int y = 1;
        infoPB.addSeparator(getResourceString("Specify.SYS_INFO"), cc.xyw(1, y, 3));
        y += 2;

        JLabel lbl = UIHelper.createLabel(databaseName);
        infoPB.add(UIHelper.createI18NFormLabel("Specify.DB"), cc.xy(1, y));
        infoPB.add(lbl, cc.xy(3, y));
        y += 2;
        lbl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    openLocalPrefs();
                }
            }
        });

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Institution.getClassTableId())),
                cc.xy(1, y));
        infoPB.add(lbl = UIHelper.createLabel(acm.getClassObject(Institution.class).getName()), cc.xy(3, y));
        y += 2;
        lbl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    openRemotePrefs();
                }
            }
        });
        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Division.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Division.class).getName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Discipline.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Discipline.class).getName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Collection.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Collection.class).getCollectionName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createI18NFormLabel("Specify.BLD"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(appBuildVersion), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createI18NFormLabel("Specify.REG"), cc.xy(1, y));
        infoPB.add(UIHelper.createI18NLabel(hasReged ? "Specify.HASREG" : "Specify.NOTREG"), cc.xy(3, y));
        y += 2;

        String isaNumber = RegisterSpecify.getISANumber();
        infoPB.add(UIHelper.createI18NFormLabel("Specify.ISANUM"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(StringUtils.isNotEmpty(isaNumber) ? isaNumber : ""), cc.xy(3, y));
        y += 2;

        if (serverName != null) {
            infoPB.add(UIHelper.createI18NFormLabel("Specify.SERVER"), cc.xy(1, y));
            infoPB.add(UIHelper.createLabel(StringUtils.isNotEmpty(serverName) ? serverName : ""), cc.xy(3, y));
            y += 2;
        }

        if (StringUtils.contains(DBConnection.getInstance().getConnectionStr(), "mysql")) {
            Vector<Object[]> list = BasicSQLUtils.query("select version() as ve");
            if (list != null && list.size() > 0) {
                infoPB.add(UIHelper.createFormLabel("MySQL Version"), cc.xy(1, y));
                infoPB.add(UIHelper.createLabel(list.get(0)[0].toString()), cc.xy(3, y));
                y += 2;
            }
        }

        infoPB.add(UIHelper.createFormLabel("Java Version"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(System.getProperty("java.version")), cc.xy(3, y));
        y += 2;
    }

    String txt = getAboutText(appName, appVersion);
    JLabel txtLbl = createLabel(txt);
    txtLbl.setFont(UIRegistry.getDefaultFont());

    final JEditorPane txtPane = new JEditorPane("text/html", txt);
    txtPane.setEditable(false);
    txtPane.setBackground(new JPanel().getBackground());

    PanelBuilder pb = new PanelBuilder(new FormLayout("p,20px,f:min(400px;p):g,10px,8px,10px,p:g", "f:p:g"));

    pb.add(iconPB.getPanel(), cc.xy(1, 1));
    pb.add(txtPane, cc.xy(3, 1));
    Color bg = getBackground();

    if (hasContext) {
        pb.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xy(5, 1));
        pb.add(infoPB.getPanel(), cc.xy(7, 1));
    }

    pb.setDefaultDialogBorder();

    String title = getResourceString("Specify.ABOUT");//$NON-NLS-1$
    CustomDialog aboutDlg = new CustomDialog(topFrame, title + " " + appName, true, CustomDialog.OK_BTN, //$NON-NLS-1$
            pb.getPanel());
    String okLabel = getResourceString("Specify.CLOSE");//$NON-NLS-1$
    aboutDlg.setOkLabel(okLabel);

    aboutDlg.createUI();
    aboutDlg.pack();

    // for some strange reason I can't get the dialog to size itself correctly
    Dimension size = aboutDlg.getSize();
    size.height += 120;
    aboutDlg.setSize(size);

    txtPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent event) {
            if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                    AttachmentUtils.openURI(event.getURL().toURI());

                } catch (Exception e) {
                    edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                }
            }
        }
    });

    UIHelper.centerAndShow(aboutDlg);
}

From source file:net.minelord.gui.panes.IRCPane.java

public void startClient(final String nick) {
    IRCLog = new ArrayList<String>();
    SwingUtilities.invokeLater(new Runnable() {
        @Override/*from   w  ww  .j  a  v  a 2 s.c  o  m*/
        public void run() {
            text = new JEditorPane("text/html", "<HTML>");
            text.setEditable(false);
            kit = new HTMLEditorKit();
            text.setEditorKit(kit);
            client.connect("irc.liberty-unleashed.co.uk", "#moomoohk", nick, instance);
            scroller = new JScrollPane(text);
            text.setEditable(false);
            connect();
            scroller.setBounds(20, 20, 810, 250);
            add(scroller);
            input = new JTextField();
            input.setBounds(20, 270, 810, 30);
            Color bgColor = Color.gray.darker().darker();
            UIDefaults defaults = new UIDefaults();
            defaults.put("EditorPane[Enabled].backgroundPainter", bgColor);
            text.putClientProperty("Nimbus.Overrides", defaults);
            text.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
            text.setBackground(bgColor);
            input.setBackground(Color.gray);
            input.setForeground(Color.gray.darker().darker().darker());
            input.setEnabled(false);
            text.addHyperlinkListener(new HyperlinkListener() {
                @Override
                public void hyperlinkUpdate(HyperlinkEvent event) {
                    if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                        if (event.getDescription().charAt(0) == '#') {
                            String[] params = { event.getDescription() };
                            IRCCommand.getCommand("/join").execute(client, params);
                        } else
                            OSUtils.browse(event.getURL().toString());
                    }
                }
            });
            text.addFocusListener(new FocusListener() {

                @Override
                public void focusLost(FocusEvent paramFocusEvent) {
                }

                @Override
                public void focusGained(FocusEvent paramFocusEvent) {
                    input.requestFocus();
                }
            });
            scroller.setViewportView(text);
            add(input);
            input.addKeyListener(new KeyListener() {

                @Override
                public void keyTyped(KeyEvent arg0) {
                }

                @Override
                public void keyReleased(KeyEvent arg0) {
                    if (arg0.getKeyCode() == 10) {
                        if (input.getText().length() > 0) {
                            lastCommandSelector = lastCommands.size();
                            lastCommands.add(input.getText());
                        }
                        sendMessage(input.getText());
                        input.setText("");
                    }
                    if (arg0.getKeyCode() == 27)
                        input.setText("");
                    if (arg0.getKeyCode() == 17) {
                        int before = input.getText().length();
                        if (input.getText().charAt(0) == '/') {
                            input.setText(completeNick(input.getText()));
                            input.select(
                                    input.getText().length() - completeNick(input.getText()).length() + before,
                                    input.getText().length());
                        } else {
                            input.setText(completeCommand(input.getText()));
                            input.select(input.getText().length() - completeCommand(input.getText()).length()
                                    + before, input.getText().length());
                        }
                    }
                    if (arg0.getKeyCode() == 38)
                        if (lastCommandSelector > 0) {
                            lastCommandSelector--;
                            input.setText(lastCommands.get(lastCommandSelector));
                        }
                    if (arg0.getKeyCode() == 40)
                        if (lastCommandSelector < lastCommands.size()) {
                            lastCommandSelector++;
                            if (lastCommandSelector == lastCommands.size())
                                input.setText("");
                            if (lastCommandSelector < lastCommands.size())
                                input.setText(lastCommands.get(lastCommandSelector));
                            return;
                        }
                }

                @Override
                public void keyPressed(KeyEvent arg0) {
                }
            });
        }
    });
}

From source file:com.farouk.projectapp.FirstGUI.java

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
    jPanel10.setVisible(true);/*w ww.j a va 2s  . co m*/
    StringBuilder temp = new StringBuilder();
    int row = jTable2.getSelectedRow();
    String name = (jTable2.getModel().getValueAt(row, 0).toString());
    for (YahooNews y : YahooNews.getRss(SQLConnect.getSymbolOfCompanyFromDB(name))) {
        temp.append(y.toString());
    }
    jEditorPane1.setContentType("text/html");
    jEditorPane1.setText(temp.toString());
    jEditorPane1.setCaretPosition(0);
    jEditorPane1.addHyperlinkListener(new HyperlinkListener() {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
                System.out.println(e.getURL());
                Desktop desktop = Desktop.getDesktop();
                try {
                    desktop.browse(e.getURL().toURI());
                } catch (Exception ex) {
                    System.err.println("Problem in link click.\n" + ex);
                }
            }
        }
    });

    jEditorPane1.setEditable(false);

}

From source file:com.marginallyclever.makelangelo.MainGUI.java

/**
* 
* @param html String of valid HTML.// w ww  .j a v  a 2 s  .  c o  m
* @return a 
*/
private JTextComponent createHyperlinkListenableJEditorPane(String html) {
    final JEditorPane bottomText = new JEditorPane();
    bottomText.setContentType("text/html");
    bottomText.setEditable(false);
    bottomText.setText(html);
    bottomText.setOpaque(false);
    final HyperlinkListener hyperlinkListener = new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
            if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (Desktop.isDesktopSupported()) {
                    try {
                        Desktop.getDesktop().browse(hyperlinkEvent.getURL().toURI());
                    } catch (IOException | URISyntaxException exception) {
                        // FIXME Auto-generated catch block
                        exception.printStackTrace();
                    }
                }

            }
        }
    };
    bottomText.addHyperlinkListener(hyperlinkListener);
    return bottomText;
}

From source file:ca.canuckcoding.wosqi.FeedViewer.java

private void jTextPane1HyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_jTextPane1HyperlinkUpdate
    if (evt.getEventType() == javax.swing.event.HyperlinkEvent.EventType.ACTIVATED) {
        openUrl(evt.getURL());
    }/*from www.  j a va 2 s . c om*/
}