Updated buttons to be focusless and added red to background of mic toggle button
This commit is contained in:
@@ -71,8 +71,8 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
JSpinner postSentenceGap;
|
JSpinner postSentenceGap;
|
||||||
JCheckBox locked;
|
JCheckBox locked;
|
||||||
|
|
||||||
JButton reprocessAudioFFT;
|
JButtonSpacePlay reprocessAudioFFT;
|
||||||
JButton reprocessAudioPeak;
|
JButtonSpacePlay reprocessAudioPeak;
|
||||||
|
|
||||||
Thread playingThread = null;
|
Thread playingThread = null;
|
||||||
|
|
||||||
@@ -317,9 +317,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
|
|
||||||
sampleControl.add(sampleWaveform, BorderLayout.CENTER);
|
sampleControl.add(sampleWaveform, BorderLayout.CENTER);
|
||||||
|
|
||||||
reprocessAudioFFT = new JButton(Icons.fft);
|
reprocessAudioFFT = new JButtonSpacePlay(Icons.fft, "Autotrim Audio (FFT)", new ActionListener() {
|
||||||
reprocessAudioFFT.setToolTipText("Autotrim Audio (FFT)");
|
|
||||||
reprocessAudioFFT.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedSentence != null) {
|
if (selectedSentence != null) {
|
||||||
selectedSentence.autoTrimSampleFFT();
|
selectedSentence.autoTrimSampleFFT();
|
||||||
@@ -331,9 +329,7 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
reprocessAudioPeak = new JButton(Icons.peak);
|
reprocessAudioPeak = new JButtonSpacePlay(Icons.peak, "Autotrim Audio (Peak)", new ActionListener() {
|
||||||
reprocessAudioPeak.setToolTipText("Autotrim Audio (Peak)");
|
|
||||||
reprocessAudioPeak.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (selectedSentence != null) {
|
if (selectedSentence != null) {
|
||||||
selectedSentence.autoTrimSamplePeak();
|
selectedSentence.autoTrimSamplePeak();
|
||||||
@@ -397,18 +393,14 @@ public class AudiobookRecorder extends JFrame {
|
|||||||
controlsTop.add(Box.createHorizontalGlue());
|
controlsTop.add(Box.createHorizontalGlue());
|
||||||
|
|
||||||
|
|
||||||
JButton zoomIn = new JButton(Icons.zoomIn);
|
JButtonSpacePlay zoomIn = new JButtonSpacePlay(Icons.zoomIn, "Zoom In", new ActionListener() {
|
||||||
zoomIn.setToolTipText("Zoom In");
|
|
||||||
zoomIn.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
sampleWaveform.increaseZoom();
|
sampleWaveform.increaseZoom();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
controlsRight.add(zoomIn);
|
controlsRight.add(zoomIn);
|
||||||
|
|
||||||
JButton zoomOut = new JButton(Icons.zoomOut);
|
JButtonSpacePlay zoomOut = new JButtonSpacePlay(Icons.zoomOut, "Zoom Out", new ActionListener() {
|
||||||
zoomOut.setToolTipText("Zoom Out");
|
|
||||||
zoomOut.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
sampleWaveform.decreaseZoom();
|
sampleWaveform.decreaseZoom();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,14 +97,23 @@ public class MainToolBar extends JToolBar {
|
|||||||
addSeparator();
|
addSeparator();
|
||||||
|
|
||||||
mic = new JToggleButtonSpacePlay(Icons.mic, "Enable / disable microphone", new ActionListener() {
|
mic = new JToggleButtonSpacePlay(Icons.mic, "Enable / disable microphone", new ActionListener() {
|
||||||
|
Color bgCol = null;
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JToggleButton b = (JToggleButton)e.getSource();
|
JToggleButton b = (JToggleButton)e.getSource();
|
||||||
if (b.isSelected()) {
|
if (b.isSelected()) {
|
||||||
if (!root.enableMicrophone()) {
|
if (!root.enableMicrophone()) {
|
||||||
b.setSelected(false);
|
b.setSelected(false);
|
||||||
|
} else {
|
||||||
|
if (bgCol == null) {
|
||||||
|
bgCol = b.getBackground();
|
||||||
|
}
|
||||||
|
b.setBackground(Color.RED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
root.disableMicrophone();
|
root.disableMicrophone();
|
||||||
|
if (bgCol != null) {
|
||||||
|
b.setBackground(bgCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user