message window toolbars

cusax-fix
Yana Stamcheva 20 years ago
parent f7a63ae302
commit 20d945ef42

@ -1,3 +1,10 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main.message.toolBars;
import java.awt.Dimension;
@ -8,33 +15,35 @@
import javax.swing.JToolBar;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommToolBar;
public class EditTextToolBar extends JToolBar {
public class EditTextToolBar extends SIPCommToolBar {
private SIPCommButton textBoldButton
= new SIPCommButton(Constants.TEXT_BOLD_BUTTON,
Constants.TEXT_BOLD_ROLLOVER_BUTTON);
= new SIPCommButton(ImageLoader.getImage(ImageLoader.TEXT_BOLD_BUTTON),
ImageLoader.getImage(ImageLoader.TEXT_BOLD_ROLLOVER_BUTTON));
private SIPCommButton textItalicButton
= new SIPCommButton(Constants.TEXT_ITALIC_BUTTON,
Constants.TEXT_ITALIC_ROLLOVER_BUTTON);
= new SIPCommButton(ImageLoader.getImage(ImageLoader.TEXT_ITALIC_BUTTON),
ImageLoader.getImage(ImageLoader.TEXT_ITALIC_ROLLOVER_BUTTON));
private SIPCommButton textUnderlinedButton
= new SIPCommButton(Constants.TEXT_UNDERLINED_BUTTON,
Constants.TEXT_UNDERLINED_ROLLOVER_BUTTON);
= new SIPCommButton(ImageLoader.getImage(ImageLoader.TEXT_UNDERLINED_BUTTON),
ImageLoader.getImage(ImageLoader.TEXT_UNDERLINED_ROLLOVER_BUTTON));
private SIPCommButton alignLeftButton
= new SIPCommButton(Constants.ALIGN_LEFT_BUTTON,
Constants.ALIGN_LEFT_ROLLOVER_BUTTON);
= new SIPCommButton(ImageLoader.getImage(ImageLoader.ALIGN_LEFT_BUTTON),
ImageLoader.getImage(ImageLoader.ALIGN_LEFT_ROLLOVER_BUTTON));
private SIPCommButton alignRightButton
= new SIPCommButton(Constants.ALIGN_RIGHT_BUTTON,
Constants.ALIGN_RIGHT_ROLLOVER_BUTTON);
= new SIPCommButton(ImageLoader.getImage(ImageLoader.ALIGN_RIGHT_BUTTON),
ImageLoader.getImage(ImageLoader.ALIGN_RIGHT_ROLLOVER_BUTTON));
private SIPCommButton alignCenterButton
= new SIPCommButton(Constants.ALIGN_CENTER_BUTTON,
Constants.ALIGN_CENTER_ROLLOVER_BUTTON);
= new SIPCommButton(ImageLoader.getImage(ImageLoader.ALIGN_CENTER_BUTTON),
ImageLoader.getImage(ImageLoader.ALIGN_CENTER_ROLLOVER_BUTTON));
private JComboBox fontSizeCombo = new JComboBox();

@ -1,58 +1,70 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main.message.toolBars;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JToolBar;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.customcontrols.MsgToolbarButton;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommToolBar;
import net.java.sip.communicator.impl.gui.main.history.HistoryWindow;
import net.java.sip.communicator.impl.gui.main.message.MessageWindow;
import net.java.sip.communicator.impl.gui.main.message.SmiliesSelectorBox;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
public class MainToolBar extends JToolBar
public class MainToolBar extends SIPCommToolBar
implements ActionListener {
private MsgToolbarButton copyButton
= new MsgToolbarButton(Constants.COPY_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.COPY_ICON));
private MsgToolbarButton cutButton
= new MsgToolbarButton(Constants.CUT_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.CUT_ICON));
private MsgToolbarButton pasteButton
= new MsgToolbarButton(Constants.PASTE_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.PASTE_ICON));
private MsgToolbarButton smilyButton
= new MsgToolbarButton(Constants.SMILIES_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.SMILIES_ICON));
private MsgToolbarButton saveButton
= new MsgToolbarButton(Constants.SAVE_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.SAVE_ICON));
private MsgToolbarButton printButton
= new MsgToolbarButton(Constants.PRINT_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.PRINT_ICON));
private MsgToolbarButton previousButton
= new MsgToolbarButton(Constants.PREVIOUS_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.PREVIOUS_ICON));
private MsgToolbarButton nextButton
= new MsgToolbarButton(Constants.NEXT_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.NEXT_ICON));
private MsgToolbarButton historyButton
= new MsgToolbarButton(Constants.HISTORY_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.HISTORY_ICON));
private MsgToolbarButton sendFileButton
= new MsgToolbarButton(Constants.SEND_FILE_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.SEND_FILE_ICON));
private MsgToolbarButton fontButton
= new MsgToolbarButton(Constants.FONT_ICON);
= new MsgToolbarButton(ImageLoader.getImage(ImageLoader.FONT_ICON));
private JLabel toolbarDivider = new JLabel(new ImageIcon
(Constants.TOOLBAR_DIVIDER));
(ImageLoader.getImage(ImageLoader.TOOLBAR_DIVIDER)));
private MessageWindow messageWindow;
@ -62,7 +74,7 @@ public MainToolBar (MessageWindow messageWindow){
this.setRollover(true);
this.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
this.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
this.setBorder(BorderFactory.createEmptyBorder(2, 2, 5, 2));
this.add(saveButton);
this.add(printButton);
@ -127,12 +139,40 @@ public void actionPerformed(ActionEvent e) {
} else if (buttonText.equalsIgnoreCase("cut")) {
JEditorPane editorPane = this.messageWindow.getWriteMessagePanel().getEditorPane();
editorPane.cut();
} else if (buttonText.equalsIgnoreCase("copy")) {
JEditorPane editorPane = this.messageWindow.getWriteMessagePanel().getEditorPane();
editorPane.copy();
} else if (buttonText.equalsIgnoreCase("paste")) {
JEditorPane editorPane = this.messageWindow.getWriteMessagePanel().getEditorPane();
editorPane.paste();
} else if (buttonText.equalsIgnoreCase("smily")) {
if (e.getSource() instanceof SIPCommButton){
SmiliesSelectorBox smiliesBox = new SmiliesSelectorBox(ImageLoader.getDefaultSmiliesPack());
if (!smiliesBox.isVisible()) {
smiliesBox.setInvoker((Component)e.getSource());
smiliesBox.setMessageWindow(this.messageWindow);
smiliesBox.setLocation(smiliesBox.getPopupLocation());
smiliesBox.setVisible(true);
}
}
} else if (buttonText.equalsIgnoreCase("previous")) {
} else if (buttonText.equalsIgnoreCase("next")) {

Loading…
Cancel
Save