Enables the media configuration dialog to listen to audio system and device changes even if the audio system combo box is disabled (via the AUDIO_SYSTEM_DISABLED_PROP portperty).

cusax-fix
Vincent Lucas 13 years ago
parent 0a45fefae1
commit 73687810cd

@ -358,85 +358,89 @@ private Component createBasicControls(final int type)
deviceAndPreviewPanel.add(preview, BorderLayout.CENTER);
}
}
else
{
final ActionListener deviceComboBoxActionListener
= new ActionListener()
final ActionListener deviceComboBoxActionListener
= new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
public void actionPerformed(ActionEvent event)
boolean revalidateAndRepaint = false;
for (int i = deviceAndPreviewPanel
.getComponentCount() - 1;
i >= 0;
i--)
{
boolean revalidateAndRepaint = false;
Component c = deviceAndPreviewPanel.getComponent(i);
for (int i = deviceAndPreviewPanel
.getComponentCount() - 1;
i >= 0;
i--)
if (c != devicePanel)
{
Component c = deviceAndPreviewPanel.getComponent(i);
if (c != devicePanel)
{
deviceAndPreviewPanel.remove(i);
revalidateAndRepaint = true;
}
deviceAndPreviewPanel.remove(i);
revalidateAndRepaint = true;
}
}
Component preview = null;
Component preview = null;
if ((deviceComboBox.getSelectedItem() != null)
&& deviceComboBox.isShowing())
{
preview = createPreview(type, deviceComboBox,
if ((deviceComboBox.getSelectedItem() != null)
&& (deviceComboBox.isShowing()
||
(type == DeviceConfigurationComboBoxModel.AUDIO
&& isAudioSystemComboDisabled)
)
)
{
preview = createPreview(type, deviceComboBox,
deviceAndPreviewPanel.getPreferredSize());
}
}
if (preview != null)
{
deviceAndPreviewPanel
.add(preview, BorderLayout.CENTER);
revalidateAndRepaint = true;
}
if (preview != null)
{
deviceAndPreviewPanel
.add(preview, BorderLayout.CENTER);
revalidateAndRepaint = true;
}
if (revalidateAndRepaint)
{
deviceAndPreviewPanel.revalidate();
deviceAndPreviewPanel.repaint();
}
if (revalidateAndRepaint)
{
deviceAndPreviewPanel.revalidate();
deviceAndPreviewPanel.repaint();
}
};
}
};
deviceComboBox.addActionListener(deviceComboBoxActionListener);
/*
* We have to initialize the controls to reflect the configuration
* at the time of creating this instance. Additionally, because the
* video preview will stop when it and its associated controls
* become unnecessary, we have to restart it when the mentioned
* controls become necessary again. We'll address the two goals
* described by pretending there's a selection in the video combo
* box when the combo box in question becomes displayable.
*/
deviceComboBox.addHierarchyListener(
new HierarchyListener()
deviceComboBox.addActionListener(deviceComboBoxActionListener);
/*
* We have to initialize the controls to reflect the configuration
* at the time of creating this instance. Additionally, because the
* video preview will stop when it and its associated controls
* become unnecessary, we have to restart it when the mentioned
* controls become necessary again. We'll address the two goals
* described by pretending there's a selection in the video combo
* box when the combo box in question becomes displayable.
*/
deviceComboBox.addHierarchyListener(
new HierarchyListener()
{
public void hierarchyChanged(HierarchyEvent event)
{
public void hierarchyChanged(HierarchyEvent event)
if ((event.getChangeFlags()
& HierarchyEvent.SHOWING_CHANGED)
!= 0)
{
if ((event.getChangeFlags()
& HierarchyEvent.SHOWING_CHANGED)
!= 0)
{
SwingUtilities.invokeLater(
new Runnable()
SwingUtilities.invokeLater(
new Runnable()
{
public void run()
{
public void run()
{
deviceComboBoxActionListener
.actionPerformed(null);
}
});
}
deviceComboBoxActionListener
.actionPerformed(null);
}
});
}
});
}
}
});
return deviceAndPreviewPanel;
}

Loading…
Cancel
Save