Java Code Examples for javax.swing.JToggleButton.ToggleButtonModel

The following examples show how to use javax.swing.JToggleButton.ToggleButtonModel. These examples are extracted from open source projects. 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 Project: netbeans   Source File: JWSProjectProperties.java    License: 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 Project: jsyn   Source File: AudioScopeProbe.java    License: 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 Project: jsyn   Source File: ScopeProbePanel.java    License: 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 Project: jsyn   Source File: AudioScopeProbe.java    License: 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 Project: jsyn   Source File: ScopeProbePanel.java    License: 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 Project: jsyn   Source File: AudioScopeProbe.java    License: Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoScaleButtonModel() {
    return autoScaleButtonModel;
}
 
Example 7
Source Project: jsyn   Source File: WaveTraceView.java    License: 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 Project: jsyn   Source File: WaveTraceView.java    License: Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoButtonModel() {
    return autoScaleButtonModel;
}
 
Example 9
Source Project: jsyn   Source File: AudioScopeProbe.java    License: Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoScaleButtonModel() {
    return autoScaleButtonModel;
}
 
Example 10
Source Project: jsyn   Source File: WaveTraceView.java    License: 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 Project: jsyn   Source File: WaveTraceView.java    License: Apache License 2.0 4 votes vote down vote up
public ToggleButtonModel getAutoButtonModel() {
    return autoScaleButtonModel;
}