Search in sources :

Example 1 with JXHyperlink

use of org.jdesktop.swingx.JXHyperlink in project azure-tools-for-java by Microsoft.

the class SignInWindow method doHelpAction.

@Override
public void doHelpAction() {
    JXHyperlink helpLink = new JXHyperlink();
    helpLink.setURI(URI.create("https://docs.microsoft.com/en-us/azure/azure-toolkit-for-intellij-sign-in-instructions"));
    helpLink.doClick();
}
Also used : JXHyperlink(org.jdesktop.swingx.JXHyperlink)

Example 2 with JXHyperlink

use of org.jdesktop.swingx.JXHyperlink in project gephi by gephi.

the class WelcomeTopComponent method loadSamples.

private void loadSamples() {
    net.miginfocom.swing.MigLayout migLayout1 = new net.miginfocom.swing.MigLayout();
    migLayout1.setColumnConstraints("[pref]");
    samplesPanel.setLayout(migLayout1);
    String[] samplePath = new String[3];
    samplePath[0] = "/org/gephi/desktop/welcome/samples/Les Miserables.gexf";
    samplePath[1] = "/org/gephi/desktop/welcome/samples/Java.gexf";
    samplePath[2] = "/org/gephi/desktop/welcome/samples/Power Grid.gml";
    String[] sampleTooltip = new String[3];
    sampleTooltip[0] = "Coappearance Network of Characters in 'Les Miserables' (D. E. Knuth)";
    sampleTooltip[1] = "Java Programming Language Dependency graph (V. Batagelj)";
    sampleTooltip[2] = "Topology of the Western States Power Grid of the US (D. Watts & S. Strogatz)";
    try {
        for (int i = 0; i < samplePath.length; i++) {
            final String s = samplePath[i];
            String tooltip = sampleTooltip[i];
            String fileName = s.substring(s.lastIndexOf('/') + 1, s.length());
            final String importer = fileName.substring(fileName.lastIndexOf('.'), fileName.length());
            JXHyperlink fileLink = new JXHyperlink(new AbstractAction() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    final InputStream stream = WelcomeTopComponent.class.getResourceAsStream(s);
                    ImportControllerUI importController = Lookup.getDefault().lookup(ImportControllerUI.class);
                    importController.importStream(stream, importer);
                    closeDialog();
                }
            });
            fileLink.setText(fileName);
            fileLink.setToolTipText(tooltip);
            fileLink.putClientProperty(LINK_PATH, importer);
            samplesPanel.add(fileLink, "wrap");
        }
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }
}
Also used : ActionEvent(java.awt.event.ActionEvent) InputStream(java.io.InputStream) JXHyperlink(org.jdesktop.swingx.JXHyperlink) ImportControllerUI(org.gephi.desktop.importer.api.ImportControllerUI) AbstractAction(javax.swing.AbstractAction)

Example 3 with JXHyperlink

use of org.jdesktop.swingx.JXHyperlink in project azure-tools-for-java by Microsoft.

the class AzureCodeSamples method onActionPerformed.

@Override
public void onActionPerformed(AnActionEvent anActionEvent) {
    JXHyperlink portalLing = new JXHyperlink();
    portalLing.setURI(URI.create("https://azure.microsoft.com/en-us/documentation/samples/?platform=java"));
    portalLing.doClick();
}
Also used : JXHyperlink(org.jdesktop.swingx.JXHyperlink)

Example 4 with JXHyperlink

use of org.jdesktop.swingx.JXHyperlink in project gephi by gephi.

the class WelcomeTopComponent method loadMRU.

private void loadMRU() {
    net.miginfocom.swing.MigLayout migLayout1 = new net.miginfocom.swing.MigLayout();
    migLayout1.setColumnConstraints("[pref]");
    recentPanel.setLayout(migLayout1);
    MostRecentFiles mru = Lookup.getDefault().lookup(MostRecentFiles.class);
    for (String filePath : mru.getMRUFileList()) {
        JXHyperlink fileLink = new JXHyperlink(openAction);
        File file = new File(filePath);
        if (file.exists()) {
            fileLink.setText(file.getName());
            fileLink.putClientProperty(LINK_PATH, file);
            recentPanel.add(fileLink, "wrap");
        }
    }
}
Also used : MostRecentFiles(org.gephi.desktop.mrufiles.api.MostRecentFiles) JXHyperlink(org.jdesktop.swingx.JXHyperlink) File(java.io.File)

Example 5 with JXHyperlink

use of org.jdesktop.swingx.JXHyperlink in project gephi by gephi.

the class WelcomeTopComponent method initAction.

private void initAction() {
    openAction = new AbstractAction("", ImageUtilities.loadImageIcon("org/gephi/desktop/welcome/resources/gephifile20.png", false)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            JXHyperlink link = (JXHyperlink) e.getSource();
            File file = (File) link.getClientProperty(LINK_PATH);
            FileObject fileObject = FileUtil.toFileObject(file);
            if (fileObject.hasExt(GEPHI_EXTENSION)) {
                ProjectControllerUI pc = Lookup.getDefault().lookup(ProjectControllerUI.class);
                try {
                    pc.openProject(file);
                } catch (Exception ex) {
                    Exceptions.printStackTrace(ex);
                    NotifyDescriptor.Message msg = new NotifyDescriptor.Message(NbBundle.getMessage(WelcomeTopComponent.class, "WelcomeTopComponent.openGephiError"), NotifyDescriptor.WARNING_MESSAGE);
                    DialogDisplayer.getDefault().notify(msg);
                }
            } else {
                ImportControllerUI importController = Lookup.getDefault().lookup(ImportControllerUI.class);
                if (importController.getImportController().isFileSupported(FileUtil.toFile(fileObject))) {
                    importController.importFile(fileObject);
                }
            }
            closeDialog();
        }
    };
    newProjectLink.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ProjectControllerUI pc = Lookup.getDefault().lookup(ProjectControllerUI.class);
            pc.newProject();
            closeDialog();
        }
    });
    openFileLink.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ProjectControllerUI pc = Lookup.getDefault().lookup(ProjectControllerUI.class);
            pc.openFile();
            closeDialog();
        }
    });
}
Also used : ActionEvent(java.awt.event.ActionEvent) JXHyperlink(org.jdesktop.swingx.JXHyperlink) NotifyDescriptor(org.openide.NotifyDescriptor) ActionListener(java.awt.event.ActionListener) ImportControllerUI(org.gephi.desktop.importer.api.ImportControllerUI) FileObject(org.openide.filesystems.FileObject) AbstractAction(javax.swing.AbstractAction) File(java.io.File) ProjectControllerUI(org.gephi.desktop.project.api.ProjectControllerUI)

Aggregations

JXHyperlink (org.jdesktop.swingx.JXHyperlink)12 ActionEvent (java.awt.event.ActionEvent)3 File (java.io.File)2 AbstractAction (javax.swing.AbstractAction)2 ImportControllerUI (org.gephi.desktop.importer.api.ImportControllerUI)2 ValidationAwareActionListener (com.haulmont.cuba.desktop.sys.validation.ValidationAwareActionListener)1 Window (com.haulmont.cuba.gui.components.Window)1 ActionListener (java.awt.event.ActionListener)1 InputStream (java.io.InputStream)1 Action (javax.swing.Action)1 Border (javax.swing.border.Border)1 CompoundBorder (javax.swing.border.CompoundBorder)1 EmptyBorder (javax.swing.border.EmptyBorder)1 MostRecentFiles (org.gephi.desktop.mrufiles.api.MostRecentFiles)1 ProjectControllerUI (org.gephi.desktop.project.api.ProjectControllerUI)1 JXCollapsiblePane (org.jdesktop.swingx.JXCollapsiblePane)1 NotifyDescriptor (org.openide.NotifyDescriptor)1 FileObject (org.openide.filesystems.FileObject)1