mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Update UI.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@6704 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -19,7 +19,6 @@ import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||
import org.jivesoftware.spark.ChatAreaSendField;
|
||||
import org.jivesoftware.spark.SparkManager;
|
||||
import org.jivesoftware.spark.component.BackgroundPanel;
|
||||
import org.jivesoftware.spark.component.RolloverButton;
|
||||
import org.jivesoftware.spark.plugin.ContextMenuListener;
|
||||
import org.jivesoftware.spark.util.GraphicUtils;
|
||||
@ -27,8 +26,33 @@ import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
@ -41,36 +65,15 @@ import javax.swing.JSeparator;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The base implementation of all ChatRoom conversations. You would implement this class to have most types of Chat.
|
||||
*/
|
||||
public abstract class ChatRoom extends BackgroundPanel implements ActionListener, PacketListener, DocumentListener, ConnectionListener {
|
||||
public abstract class ChatRoom extends JPanel implements ActionListener, PacketListener, DocumentListener, ConnectionListener {
|
||||
private final JPanel chatPanel;
|
||||
private final JSplitPane splitPane;
|
||||
private final JLabel notificationLabel;
|
||||
@ -252,7 +255,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
bottomPanel.add(editorBar, new GridBagConstraints(0, 0, 5, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
|
||||
|
||||
// Set bottom panel border
|
||||
bottomPanel.setBorder(BorderFactory.createMatteBorder(0,0,1,0, new Color(197, 213, 230)));
|
||||
bottomPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(197, 213, 230)));
|
||||
verticalSplit.setOpaque(false);
|
||||
|
||||
verticalSplit.setTopComponent(chatPanel);
|
||||
@ -482,7 +485,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
private void checkForEnter(KeyEvent e) {
|
||||
final KeyStroke keyStroke = KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers());
|
||||
if (!keyStroke.equals(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_DOWN_MASK)) &&
|
||||
e.getKeyChar() == KeyEvent.VK_ENTER) {
|
||||
e.getKeyChar() == KeyEvent.VK_ENTER) {
|
||||
e.consume();
|
||||
sendMessage();
|
||||
getChatInputEditor().setText("");
|
||||
@ -939,6 +942,20 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
return verticalSplit;
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
|
||||
BufferedImage cache = new BufferedImage(2, getHeight(), BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D g2d = cache.createGraphics();
|
||||
|
||||
GradientPaint paint = new GradientPaint(0, 0, Color.white, 0, getHeight(), new Color(220, 230, 240), true);
|
||||
|
||||
g2d.setPaint(paint);
|
||||
g2d.fillRect(0, 0, getWidth(), getHeight());
|
||||
g2d.dispose();
|
||||
|
||||
g.drawImage(cache, 0, 0, getWidth(), getHeight(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of this method should return the last time this chat room
|
||||
* sent or recieved a message.
|
||||
|
||||
Reference in New Issue
Block a user