- set default chat write area font propertly

- provided smaller buttons for font operations
- changed the color label form
cusax-fix
Yana Stamcheva 18 years ago
parent c9dd164daa
commit 87f237a562

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 284 B

@ -74,6 +74,14 @@ public ChatWritePanel(ChatPanel panel)
this.chatPanel = panel;
this.editorPane.setContentType("text/html");
this.editorPane.setFont(Constants.FONT);
this.editorPane.setCaretPosition(0);
this.editorPane.setEditorKit(htmlEditor);
this.editorPane.getDocument().addUndoableEditListener(this);
this.editorPane.addKeyListener(this);
this.editorPane.addMouseListener(this);
this.editTextToolBar = new EditTextToolBar(editorPane);
this.add(editTextToolBar, BorderLayout.NORTH);
@ -85,14 +93,6 @@ public ChatWritePanel(ChatPanel panel)
this.scrollPane
.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
this.editorPane.setContentType("text/html");
this.editorPane.setFont(Constants.FONT);
this.editorPane.setCaretPosition(0);
this.editorPane.setEditorKit(htmlEditor);
this.editorPane.getDocument().addUndoableEditListener(this);
this.editorPane.addKeyListener(this);
this.editorPane.addMouseListener(this);
this.scrollPane.getViewport().add(editorPane, BorderLayout.CENTER);
this.scrollPane.setBorder(BorderFactory

@ -8,7 +8,6 @@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
@ -16,7 +15,6 @@
import javax.swing.text.html.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*;
/**
@ -31,12 +29,12 @@
public class EditTextToolBar
extends SIPCommToolBar
{
private JLabel colorLabel = new JLabel();
private ColorLabel colorLabel = new ColorLabel();
private String[] fontSizeConstants =
new String[]
{ "9", "10", "11", "12", "13", "14", "18", "24", "36", "48", "64",
"72", "96", "144", "288" };
private Integer[] fontSizeConstants =
new Integer[]
{ 9, 10, 11, 12, 13, 14, 18, 24, 36, 48, 64,
72, 96, 144, 288 };
private JComboBox fontSizeCombo = new JComboBox(fontSizeConstants);
@ -60,18 +58,13 @@ public EditTextToolBar(JEditorPane panel)
this.fontNameCombo = new JComboBox(getSystemFontFamilies());
this.fontSizeCombo.setEditable(true);
fontNameCombo.setSelectedItem(ApplicationProperties
.getProperty("fontName"));
fontSizeCombo.setSelectedItem(ApplicationProperties
.getProperty("fontSize"));
this.setRollover(true);
this.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
this.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
this.fontSizeCombo.setPreferredSize(new Dimension(55, 21));
this.fontSizeCombo.setPreferredSize(new Dimension(50, 21));
colorLabel.setPreferredSize(new Dimension(25, 25));
colorLabel.setPreferredSize(new Dimension(21, 21));
this.initToolbarButtons();
@ -111,12 +104,12 @@ public void actionPerformed(ActionEvent e)
new ActionEvent(chatEditorPane,
ActionEvent.ACTION_PERFORMED, "");
String fontSizeString =
(String) fontSizeCombo.getSelectedItem();
Integer fontSize =
(Integer) fontSizeCombo.getSelectedItem();
Action action =
new HTMLEditorKit.FontSizeAction(fontSizeString,
new Integer(fontSizeString).intValue());
new HTMLEditorKit.FontSizeAction( fontSize.toString(),
fontSize.intValue());
action.actionPerformed(evt);
@ -149,6 +142,9 @@ public void mousePressed(MouseEvent arg0)
chatEditorPane.requestFocus();
}
});
fontNameCombo.setSelectedItem(chatEditorPane.getFont().getName());
fontSizeCombo.setSelectedItem(chatEditorPane.getFont().getSize());
}
private void initToolbarButtons()
@ -302,4 +298,16 @@ private String[] getSystemFontFamilies()
return ge.getAvailableFontFamilyNames();
}
private class ColorLabel extends JLabel
{
public void paintComponent(Graphics g)
{
AntialiasingManager.activateAntialiasing(g);
g.setColor(this.getBackground());
g.fillRoundRect(0, 0, getWidth(), getHeight(), 8, 8);
}
}
}

Loading…
Cancel
Save