use of org.jivesoftware.sparkplugin.ui.components.ControlPanel in project Spark by igniterealtime.
the class NonRosterPanel method buildMiddlePanel.
/**
* Builds the Control Panel.
*
* @return the control panel.
*/
private JPanel buildMiddlePanel() {
// Add Control Panel
final JPanel mainPanel = new JPanel(new GridBagLayout()) {
private static final long serialVersionUID = 1571929852761037052L;
public Dimension getPreferredSize() {
final Dimension dim = super.getPreferredSize();
dim.height = 100;
return dim;
}
};
mainPanel.setOpaque(false);
// Add Input Volume To Control Panel
try {
final ControlPanel inputPanel = new ControlPanel(new GridBagLayout());
final JLabel inputIcon = new JLabel(PhoneRes.getImageIcon("MICROPHONE_IMAGE"));
inputPanel.add(mixer.getPrefferedInputVolume(), new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));
inputPanel.add(inputIcon, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
mainPanel.add(inputPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 1), 0, 0));
} catch (Exception e) {
Log.error(e);
}
try {
// Add Output Volume To Control Panel
final ControlPanel outputPanel = new ControlPanel(new GridBagLayout());
final JLabel outputIcon = new JLabel(PhoneRes.getImageIcon("SPEAKER_IMAGE"));
Component component = mixer.getPrefferedMasterVolume();
if (component != null)
outputPanel.add(component, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));
outputPanel.add(outputIcon, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
mainPanel.add(outputPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 5), 0, 0));
} catch (Exception e) {
Log.error(e);
}
// Build ControlPanel List
final JPanel controlPanel = new JPanel(new GridBagLayout());
controlPanel.setOpaque(false);
muteButton = new CallPanelButton(PhoneRes.getImageIcon("MUTE_IMAGE").getImage(), PhoneRes.getIString("phone.mute"));
muteButton.setToolTipText(PhoneRes.getIString("phone.tips.mute"));
controlPanel.add(muteButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
holdButton = new CallPanelButton(PhoneRes.getImageIcon("ON_HOLD_IMAGE").getImage(), PhoneRes.getIString("phone.hold"));
holdButton.setToolTipText(PhoneRes.getIString("phone.tips.hold"));
controlPanel.add(holdButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
transferButton = new CallPanelButton(PhoneRes.getImageIcon("TRANSFER_IMAGE").getImage(), PhoneRes.getIString("phone.transfer"));
transferButton.setToolTipText(PhoneRes.getIString("phone.tips.transfer"));
controlPanel.add(transferButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
// Add End Call button
hangUpButton = new EndCallButton();
redialButton = new RedialButton();
redialButton.setVisible(false);
// Add Components to Main Panel
mainPanel.add(controlPanel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 1, 2, 1), 0, 0));
mainPanel.add(hangUpButton, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 1, 2, 1), 0, 0));
mainPanel.add(redialButton, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 1, 2, 1), 0, 0));
return mainPanel;
}
use of org.jivesoftware.sparkplugin.ui.components.ControlPanel in project Spark by igniterealtime.
the class RosterMemberPanel method buildControlPanel.
/**
* Builds the Control Panel.
*
* @return the control panel.
*/
private JPanel buildControlPanel() {
// Add Control Panel
final JPanel mainPanel = new JPanel(new GridBagLayout());
mainPanel.setOpaque(false);
// Add Input Volume To Control Panel
try {
final ControlPanel inputPanel = new ControlPanel(new GridBagLayout());
final JLabel inputIcon = new JLabel(PhoneRes.getImageIcon("SPEAKER_IMAGE"));
inputPanel.add(javaMixer.getPrefferedMasterVolume(), new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));
inputPanel.add(inputIcon, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
mainPanel.add(inputPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.2, GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 1), 0, 0));
} catch (Exception e) {
Log.error(e);
}
// Add Output Volume To Control Panel
try {
final ControlPanel outputPanel = new ControlPanel(new GridBagLayout());
final JLabel outputIcon = new JLabel(PhoneRes.getImageIcon("MICROPHONE_IMAGE"));
outputPanel.add(javaMixer.getPrefferedInputVolume(), new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));
outputPanel.add(outputIcon, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
mainPanel.add(outputPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.2, GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(2, 1, 2, 1), 0, 0));
} catch (Exception e) {
Log.error(e);
}
// Build ControlPanel List
final ControlPanel controlPanel = new ControlPanel(new GridBagLayout());
final JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
sep.setBackground(new Color(219, 228, 238));
muteButton = new RosterMemberCallButton(PhoneRes.getImageIcon("MUTE_IMAGE").getImage(), PhoneRes.getIString("phone.mute"));
muteButton.setToolTipText(PhoneRes.getIString("phone.tips.mute"));
controlPanel.add(muteButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
controlPanel.add(sep, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
holdButton = new RosterMemberCallButton(PhoneRes.getImageIcon("ON_HOLD_IMAGE").getImage(), PhoneRes.getIString("phone.hold"));
holdButton.setToolTipText(PhoneRes.getIString("phone.tips.hold"));
controlPanel.add(holdButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
final JSeparator sep2 = new JSeparator(JSeparator.HORIZONTAL);
sep2.setBackground(new Color(219, 228, 238));
controlPanel.add(sep2, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
transferButton = new RosterMemberCallButton(PhoneRes.getImageIcon("TRANSFER_IMAGE").getImage(), PhoneRes.getIString("phone.transfer"));
transferButton.setToolTipText(PhoneRes.getIString("phone.tips.transfer"));
controlPanel.add(transferButton, new GridBagConstraints(0, 4, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
// Add Components to Main Panel
mainPanel.add(controlPanel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(2, 1, 2, 1), 0, 0));
// Add End Call button
hangUpButton = new RolloverButton(" " + PhoneRes.getIString("phone.hangup"), PhoneRes.getImageIcon("HANG_UP_PHONE_77x24_IMAGE"));
hangUpButton.setHorizontalTextPosition(JLabel.CENTER);
hangUpButton.setFont(new Font("Dialog", Font.BOLD, 11));
hangUpButton.setForeground(new Color(153, 32, 10));
hangUpButton.setMargin(new Insets(0, 0, 0, 0));
mainPanel.add(hangUpButton, new GridBagConstraints(0, 1, 3, 1, 0.0, 0.8, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
return mainPanel;
}
Aggregations