mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
* Updates gradle to 5.1.1 * Updated to run application from intellij using installed Java 11. Resolves issues with Java 9 deprecations. * Updates gradle build dependencies and other deprecation issues. * Updates gradle to produce OS-specific builds. * Updates the beryx runtime plugin to 1.1.1 to resolve issue with zipping each of the target distributions. * Import cleanup * Resolves issue with Look and Feel error on Max OSX Resolves issue with building OSX package Resolves issue with excessive logging about JMBE library.
108 lines
3.1 KiB
Java
108 lines
3.1 KiB
Java
/*
|
|
* ******************************************************************************
|
|
* sdrtrunk
|
|
* Copyright (C) 2014-2019 Dennis Sheirer
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
* *****************************************************************************
|
|
*/
|
|
|
|
package io.github.dsheirer.spectrum.menu;
|
|
|
|
import io.github.dsheirer.dsp.filter.smoothing.SmoothingFilter;
|
|
import io.github.dsheirer.spectrum.SpectralDisplayAdjuster;
|
|
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JSlider;
|
|
import javax.swing.event.ChangeEvent;
|
|
import javax.swing.event.ChangeListener;
|
|
import java.awt.event.MouseEvent;
|
|
import java.awt.event.MouseListener;
|
|
import java.util.Hashtable;
|
|
|
|
public class SmoothingItem extends JSlider implements ChangeListener
|
|
{
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private SpectralDisplayAdjuster mAdjuster;
|
|
private int mDefaultValue;
|
|
|
|
public SmoothingItem(SpectralDisplayAdjuster adjuster, int defaultValue)
|
|
{
|
|
super(JSlider.HORIZONTAL,
|
|
SmoothingFilter.SMOOTHING_MINIMUM,
|
|
SmoothingFilter.SMOOTHING_MAXIMUM,
|
|
adjuster.getSmoothing());
|
|
|
|
mDefaultValue = defaultValue;
|
|
mAdjuster = adjuster;
|
|
|
|
setSnapToTicks(true);
|
|
setMajorTickSpacing(6);
|
|
setMinorTickSpacing(2);
|
|
setPaintTicks(true);
|
|
setPaintLabels(true);
|
|
|
|
Hashtable<Integer,JLabel> labels = new Hashtable<>();
|
|
labels.put(3, new JLabel("3"));
|
|
labels.put(9, new JLabel("9"));
|
|
labels.put(15, new JLabel("15"));
|
|
labels.put(21, new JLabel("21"));
|
|
labels.put(27, new JLabel("27"));
|
|
|
|
setLabelTable(labels);
|
|
|
|
addChangeListener(this);
|
|
|
|
addMouseListener(new MouseListener()
|
|
{
|
|
@Override
|
|
public void mouseClicked(MouseEvent event)
|
|
{
|
|
if(event.getClickCount() == 2)
|
|
{
|
|
SmoothingItem.this.setValue(mDefaultValue);
|
|
}
|
|
}
|
|
|
|
public void mouseReleased(MouseEvent arg0)
|
|
{
|
|
}
|
|
|
|
public void mousePressed(MouseEvent arg0)
|
|
{
|
|
}
|
|
|
|
public void mouseExited(MouseEvent arg0)
|
|
{
|
|
}
|
|
|
|
public void mouseEntered(MouseEvent arg0)
|
|
{
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override
|
|
public void stateChanged(ChangeEvent event)
|
|
{
|
|
int value = ((JSlider)event.getSource()).getValue();
|
|
|
|
if(value % 2 == 1)
|
|
{
|
|
mAdjuster.setSmoothing(value);
|
|
}
|
|
}
|
|
}
|