diff --git a/src/audio/AudioChannelPanel.java b/src/audio/AudioChannelPanel.java index 2181d093..8d659173 100644 --- a/src/audio/AudioChannelPanel.java +++ b/src/audio/AudioChannelPanel.java @@ -90,7 +90,8 @@ public class AudioChannelPanel extends JPanel private void init() { - setLayout(new MigLayout("align center center, insets 0 0 0 0", "[][][align right]0[grow,fill]", "")); + setLayout(new MigLayout("align center center, insets 0 0 0 0", + "[][][align right]0[grow,fill]", "")); setBackground(mBackgroundColor); mMutedLabel.setFont(mFont); @@ -109,7 +110,7 @@ public class AudioChannelPanel extends JPanel mTo.setFont(mFont); mTo.setForeground(mValueColor); - add(mTo); + add(mTo,"wmin 10lp"); } @Override @@ -159,30 +160,40 @@ public class AudioChannelPanel extends JPanel * does not occur on the Swing event thread -- wrap any calls to this * method with an event thread call. */ - private void updateLabel(JLabel valueLabel, String value, JLabel aliasLabel, Alias alias) + private void updateLabel(JLabel textLabel, String value, JLabel iconLabel, Alias alias) { if(value != null) { if(alias != null) { - valueLabel.setText(alias.getName()); - aliasLabel.setIcon(mIconManager.getIcon(alias.getIconName(), 18)); + iconLabel.setIcon(mIconManager.getIcon(alias.getIconName(), 18)); + + String aliasName = alias.getName(); + + //Truncate label if length exceeds 33 characters - hack! + if(aliasName.length() > 33) + { + textLabel.setText(aliasName.substring(0,30) + "..."); + } + else + { + textLabel.setText(aliasName); + } } else { - valueLabel.setText(value); - aliasLabel.setIcon(null); + iconLabel.setIcon(null); + textLabel.setText(value); } } else { - valueLabel.setText("-----"); - aliasLabel.setIcon(null); + iconLabel.setIcon(null); + textLabel.setText("-----"); } } - /** * Processes audio metadata to update this panel's display values */ diff --git a/src/audio/AudioChannelsPanel.java b/src/audio/AudioChannelsPanel.java index b2d94fb6..ebfc1b9b 100644 --- a/src/audio/AudioChannelsPanel.java +++ b/src/audio/AudioChannelsPanel.java @@ -33,8 +33,7 @@ public class AudioChannelsPanel extends JPanel public AudioChannelsPanel(IconManager iconManager, SettingsManager settingsManager, IAudioController controller) { -// setLayout(new MigLayout("insets 0 0 0 0", "[][grow,fill][][grow,fill]", "[grow,fill]")); - setLayout(new MigLayout("insets 0 0 0 0", "[][sg,grow,fill][][sg,grow,fill]", "[grow,fill]")); + setLayout(new MigLayout("insets 0 0 0 0", "[][sg abc,grow,fill][][sg abc,grow,fill]", "[grow,fill]")); setBackground(Color.BLACK); @@ -44,7 +43,7 @@ public class AudioChannelsPanel extends JPanel for(int x = 0; x < outputs.size(); x++) { - add(new AudioChannelPanel(iconManager, settingsManager, outputs.get(x)), "growx"); + add(new AudioChannelPanel(iconManager, settingsManager, outputs.get(x))); if(x < outputs.size() - 1) {