@@ -101,9 +101,10 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings)
101
101
int maxFreq = 7250 ;
102
102
int freqStep = 1 ;
103
103
104
- JPanel panelMainSettings = new JPanel (new MigLayout ("" , "[123.00px,grow,leading]" , "[][][::0px][][]" ));
104
+ JPanel panelMainSettings = new JPanel (new MigLayout ("" , "[123.00px,grow,leading]" , "[][][::0px][][][][] " ));
105
105
panelMainSettings .setBorder (new EmptyBorder (UIManager .getInsets ("TabbedPane.tabAreaInsets" )));;
106
106
panelMainSettings .setBackground (Color .BLACK );
107
+
107
108
JLabel lblNewLabel = new JLabel ("Frequency start [MHz]" );
108
109
lblNewLabel .setForeground (Color .WHITE );
109
110
panelMainSettings .add (lblNewLabel , "cell 0 0,growx,aligny center" );
@@ -123,24 +124,22 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings)
123
124
txtHackrfConnected .setText ("HackRF disconnected" );
124
125
txtHackrfConnected .setForeground (Color .WHITE );
125
126
txtHackrfConnected .setBackground (Color .BLACK );
126
- panelMainSettings .add (txtHackrfConnected , "cell 0 23,growx" );
127
127
txtHackrfConnected .setBorder (null );
128
+ panelMainSettings .add (txtHackrfConnected , "cell 0 5,growx" );
128
129
129
130
btnPause = new JButton ("Pause" );
130
- panelMainSettings .add (btnPause , "cell 0 25,growx" );
131
131
btnPause .setBackground (Color .black );
132
+ panelMainSettings .add (btnPause , "cell 0 6,growx" );
132
133
133
134
134
-
135
-
136
- JTabbedPane tabbedPane = new JTabbedPane (JTabbedPane .TOP );
137
135
setLayout (new BorderLayout ());
136
+ JTabbedPane tabbedPane = new JTabbedPane (JTabbedPane .TOP );
138
137
add (panelMainSettings , BorderLayout .NORTH );
139
138
add (tabbedPane , BorderLayout .CENTER );
140
139
tabbedPane .setForeground (Color .WHITE );
141
140
tabbedPane .setBackground (Color .BLACK );
142
141
143
- JPanel tab1 = new JPanel (new MigLayout ("" , "[123.00px,grow,leading]" , "[][][0][][][0][][][0][][][0][][][0][][0][][grow,fill]" ));
142
+ JPanel tab1 = new JPanel (new MigLayout ("" , "[123.00px,grow,leading]" , "[][][0][][][0][][][0][][][0][][][0][][0][][][][ grow,fill]" ));
144
143
tab1 .setForeground (Color .WHITE );
145
144
tab1 .setBackground (Color .BLACK );
146
145
@@ -168,7 +167,7 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings)
168
167
sliderGain .setForeground (Color .WHITE );
169
168
tab1 .add (sliderGain , "flowy,cell 0 1,growx" );
170
169
171
- JLabel lbl_gainValue = new JLabel (hackRFSettings .getGain () + "dB" );
170
+ JLabel lbl_gainValue = new JLabel (hRF == null ? "0" : hRF .getGain () + "dB" );
172
171
lbl_gainValue .setForeground (Color .WHITE );
173
172
tab1 .add (lbl_gainValue , "cell 0 1,alignx right" );
174
173
@@ -217,8 +216,10 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings)
217
216
((ListEditor ) spinnerFFTBinHz .getEditor ()).getTextField ().setHorizontalAlignment (JTextField .RIGHT );
218
217
219
218
220
- hackRFSettings .getGain ().addListener ((gain ) -> lbl_gainValue .setText (String .format (" %ddB [LNA: %ddB VGA: %ddB]" ,
221
- gain , hackRFSettings .getGainLNA ().getValue (), hackRFSettings .getGainVGA ().getValue ())));
219
+ if (hRF != null ) {
220
+ hRF .getGain ().addListener ((gain ) -> lbl_gainValue .setText (String .format (" %ddB [LNA: %ddB VGA: %ddB]" ,
221
+ gain , hRF .getGainLNA ().getValue (), hRF .getGainVGA ().getValue ())));
222
+ }
222
223
223
224
224
225
JLabel lblNumberOfSamples = new JLabel ("Number of samples" );
@@ -246,7 +247,6 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings)
246
247
Label labelVersion = new Label ("Version: " +Version .version );
247
248
tab1 .add (labelVersion , "flowx,cell 0 17" );
248
249
249
-
250
250
JButton btnAbout = new JButton ("Visit homepage" );
251
251
btnAbout .addActionListener (e -> {
252
252
if (Desktop .isDesktopSupported ()) {
@@ -362,7 +362,7 @@ public HackRFSweepSettingsUI(HackRFSettings hackRFSettings)
362
362
tab2 .add (checkBoxWaterfallEnabled , "cell 0 0,alignx right" );
363
363
364
364
comboBoxDecayRate = new JComboBox (
365
- new Vector <>(IntStream .rangeClosed (hRF .getPersistentDisplayDecayRate ().getMin (), hRF .getPersistentDisplayDecayRate ().getMax ()).
365
+ new Vector <>(IntStream .rangeClosed (hRF != null ? hRF .getPersistentDisplayDecayRate ().getMin () : 0 , hRF != null ? hRF .getPersistentDisplayDecayRate ().getMax () : 1 ).
366
366
boxed ().collect (Collectors .toList ())));
367
367
tab2 .add (comboBoxDecayRate , "cell 0 16,alignx right" );
368
368
0 commit comments