This repository contains MadHelix itself, along with compiled libraries with its dependencies.
Clone
HTTPS:
git clone https://vervis.peers.community/repos/ZEkyo
SSH:
git clone USERNAME@vervis.peers.community:ZEkyo
Branches
Tags
OptionsPanel.java
/*
* UltrasonicHelix is a Java Swing-based GUI frontend for SoundHelix.
* Copyright (C) 2017 UltrasonicMadness
*
* 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 org.ultrasonicmadness.ultrasonichelix.panels;
// UltrasonicHelix imports
import org.ultrasonicmadness.ultrasonichelix.utils.PathUtils;
// AWT widgets
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
// Swing widgets
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class OptionsPanel extends JPanel {
// Labels and data entry fields
private JLabel songNameLabel;
private JTextField songNameEntry;
private JLabel styleLabel;
private JComboBox<String> styleChoice;
public OptionsPanel() {
// Set up labels and data entry fields
songNameLabel = new JLabel("Song name");
songNameEntry = new JTextField(24);
styleLabel = new JLabel("Style");
styleChoice = new JComboBox<>();
addButtons();
}
private void addButtons() {
// Get list of styles for the combo box.
String[] styleList = PathUtils.getStyles();
// Add styles to style choice combo box
for (String style : styleList) {
styleChoice.addItem(style);
}
// Set up layout
this.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.insets = new Insets(2, 2, 2, 2);
// Add song information
constraints.gridy = 0;
this.add(songNameLabel, constraints);
this.add(songNameEntry, constraints);
// Add style label
constraints.gridy = 1;
this.add(styleLabel, constraints);
this.add(styleChoice, constraints);
}
// The current song name entered in the text box. This may be different from the name of the song currently playing.
public String getCurrentSongName() {
return songNameEntry.getText();
}
// Refer to the comment above regarding song names, the same applies here with styles.
public String getCurrentStyleName() {
return styleChoice.getSelectedItem().toString();
}
}