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();
}
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);
}
}
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();
}
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");
}
}
}
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();
}
});
}
Aggregations