2929
3030package cc .arduino .view .preferences ;
3131
32- import com .google .common .base .Function ;
3332import com .google .common .base .Joiner ;
34- import com .google .common .base .Predicate ;
3533import com .google .common .collect .FluentIterable ;
3634import processing .app .Base ;
3735
@@ -53,13 +51,7 @@ public AdditionalBoardsManagerURLTextArea(Window parent) {
5351 initComponents ();
5452 setLocationRelativeTo (parent );
5553
56- Base .registerWindowCloseKeys (getRootPane (), new ActionListener () {
57- @ Override
58- public void actionPerformed (ActionEvent e ) {
59- cancelActionPerformed (e );
60- }
61- });
62-
54+ Base .registerWindowCloseKeys (getRootPane (), this ::cancelActionPerformed );
6355 }
6456
6557 /**
@@ -75,6 +67,7 @@ private void initComponents() {
7567 javax .swing .JButton cancel = new javax .swing .JButton ();
7668 javax .swing .JButton ok = new javax .swing .JButton ();
7769 javax .swing .JLabel jLabel1 = new javax .swing .JLabel ();
70+ unofficialListURLLabel = new javax .swing .JLabel ();
7871
7972 setDefaultCloseOperation (javax .swing .WindowConstants .DISPOSE_ON_CLOSE );
8073 setTitle (_ ("Additional Boards Manager URLs" ));
@@ -102,6 +95,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
10295
10396 jLabel1 .setText (_ ("Enter additional URLs, one for each row" ));
10497
98+ unofficialListURLLabel .setText (_ ("Click for a list of unofficial boards support URLs" ));
99+ unofficialListURLLabel .setCursor (new java .awt .Cursor (java .awt .Cursor .HAND_CURSOR ));
100+ unofficialListURLLabel .addMouseListener (new java .awt .event .MouseAdapter () {
101+ public void mouseClicked (java .awt .event .MouseEvent evt ) {
102+ unofficialListURLLabelMouseClicked (evt );
103+ }
104+
105+ public void mouseExited (java .awt .event .MouseEvent evt ) {
106+ unofficialListURLLabelMouseExited (evt );
107+ }
108+
109+ public void mouseEntered (java .awt .event .MouseEvent evt ) {
110+ unofficialListURLLabelMouseEntered (evt );
111+ }
112+ });
113+
105114 javax .swing .GroupLayout layout = new javax .swing .GroupLayout (getContentPane ());
106115 getContentPane ().setLayout (layout );
107116 layout .setHorizontalGroup (
@@ -110,13 +119,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
110119 .addContainerGap ()
111120 .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .LEADING )
112121 .addGroup (layout .createSequentialGroup ()
113- .addGap (0 , 332 , Short .MAX_VALUE )
122+ .addGap (0 , 0 , Short .MAX_VALUE )
114123 .addComponent (ok )
115124 .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
116125 .addComponent (cancel ))
117- .addComponent (jScrollPane1 )
126+ .addComponent (jScrollPane1 , javax . swing . GroupLayout . DEFAULT_SIZE , 538 , Short . MAX_VALUE )
118127 .addGroup (layout .createSequentialGroup ()
119- .addComponent (jLabel1 )
128+ .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .LEADING )
129+ .addComponent (jLabel1 )
130+ .addComponent (unofficialListURLLabel ))
120131 .addGap (0 , 0 , Short .MAX_VALUE )))
121132 .addContainerGap ())
122133 );
@@ -126,12 +137,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
126137 .addContainerGap ()
127138 .addComponent (jLabel1 )
128139 .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
129- .addComponent (jScrollPane1 , javax .swing .GroupLayout .DEFAULT_SIZE , 118 , Short .MAX_VALUE )
140+ .addComponent (jScrollPane1 , javax .swing .GroupLayout .PREFERRED_SIZE , javax .swing .GroupLayout .DEFAULT_SIZE , javax .swing .GroupLayout .PREFERRED_SIZE )
141+ .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
142+ .addComponent (unofficialListURLLabel )
130143 .addPreferredGap (javax .swing .LayoutStyle .ComponentPlacement .RELATED )
131144 .addGroup (layout .createParallelGroup (javax .swing .GroupLayout .Alignment .BASELINE )
132- .addComponent (cancel )
133- .addComponent (ok ))
134- .addContainerGap ())
145+ .addComponent (ok )
146+ .addComponent (cancel ))
147+ .addContainerGap (javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ))
135148 );
136149
137150 pack ();
@@ -147,24 +160,26 @@ private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:even
147160 cancelActionPerformed (evt );
148161 }//GEN-LAST:event_okActionPerformed
149162
163+ private void unofficialListURLLabelMouseEntered (java .awt .event .MouseEvent evt ) {//GEN-FIRST:event_unofficialListURLLabelMouseEntered
164+ unofficialListURLLabel .setForeground (new Color (0 , 0 , 140 ));
165+ }//GEN-LAST:event_unofficialListURLLabelMouseEntered
166+
167+ private void unofficialListURLLabelMouseExited (java .awt .event .MouseEvent evt ) {//GEN-FIRST:event_unofficialListURLLabelMouseExited
168+ unofficialListURLLabel .setForeground (new Color (76 , 76 , 76 ));
169+ }//GEN-LAST:event_unofficialListURLLabelMouseExited
170+
171+ private void unofficialListURLLabelMouseClicked (java .awt .event .MouseEvent evt ) {//GEN-FIRST:event_unofficialListURLLabelMouseClicked
172+ Base .openURL ("https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls" );
173+ }//GEN-LAST:event_unofficialListURLLabelMouseClicked
174+
150175 public void setText (String text ) {
151176 Collection <String > urls = splitAndTrim (text , "," );
152177 additionalBoardsManagerURLs .setText (Joiner .on ("\n " ).skipNulls ().join (urls ));
153178 }
154179
155180 private Collection <String > splitAndTrim (String text , String separator ) {
156181 Collection <String > urls = Arrays .asList (text .split (separator ));
157- return FluentIterable .from (urls ).transform (new Function <String , String >() {
158- @ Override
159- public String apply (String input ) {
160- return input .trim ();
161- }
162- }).filter (new Predicate <String >() {
163- @ Override
164- public boolean apply (String input ) {
165- return !input .isEmpty ();
166- }
167- }).toList ();
182+ return FluentIterable .from (urls ).transform (String ::trim ).filter (url -> !url .isEmpty ()).toList ();
168183 }
169184
170185 public String getText () {
@@ -174,6 +189,7 @@ public String getText() {
174189
175190 // Variables declaration - do not modify//GEN-BEGIN:variables
176191 private final javax .swing .JTextArea additionalBoardsManagerURLs = new javax .swing .JTextArea ();
192+ private javax .swing .JLabel unofficialListURLLabel ;
177193 // End of variables declaration//GEN-END:variables
178194
179195 public void onOk (ActionListener listener ) {
0 commit comments