/** * Sets the mute status icon to the status panel. * * @param isMute indicates if the call with this peer is muted */ public void setMute(final boolean isMute) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater( new Runnable() { public void run() { setMute(isMute); } }); return; } if (isMute) { muteStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MUTE_STATUS_ICON))); muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3)); } else { muteStatusLabel.setIcon(null); muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } // Update input volume control button state to reflect the current // mute status. if (localLevel.isSelected() != isMute) localLevel.setSelected(isMute); this.revalidate(); this.repaint(); }
private void initComponents() { // Message - JLabel lblMessage = new JLabel( String.format( "An unexpected error has occurred: %s", e == null ? "Unexpected exception" : e.getMessage())); lblMessage.setIcon(icon); lblMessage.setPreferredSize(new Dimension(360, 40)); lblMessage.setBorder(BorderFactory.createLineBorder(Color.red)); // txtTrace - ExceptionTracePane txtTrace = new ExceptionTracePane(); txtTrace.setBackground(new Color(92, 0, 0)); txtTrace.setException(e); // srlTrace - JScrollPane JPanel traceWrapper = new JPanel(new BorderLayout()); traceWrapper.add(txtTrace, BorderLayout.CENTER); srlTrace = new JScrollPane(traceWrapper); srlTrace.setPreferredSize(new Dimension(360, 200)); srlTrace.setVisible(false); // btnDetails - JButton btnDetails = new JButton(new DetailsButtonAction()); btnDetails.setPreferredSize(new Dimension(100, 40)); // btnClose - JButton btnClose = new JButton(new CloseButtonAction()); btnClose.setDefaultCapable(true); btnClose.setPreferredSize(new Dimension(100, 40)); }
/** * used to manage the connection icons to signify connection and secure status * * @param b true if connected */ public void setConnected(boolean b) { if (b) { conIcon.setIcon(conYes); conIcon.setToolTipText("Connected"); secIcon.setIcon(secYes); secIcon.setToolTipText("Secure Connection"); butChannel.setEnabled(true); } else { conIcon.setIcon(conNo); conIcon.setToolTipText("Not Connected"); secIcon.setIcon(secNo); secIcon.setToolTipText("Connection not Secured"); butChannel.setEnabled(false); butCreate.setEnabled(false); butInvite.setEnabled(false); } }
/** Reloads all icons. */ public void loadSkin() { if (localLevel != null) localLevel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MICROPHONE))); if (remoteLevel != null && remoteLevel instanceof Skinnable) ((Skinnable) remoteLevel).loadSkin(); if (muteStatusLabel.getIcon() != null) muteStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MUTE_STATUS_ICON))); if (holdStatusLabel.getIcon() != null) holdStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.HOLD_STATUS_ICON))); securityStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(securityImageID))); if (peerImage == null) { photoLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.DEFAULT_USER_PHOTO))); } }
/** * Sets the "on hold" property value. * * @param isOnHold indicates if the call with this peer is put on hold */ public void setOnHold(final boolean isOnHold) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater( new Runnable() { public void run() { setOnHold(isOnHold); } }); return; } if (isOnHold) { holdStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.HOLD_STATUS_ICON))); holdStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3)); } else { holdStatusLabel.setIcon(null); holdStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } this.revalidate(); this.repaint(); }
/** * Set the image of the peer * * @param image new image */ public void setPeerImage(byte[] image) { // If the image is still null we try to obtain it from one of the // available contact sources. if (image == null || image.length <= 0) { GuiActivator.getContactList().setSourceContactImage(peerName, photoLabel, 100, 100); } else { peerImage = ImageUtils.getScaledRoundedIcon(image, 100, 100); if (peerImage == null) peerImage = getPhotoLabelIcon(); if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater( new Runnable() { public void run() { photoLabel.setIcon(peerImage); photoLabel.repaint(); } }); } else { photoLabel.setIcon(peerImage); photoLabel.repaint(); } } }
public FilterField() { super(""); filterLabel = new JLabel("Filter"); filterLabel.setFont(Toolkit.getSansFont(14, Font.PLAIN)); filterLabel.setOpaque(false); setFont(Toolkit.getSansFont(14, Font.PLAIN)); searchIcon = Toolkit.getLibIconX("manager/search"); filterLabel.setIcon(searchIcon); // searchIcon = new // ImageIcon(java.awt.Toolkit.getDefaultToolkit().getImage("NSImage://NSComputerTemplate")); setOpaque(false); // setBorder(BorderFactory.createMatteBorder(0, 33, 0, 0, searchIcon)); GroupLayout fl = new GroupLayout(this); setLayout(fl); fl.setHorizontalGroup(fl.createSequentialGroup().addComponent(filterLabel)); fl.setVerticalGroup( fl.createSequentialGroup() .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(filterLabel) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); filters = new ArrayList<String>(); addFocusListener( new FocusListener() { public void focusLost(FocusEvent focusEvent) { if (getText().isEmpty()) { // setBorder(BorderFactory.createMatteBorder(0, 33, 0, 0, searchIcon)); filterLabel.setVisible(true); } } public void focusGained(FocusEvent focusEvent) { // setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); filterLabel.setVisible(false); } }); getDocument() .addDocumentListener( new DocumentListener() { public void removeUpdate(DocumentEvent e) { applyFilter(); } public void insertUpdate(DocumentEvent e) { applyFilter(); } public void changedUpdate(DocumentEvent e) { applyFilter(); } }); }
public void loadImage(String filename) { theImage.setIcon(new MyImageIcon(filename)); }