Search in sources :

Example 1 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class IncomingCallUI method addButtons.

private void addButtons() {
    // Build Accept Button
    acceptButton = new RolloverButton("      " + PhoneRes.getIString("phone.accept"), PhoneRes.getImageIcon("TOASTER_ACCEPT_BUTTON"));
    acceptButton.setHorizontalTextPosition(JLabel.CENTER);
    acceptButton.setFont(new Font("Dialog", Font.BOLD, 11));
    acceptButton.setForeground(new Color(91, 175, 41));
    acceptButton.setMargin(new Insets(0, 0, 0, 0));
    // Build Reject Button
    rejectButton = new RolloverButton("      " + PhoneRes.getIString("phone.reject"), PhoneRes.getImageIcon("TOASTER_REJECT_BUTTON"));
    rejectButton.setHorizontalTextPosition(JLabel.CENTER);
    rejectButton.setFont(new Font("Dialog", Font.BOLD, 11));
    rejectButton.setForeground(new Color(153, 32, 10));
    rejectButton.setMargin(new Insets(0, 0, 0, 0));
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    panel.add(acceptButton, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    panel.add(rejectButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    add(panel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) RolloverButton(org.jivesoftware.spark.component.RolloverButton) Font(java.awt.Font)

Example 2 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class OutgoingCallUI method addButtons.

private void addButtons() {
    // Build Reject Button
    rejectButton = new RolloverButton("      " + PhoneRes.getIString("phone.hangup"), PhoneRes.getImageIcon("TOASTER_REJECT_BUTTON"));
    rejectButton.setHorizontalTextPosition(JLabel.CENTER);
    rejectButton.setFont(new Font("Dialog", Font.BOLD, 11));
    rejectButton.setForeground(new Color(153, 32, 10));
    rejectButton.setMargin(new Insets(0, 0, 0, 0));
    final JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    panel.add(rejectButton, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    add(panel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) RolloverButton(org.jivesoftware.spark.component.RolloverButton) Font(java.awt.Font)

Example 3 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class BookmarksUI method getServicePanel.

private JPanel getServicePanel() {
    final JPanel servicePanel = new JPanel();
    servicePanel.setOpaque(false);
    servicePanel.setLayout(new GridBagLayout());
    final JLabel serviceLabel = new JLabel();
    final RolloverButton addButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE));
    addButton.setToolTipText(Res.getString("message.add.conference.service"));
    final JTextField serviceField = new JTextField();
    servicePanel.add(serviceLabel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 2, 5), 0, 0));
    servicePanel.add(serviceField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 2, 5), 0, 0));
    servicePanel.add(addButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 2, 5), 0, 0));
    // Add resource utils
    ResourceUtils.resLabel(serviceLabel, serviceField, Res.getString("label.add.conference.service"));
    final Action conferenceAction = new AbstractAction() {

        private static final long serialVersionUID = 7973928300442518496L;

        @Override
        public void actionPerformed(ActionEvent e) {
            final String conferenceService = serviceField.getText();
            if (hasService(conferenceService)) {
                UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
                JOptionPane.showMessageDialog(null, Res.getString("message.service.already.exists"), Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
                serviceField.setText("");
            } else {
                final List<String> serviceList = new ArrayList<>();
                serviceField.setText(Res.getString("message.searching.please.wait"));
                serviceField.setEnabled(false);
                addButton.setEnabled(false);
                SwingWorker worker = new SwingWorker() {

                    DiscoverInfo discoInfo;

                    @Override
                    public Object construct() {
                        ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(SparkManager.getConnection());
                        try {
                            discoInfo = discoManager.discoverInfo(conferenceService);
                            for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) {
                                if ("conference".equals(identity.getCategory())) {
                                    serviceList.add(conferenceService);
                                    break;
                                } else if ("server".equals(identity.getCategory())) {
                                    try {
                                        Collection<String> services = getConferenceServices(conferenceService);
                                        for (String service : services) {
                                            serviceList.add(service);
                                        }
                                    } catch (Exception e1) {
                                        Log.error("Unable to load conference services in server.", e1);
                                    }
                                }
                            }
                        } catch (XMPPException | SmackException e1) {
                            Log.error("Error in disco discovery.", e1);
                        }
                        return true;
                    }

                    @Override
                    public void finished() {
                        if (discoInfo != null) {
                            for (String aServiceList : serviceList) {
                                if (!hasService(aServiceList)) {
                                    addServiceToList(aServiceList);
                                }
                            }
                            serviceField.setText("");
                            serviceField.setEnabled(true);
                            addButton.setEnabled(true);
                        } else {
                            UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
                            JOptionPane.showMessageDialog(SparkManager.getMainWindow(), Res.getString("message.conference.service.error"), Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
                            serviceField.setText("");
                            serviceField.setEnabled(true);
                            addButton.setEnabled(true);
                        }
                    }
                };
                worker.start();
            }
        }
    };
    addButton.addActionListener(conferenceAction);
    serviceField.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyChar() == KeyEvent.VK_ENTER) {
                conferenceAction.actionPerformed(null);
            }
        }
    });
    return servicePanel;
}
Also used : RolloverButton(org.jivesoftware.spark.component.RolloverButton) DiscoverInfo(org.jivesoftware.smackx.disco.packet.DiscoverInfo) SmackException(org.jivesoftware.smack.SmackException) SmackException(org.jivesoftware.smack.SmackException) XMPPException(org.jivesoftware.smack.XMPPException) ServiceDiscoveryManager(org.jivesoftware.smackx.disco.ServiceDiscoveryManager) SwingWorker(org.jivesoftware.spark.util.SwingWorker) XMPPException(org.jivesoftware.smack.XMPPException)

Example 4 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class ButtonFactory method createSettingsButton.

public RolloverButton createSettingsButton() {
    RolloverButton settings = new RolloverButton(SparkRes.getImageIcon(SparkRes.SETTINGS_IMAGE_16x16));
    settings.setToolTipText(Res.getString("title.configure.room"));
    return settings;
}
Also used : RolloverButton(org.jivesoftware.spark.component.RolloverButton)

Example 5 with RolloverButton

use of org.jivesoftware.spark.component.RolloverButton in project Spark by igniterealtime.

the class ButtonFactory method createAlwaysOnTop.

public RolloverButton createAlwaysOnTop(boolean isAlwaysOnTopActive) {
    RolloverButton alwaysOnTopItem = new RolloverButton();
    if (isAlwaysOnTopActive) {
        alwaysOnTopItem.setIcon(SparkRes.getImageIcon("FRAME_ALWAYS_ON_TOP_ACTIVE"));
    } else {
        alwaysOnTopItem.setIcon(SparkRes.getImageIcon("FRAME_ALWAYS_ON_TOP_DEACTIVE"));
    }
    alwaysOnTopItem.setToolTipText(Res.getString("menuitem.always.on.top"));
    return alwaysOnTopItem;
}
Also used : RolloverButton(org.jivesoftware.spark.component.RolloverButton)

Aggregations

RolloverButton (org.jivesoftware.spark.component.RolloverButton)25 JPanel (javax.swing.JPanel)12 GridBagConstraints (java.awt.GridBagConstraints)11 GridBagLayout (java.awt.GridBagLayout)11 Insets (java.awt.Insets)11 Font (java.awt.Font)7 Color (java.awt.Color)6 JLabel (javax.swing.JLabel)6 BorderLayout (java.awt.BorderLayout)4 JScrollPane (javax.swing.JScrollPane)4 SmackException (org.jivesoftware.smack.SmackException)4 XMPPException (org.jivesoftware.smack.XMPPException)4 FlowLayout (java.awt.FlowLayout)3 ActionEvent (java.awt.event.ActionEvent)3 JTextField (javax.swing.JTextField)3 Dimension (java.awt.Dimension)2 ActionListener (java.awt.event.ActionListener)2 KeyEvent (java.awt.event.KeyEvent)2 MouseEvent (java.awt.event.MouseEvent)2 Collection (java.util.Collection)2