aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2006-07-26 17:53:08 +0000
committerYana Stamcheva <yana@jitsi.org>2006-07-26 17:53:08 +0000
commit3c2a71fa978f5dab6c4a22c90264755c4b7b3643 (patch)
tree181ff1c753f62b3d6bd786cd3f9d91f9c04d81d0 /src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java
parente6b57769cf53cb401eecff84f623c575e7c38d83 (diff)
downloadjitsi-3c2a71fa978f5dab6c4a22c90264755c4b7b3643.zip
jitsi-3c2a71fa978f5dab6c4a22c90264755c4b7b3643.tar.gz
jitsi-3c2a71fa978f5dab6c4a22c90264755c4b7b3643.tar.bz2
customcontrols package moved
Diffstat (limited to 'src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java')
-rw-r--r--src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java
new file mode 100644
index 0000000..602aa62
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommToolBar.java
@@ -0,0 +1,73 @@
+/*
+ * 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.customcontrols;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import javax.swing.Box;
+import javax.swing.JSeparator;
+import javax.swing.JToolBar;
+
+import net.java.sip.communicator.impl.gui.lookandfeel.SIPCommToolBarSeparatorUI;
+import net.java.sip.communicator.impl.gui.utils.ImageLoader;
+
+/**
+ * The SIPCommToolBar is a <tt>JToolBar</tt>, which has its own drag icon
+ * and seperatator. The drag icon is shown in the beginning of the toolbar,
+ * before any of the containing toolbar buttons. It allows to drag the toolbar
+ * out of the container, where it is added and show it in a separate window.
+ * The separator is a line that could be added between two buttons. This way
+ * the developer could visualy group buttons with similar functionality.
+ *
+ * @author Yana Stamcheva
+ */
+public class SIPCommToolBar extends JToolBar {
+
+ /**
+ * Creates an instance of <tt>SIPCommToolBar</tt>.
+ */
+ public SIPCommToolBar() {
+
+ this.add(Box.createRigidArea(new Dimension(4, 4)));
+ }
+
+ /**
+ * Adds a separator to this toolbar. The separator is added after
+ * the last component in the toolbar.
+ */
+ public void addSeparator() {
+ JToolBar.Separator s = new JToolBar.Separator(new Dimension(8, 22));
+ s.setUI(new SIPCommToolBarSeparatorUI());
+
+ if (getOrientation() == VERTICAL) {
+ s.setOrientation(JSeparator.HORIZONTAL);
+ } else {
+ s.setOrientation(JSeparator.VERTICAL);
+ }
+
+ add(s);
+ }
+
+ /**
+ * Overrides the <code>paintBorder</code> method of <tt>JToolBar</tt>
+ * to paint the drag icon in the beginning of the toolbar.
+ */
+ protected void paintBorder(Graphics g) {
+
+ Graphics2D g2 = (Graphics2D) g;
+
+ BufferedImage dragImage = ImageLoader
+ .getImage(ImageLoader.TOOLBAR_DRAG_ICON);
+
+ g2.drawImage(dragImage, 0, (this.getHeight() - dragImage
+ .getHeight(null)) / 2 - 2, null);
+ }
+}