javax.swing.JToggleButton.ToggleButtonModel Java Examples

The following examples show how to use javax.swing.JToggleButton.ToggleButtonModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JWSProjectProperties.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initRadioButtons() {
    
    applicationDescButtonModel = new ToggleButtonModel();
    appletDescButtonModel = new ToggleButtonModel();
    compDescButtonModel = new ToggleButtonModel();
    bg = new ButtonGroup();
    applicationDescButtonModel.setGroup(bg);
    appletDescButtonModel.setGroup(bg);
    compDescButtonModel.setGroup(bg);
    
    String desc = evaluator.getProperty(JNLP_DESCRIPTOR);
    if (desc != null) {
        if (desc.equals(DescType.application.toString())) {
            applicationDescButtonModel.setSelected(true);
        } else if (desc.equals(DescType.applet.toString())) {
            appletDescButtonModel.setSelected(true);
        } else if (desc.equals(DescType.component.toString())) {
            compDescButtonModel.setSelected(true);
        }
    } else {
        applicationDescButtonModel.setSelected(true);
    }

}
 
Example #2
Source File: AudioScopeProbe.java    From jsyn with Apache License 2.0 5 votes vote down vote up
public AudioScopeProbe(AudioScopeModel audioScopeModel, UnitOutputPort source, int partIndex) {
    this.audioScopeModel = audioScopeModel;
    this.source = source;
    this.partIndex = partIndex;

    verticalScaleModel = new ExponentialRangeModel("VScale", 1000, MIN_RANGE, MAX_RANGE,
            MIN_RANGE);
    autoScaleButtonModel = new ToggleButtonModel();
    autoScaleButtonModel.setSelected(true);
}
 
Example #3
Source File: ScopeProbePanel.java    From jsyn with Apache License 2.0 5 votes vote down vote up
public ScopeProbePanel(AudioScopeProbeView probeView) {
    this.audioScopeProbeView = probeView;
    setLayout(new BorderLayout());

    setBorder(BorderFactory.createLineBorder(Color.GRAY, 3));

    // Add a colored box to match the waveform color.
    JPanel colorPanel = new JPanel();
    colorPanel.setMinimumSize(new Dimension(40, 40));
    audioScopeProbe = probeView.getModel();
    colorPanel.setBackground(audioScopeProbe.getColor());
    add(colorPanel, BorderLayout.NORTH);

    // Knob for tweaking vertical range.
    verticalScaleKnob = new RotaryTextController(audioScopeProbeView.getWaveTraceView()
            .getVerticalRangeModel(), 5);
    add(verticalScaleKnob, BorderLayout.CENTER);
    verticalScaleKnob.setTitle("YScale");

    // Auto ranging checkbox.
    autoBox = new JCheckBox("Auto");
    autoScaleModel = audioScopeProbeView.getWaveTraceView().getAutoButtonModel();
    autoScaleModel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ToggleButtonModel model = (ToggleButtonModel) e.getSource();
            boolean enabled = !model.isSelected();
            System.out.println("Knob enabled = " + enabled);
            verticalScaleKnob.setEnabled(!model.isSelected());
        }
    });
    autoBox.setModel(autoScaleModel);
    add(autoBox, BorderLayout.SOUTH);

    verticalScaleKnob.setEnabled(!autoScaleModel.isSelected());

    setMinimumSize(new Dimension(80, 100));
    setPreferredSize(new Dimension(80, 150));
    setMaximumSize(new Dimension(120, 200));
}
 
Example #4
Source File: AudioScopeProbe.java    From jsyn with Apache License 2.0 5 votes vote down vote up
public AudioScopeProbe(AudioScopeModel audioScopeModel, UnitOutputPort source, int partIndex) {
    this.audioScopeModel = audioScopeModel;
    this.source = source;
    this.partIndex = partIndex;

    verticalScaleModel = new ExponentialRangeModel("VScale", 1000, MIN_RANGE, MAX_RANGE,
            MIN_RANGE);
    autoScaleButtonModel = new ToggleButtonModel();
    autoScaleButtonModel.setSelected(true);
}
 
Example #5
Source File: ScopeProbePanel.java    From jsyn with Apache License 2.0 5 votes vote down vote up
public ScopeProbePanel(AudioScopeProbeView probeView) {
    this.audioScopeProbeView = probeView;
    setLayout(new BorderLayout());

    setBorder(BorderFactory.createLineBorder(Color.GRAY, 3));

    // Add a colored box to match the waveform color.
    JPanel colorPanel = new JPanel();
    colorPanel.setMinimumSize(new Dimension(40, 40));
    audioScopeProbe = probeView.getModel();
    colorPanel.setBackground(audioScopeProbe.getColor());
    add(colorPanel, BorderLayout.NORTH);

    // Knob for tweaking vertical range.
    verticalScaleKnob = new RotaryTextController(audioScopeProbeView.getWaveTraceView()
            .getVerticalRangeModel(), 5);
    add(verticalScaleKnob, BorderLayout.CENTER);
    verticalScaleKnob.setTitle("YScale");

    // Auto ranging checkbox.
    autoBox = new JCheckBox("Auto");
    autoScaleModel = audioScopeProbeView.getWaveTraceView().getAutoButtonModel();
    autoScaleModel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ToggleButtonModel model = (ToggleButtonModel) e.getSource();
            boolean enabled = !model.isSelected();
            System.out.println("Knob enabled = " + enabled);
            verticalScaleKnob.setEnabled(!model.isSelected());
        }
    });
    autoBox.setModel(autoScaleModel);
    add(autoBox, BorderLayout.SOUTH);

    verticalScaleKnob.setEnabled(!autoScaleModel.isSelected());

    setMinimumSize(new Dimension(80, 100));
    setPreferredSize(new Dimension(80, 150));
    setMaximumSize(new Dimension(120, 200));
}
 
Example #6
Source File: AudioScopeProbe.java    From jsyn with Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoScaleButtonModel() {
    return autoScaleButtonModel;
}
 
Example #7
Source File: WaveTraceView.java    From jsyn with Apache License 2.0 4 votes vote down vote up
public WaveTraceView(ToggleButtonModel autoButtonModel, ExponentialRangeModel verticalRangeModel) {
    this.verticalScaleModel = verticalRangeModel;
    this.autoScaleButtonModel = autoButtonModel;
}
 
Example #8
Source File: WaveTraceView.java    From jsyn with Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoButtonModel() {
    return autoScaleButtonModel;
}
 
Example #9
Source File: AudioScopeProbe.java    From jsyn with Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoScaleButtonModel() {
    return autoScaleButtonModel;
}
 
Example #10
Source File: WaveTraceView.java    From jsyn with Apache License 2.0 4 votes vote down vote up
public WaveTraceView(ToggleButtonModel autoButtonModel, ExponentialRangeModel verticalRangeModel) {
    this.verticalScaleModel = verticalRangeModel;
    this.autoScaleButtonModel = autoButtonModel;
}
 
Example #11
Source File: WaveTraceView.java    From jsyn with Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoButtonModel() {
    return autoScaleButtonModel;
}