fix the smilies problem on mac

cusax-fix
Yana Stamcheva 20 years ago
parent d8a32a8eeb
commit dd548451e6

@ -11,6 +11,7 @@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
@ -68,14 +69,17 @@ public SmiliesSelectorBox(ArrayList imageList, ChatWindow chatWindow) {
Smiley smiley = (Smiley) this.imageList.get(i);
ChatToolbarButton imageButton = new ChatToolbarButton(
ImageLoader.getImage(smiley.getImageID()));
imageButton.setToolTipText(smiley.getSmileyStrings()[0]);
JMenuItem smileyItem = new JMenuItem (
new ImageIcon(ImageLoader.getImage(smiley.getImageID())));
smileyItem.setPreferredSize(new Dimension(28, 28));
smileyItem.setMargin(new Insets(2, -5, 2, 0));
smileyItem.setToolTipText(smiley.getSmileyStrings()[0]);
imageButton.addActionListener(this);
smileyItem.addActionListener(this);
this.selectorBox.add(imageButton);
this.selectorBox.add(smileyItem);
}
this.add(selectorBox);
@ -92,14 +96,34 @@ private void calculateGridDimensions(int itemsCount) {
this.gridColCount = (int) Math.round(itemsCount / gridRowCount);
}
/**
* Opens the smilies selector box.
*/
public void open()
{
this.selectorBox.doClick();
}
/**
* Returns TRUE if the selector box is opened, otherwise returns FALSE.
* @return TRUE if the selector box is opened, otherwise returns FALSE
*/
public boolean isMenuSelected()
{
if(selectorBox.isPopupMenuVisible())
return true;
return false;
}
/**
* Writes the symbol corresponding to a choosen smiley icon to the write
* message area at the end of the current text.
*/
public void actionPerformed(ActionEvent e) {
JButton imageButton = (JButton) e.getSource();
String buttonText = imageButton.getToolTipText();
public void actionPerformed(ActionEvent e)
{
JMenuItem smileyItem = (JMenuItem) e.getSource();
String buttonText = smileyItem.getToolTipText();
for (int i = 0; i < this.imageList.size(); i++) {
@ -117,24 +141,4 @@ public void actionPerformed(ActionEvent e) {
}
}
}
/**
* Opens the smilies selector box.
*/
public void open()
{
this.selectorBox.doClick();
}
/**
* Returns TRUE if the selector box is opened, otherwise returns FALSE.
* @return TRUE if the selector box is opened, otherwise returns FALSE
*/
public boolean isMenuSelected()
{
if(selectorBox.isPopupMenuVisible())
return true;
return false;
}
}

Loading…
Cancel
Save