This repository contains MadHelix itself, along with compiled libraries with its dependencies.

[[ 🗃 ^ZEkyo madhelix ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/ZEkyo

SSH: git clone USERNAME@vervis.peers.community:ZEkyo

Branches

Tags

v0.0.2 :: src / org / ultrasonicmadness / ultrasonichelix / panels /

StatusPanel.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;

// AWT widgets
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

// Swing widgets
import javax.swing.JLabel;
import javax.swing.JPanel;

public class StatusPanel extends JPanel {
    // Declare labels
    private JLabel playStatus;
    private JLabel playStatusInfo;
    private JLabel styleStatus;
    private JLabel styleStatusInfo;
    
    public StatusPanel() {
        // Initialize labels with a space as there were layout problems when initializing with empty strings
        playStatus = new JLabel(" ");
        playStatusInfo = new JLabel(" ");
        styleStatus = new JLabel(" ");
        styleStatusInfo = new JLabel(" ");
        
        addButtons();
    }
    
    private void addButtons() {
        // Set up layout
        this.setLayout(new GridBagLayout());
        
        GridBagConstraints constraints = new GridBagConstraints();
        constraints.insets = new Insets(2, 2, 2, 2);
        constraints.fill = GridBagConstraints.HORIZONTAL;

        // Add the labels to the panel
        constraints.gridy = 0;
        constraints.weightx = 0;
        this.add(playStatus, constraints);

        constraints.weightx = 1;
        this.add(playStatusInfo, constraints);

        constraints.gridy = 1;
        constraints.weightx = 0;
        this.add(styleStatus, constraints);

        constraints.weightx = 1;
        this.add(styleStatusInfo, constraints);
    }
    
    // Set status to the four passed strings
    public void setStatus(String newPlayStatus, String newPlayStatusInfo,
        String newStyleStatus, String newStyleStatusInfo) {
        
        // Set all label text to the passed strings.
        playStatus.setText(newPlayStatus);
        playStatusInfo.setText(newPlayStatusInfo);
        styleStatus.setText(newStyleStatus);
        styleStatusInfo.setText(newStyleStatusInfo);
    }
    
    // Set status to the passed string. The others are reset to blank.
    public void setStatus(String newPlayStatus) {
        setStatus(newPlayStatus, " ", " ", " ");
    }
}


[See repo JSON]