Skip to content

Commit 57a170d

Browse files
ChristophBodensteinChristophBodenstein
authored andcommitted
added link to current commit on github
1 parent 7e75f54 commit 57a170d

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

TimeNETOptimizationEnvironment/src/toe/AboutPanel.form

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@
100100
<Properties>
101101
<Property name="horizontalAlignment" type="int" value="0"/>
102102
<Property name="text" type="java.lang.String" value="Version: x.x.xxx"/>
103+
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
104+
<Color id="Handcursor"/>
105+
</Property>
103106
</Properties>
107+
<Events>
108+
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelVersionMouseClicked"/>
109+
</Events>
104110
</Component>
105111
<Component class="javax.swing.JLabel" name="jLabel3">
106112
<Properties>

TimeNETOptimizationEnvironment/src/toe/AboutPanel.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package toe;
99

1010
import java.awt.Desktop;
11-
import java.io.FileInputStream;
1211
import java.io.IOException;
1312
import java.io.InputStream;
1413
import java.io.InputStreamReader;
@@ -25,6 +24,8 @@
2524
*/
2625
public class AboutPanel extends javax.swing.JPanel implements HyperlinkListener {
2726

27+
String linkToVersion = "https://github.com/ChristophBodenstein/TimeNETOptimizationEnvironment/commit/";
28+
2829
/**
2930
* Creates new form AboutPanel
3031
*/
@@ -41,6 +42,7 @@ public AboutPanel() {
4142
versionInformation.load(ddlStream);
4243
ddlStream.close();
4344
this.jLabelVersion.setText("Version: " + versionInformation.getProperty("version", ""));
45+
this.linkToVersion+=versionInformation.getProperty("shorthash", "");
4446
} catch (Exception e) {
4547
support.log("Could not load Version.properties.", typeOfLogLevel.ERROR);
4648
}
@@ -111,6 +113,12 @@ private void initComponents() {
111113

112114
jLabelVersion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
113115
jLabelVersion.setText("Version: x.x.xxx");
116+
jLabelVersion.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
117+
jLabelVersion.addMouseListener(new java.awt.event.MouseAdapter() {
118+
public void mouseClicked(java.awt.event.MouseEvent evt) {
119+
jLabelVersionMouseClicked(evt);
120+
}
121+
});
114122

115123
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
116124
jLabel3.setText("A Tool for exploring SCPN Designspaces and doing Optimization runs within.");
@@ -152,6 +160,14 @@ private void initComponents() {
152160
);
153161
}// </editor-fold>//GEN-END:initComponents
154162

163+
private void jLabelVersionMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelVersionMouseClicked
164+
try {
165+
Desktop.getDesktop().browse(new URL(this.linkToVersion).toURI());
166+
} catch (Exception ex) {
167+
support.log("Could not open link to current version on Github.", typeOfLogLevel.ERROR);
168+
}
169+
}//GEN-LAST:event_jLabelVersionMouseClicked
170+
155171
// Variables declaration - do not modify//GEN-BEGIN:variables
156172
private javax.swing.JEditorPane jEditorPaneRequirments;
157173
private javax.swing.JLabel jLabel1;

0 commit comments

Comments
 (0)