aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/sip/communicator')
-rw-r--r--src/net/java/sip/communicator/impl/gui/customcontrols/ImageBackgroundViewport.java79
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/CallListPanel.java51
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/call/DialPanel.java47
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java85
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListPanel.java52
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java52
6 files changed, 122 insertions, 244 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ImageBackgroundViewport.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ImageBackgroundViewport.java
new file mode 100644
index 0000000..82f3b86
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/gui/customcontrols/ImageBackgroundViewport.java
@@ -0,0 +1,79 @@
+package net.java.sip.communicator.impl.gui.customcontrols;
+
+import java.awt.*;
+import java.awt.image.*;
+
+import javax.swing.*;
+
+import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.utils.*;
+
+public class ImageBackgroundViewport extends JViewport
+{
+ private BufferedImage bgImage;
+
+ private TexturePaint texture;
+
+ private boolean isTextureBackground;
+
+ public ImageBackgroundViewport()
+ {
+ isTextureBackground = new Boolean(GuiActivator.getResources()
+ .getSettingsString("isTextureBackground")).booleanValue();
+
+ bgImage = ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND);
+
+ if (isTextureBackground)
+ {
+ Rectangle rect
+ = new Rectangle(0, 0,
+ bgImage.getWidth(null),
+ bgImage.getHeight(null));
+
+ texture = new TexturePaint(bgImage, rect);
+ }
+ }
+
+ public void paintComponent(Graphics g)
+ {
+ // do the superclass behavior first
+ super.paintComponent(g);
+
+ // paint the image
+ if (bgImage != null)
+ {
+ Graphics2D g2 = (Graphics2D) g;
+
+ if (isTextureBackground)
+ {
+ g2.setPaint(texture);
+
+ g2.fillRect(0, 0, this.getWidth(), this.getHeight());
+ }
+ else
+ {
+ g.setColor(new Color(
+ GuiActivator.getResources().getColor("contactListBackground")));
+
+ // paint the background with the choosen color
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ g2.drawImage(bgImage,
+ this.getWidth() - bgImage.getWidth(),
+ this.getHeight() - bgImage.getHeight(),
+ this);
+ }
+ }
+ }
+
+ public void setView(JComponent view)
+ {
+ view.setOpaque(false);
+ super.setView(view);
+ }
+
+ public Image getBackgroundImage()
+ {
+ return bgImage;
+ }
+} \ No newline at end of file
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallListPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallListPanel.java
index c8f2972..494c747 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/CallListPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/CallListPanel.java
@@ -91,7 +91,7 @@ public class CallListPanel
*/
private void initPanels()
{
- this.scrollPane.setViewport(new ScrollPaneBackground());
+ this.scrollPane.setViewport(new ImageBackgroundViewport());
this.scrollPane.getViewport().setView(callList);
this.searchPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
@@ -411,53 +411,4 @@ public class CallListPanel
this.pluginPanel.remove((Component) c.getComponent());
}
-
- private class ScrollPaneBackground extends JViewport
- {
- BufferedImage bgImage;
-
- TexturePaint texture;
-
- public ScrollPaneBackground()
- {
- bgImage = ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND);
-// Rectangle rect
-// = new Rectangle(0, 0,
-// bgImage.getWidth(null),
-// bgImage.getHeight(null));
-
-// texture = new TexturePaint(bgImage, rect);
- }
-
- public void paintComponent(Graphics g)
- {
- // do the superclass behavior first
- super.paintComponent(g);
-
- g.setColor(new Color(
- GuiActivator.getResources().getColor("contactListBackground")));
-
- // paint the background with the choosen color
- g.fillRect(0, 0, getWidth(), getHeight());
-
- // paint the image
- if (bgImage != null)
- {
- Graphics2D g2 = (Graphics2D) g;
-
-// g2.setPaint(texture);
-
- g2.drawImage(bgImage,
- this.getWidth() - bgImage.getWidth(),
- this.getHeight() - bgImage.getHeight(),
- this);
- }
- }
-
- public void setView(JComponent view)
- {
- view.setOpaque(false);
- super.setView(view);
- }
- }
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java
index d7cf7e0..5a17bce 100755
--- a/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/DialPanel.java
@@ -419,30 +419,47 @@ public class DialPanel
public void paintComponent(Graphics g)
{
- // do the superclass behavior first
+ // do the superclass behavior first
super.paintComponent(g);
- g.setColor(new Color(
- GuiActivator.getResources().getColor("contactListBackground")));
+ Graphics2D g2 = (Graphics2D) g;
- // paint the background with the chosen color
- g.fillRect(0, 0, getWidth(), getHeight());
+ boolean isTextureBackground = new Boolean(GuiActivator.getResources()
+ .getSettingsString("isTextureBackground")).booleanValue();
BufferedImage bgImage
= ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND);
- // If we haven't specified a background image, we return.
- if (bgImage == null)
- return;
-
// paint the image
- Graphics2D g2 = (Graphics2D) g;
+ if (bgImage != null)
+ {
+ if (isTextureBackground)
+ {
+ Rectangle rect
+ = new Rectangle(0, 0,
+ bgImage.getWidth(null),
+ bgImage.getHeight(null));
+
+ TexturePaint texture = new TexturePaint(bgImage, rect);
-// g2.setPaint(texture);
+ g2.setPaint(texture);
- g2.drawImage(bgImage,
- this.getWidth() - bgImage.getWidth(),
- this.getHeight() - bgImage.getHeight(),
- this);
+ g2.fillRect(0, 0, this.getWidth(), this.getHeight());
+ }
+ else
+ {
+ g.setColor(new Color(
+ GuiActivator.getResources()
+ .getColor("contactListBackground")));
+
+ // paint the background with the choosen color
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ g2.drawImage(bgImage,
+ this.getWidth() - bgImage.getWidth(),
+ this.getHeight() - bgImage.getHeight(),
+ this);
+ }
+ }
}
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
index 19ef589..dbaf270 100755
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
@@ -21,6 +21,7 @@ import javax.swing.text.*;
import javax.swing.text.html.*;
import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.lookandfeel.*;
import net.java.sip.communicator.impl.gui.main.chat.history.*;
@@ -70,12 +71,6 @@ public class ChatConversationPanel
private JSeparator copyLinkSeparator = new JSeparator();
- /**
- * The backgroud of the ScrollPane. Used to load the image to be displayed
- * in the background.
- */
- private ScrollPaneBackground scrollPaneBackground = new ScrollPaneBackground();
-
/*
* Tooltip on hyperlinks - JDK 1.5+
*
@@ -128,12 +123,15 @@ public class ChatConversationPanel
this.setWheelScrollingEnabled(true);
- this.setViewport(this.scrollPaneBackground);
+ ImageBackgroundViewport imageViewport = new ImageBackgroundViewport();
+
+ this.setViewport(imageViewport);
+
// As the JComponent.setOpaque(false) function slows down the display
// speed, we only set it when a custom image for the background exists.
// If there is no custom background image, we simply skip the
// JComponent.setOpaque(false) function call.
- if(this.scrollPaneBackground.getBackgroundImage() != null)
+ if(imageViewport.getBackgroundImage() != null)
{
this.chatEditorPane.setOpaque(false);
}
@@ -1153,75 +1151,4 @@ public class ChatConversationPanel
}
return processedMessage.toString();
}
-
- private class ScrollPaneBackground extends JViewport
- {
- /**
- * The BufferedImage of the background. May be null when no custom
- * background is set.
- */
- private BufferedImage bgImage;
-
- private TexturePaint texture;
-
- public ScrollPaneBackground()
- {
- bgImage = ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND);
-// Rectangle rect
-// = new Rectangle(0, 0,
-// bgImage.getWidth(null),
-// bgImage.getHeight(null));
-
-// texture = new TexturePaint(bgImage, rect);
- }
-
- /**
- * Returns the instance of the BufferedImage used for the background of
- * the ScrollPane.
- * @return The BufferedImage of the ScrollPane. NULL is returned when
- * the image does not exists.
- */
- public BufferedImage getBackgroundImage()
- {
- return this.bgImage;
- }
-
- public void paintComponent(Graphics g)
- {
- // do the superclass behavior first
- super.paintComponent(g);
-
- g.setColor(new Color(
- GuiActivator.getResources().getColor("contactListBackground")));
-
- // paint the background with the choosen color
- g.fillRect(0, 0, getWidth(), getHeight());
-
- // paint the image
- if (bgImage != null)
- {
- Graphics2D g2 = (Graphics2D) g;
-
-// g2.setPaint(texture);
-
- g2.drawImage(bgImage,
- this.getWidth() - bgImage.getWidth(),
- this.getHeight() - bgImage.getHeight(),
- this);
- }
- }
-
- public void setView(JComponent view)
- {
- // As the JComponent.setOpaque(false) function slows down the display
- // speed, we only set it when a custom image for the background exists.
- // If there is no custom background image, we simply skip the
- // JComponent.setOpaque(false) function call.
- if(this.getBackgroundImage() != null)
- {
- view.setOpaque(false);
- }
- super.setView(view);
- }
- }
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListPanel.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListPanel.java
index 6e4185a..3e5258f 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomsListPanel.java
@@ -13,6 +13,7 @@ import java.awt.image.*;
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.main.chat.conference.*;
@@ -48,7 +49,7 @@ public class ChatRoomsListPanel
this.treePanel.add(chatRoomsList, BorderLayout.NORTH);
this.treePanel.setOpaque(false);
- this.setViewport(new ScrollPaneBackground());
+ this.setViewport(new ImageBackgroundViewport());
this.getViewport().setView(treePanel);
this.setHorizontalScrollBarPolicy(
@@ -116,53 +117,4 @@ public class ChatRoomsListPanel
}
}
}
-
- private class ScrollPaneBackground extends JViewport
- {
- BufferedImage bgImage;
-
- TexturePaint texture;
-
- public ScrollPaneBackground()
- {
- bgImage = ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND);
-// Rectangle rect
-// = new Rectangle(0, 0,
-// bgImage.getWidth(null),
-// bgImage.getHeight(null));
-
-// texture = new TexturePaint(bgImage, rect);
- }
-
- public void paintComponent(Graphics g)
- {
- // do the superclass behavior first
- super.paintComponent(g);
-
- g.setColor(new Color(
- GuiActivator.getResources().getColor("contactListBackground")));
-
- // paint the background with the choosen color
- g.fillRect(0, 0, getWidth(), getHeight());
-
- // paint the image
- if (bgImage != null)
- {
- Graphics2D g2 = (Graphics2D) g;
-
-// g2.setPaint(texture);
-
- g2.drawImage(bgImage,
- this.getWidth() - bgImage.getWidth(),
- this.getHeight() - bgImage.getHeight(),
- this);
- }
- }
-
- public void setView(JComponent view)
- {
- view.setOpaque(false);
- super.setView(view);
- }
- }
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java
index bbf0e20..f87ecbe 100755
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java
@@ -16,6 +16,7 @@ import javax.swing.*;
import javax.swing.Timer;
import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
@@ -66,7 +67,7 @@ public class ContactListPanel
this.treePanel.setOpaque(false);
- this.setViewport(new ScrollPaneBackground());
+ this.setViewport(new ImageBackgroundViewport());
this.getViewport().setView(treePanel);
@@ -618,53 +619,4 @@ public class ContactListPanel
}
}
}
-
- private class ScrollPaneBackground extends JViewport
- {
- BufferedImage bgImage;
-
- TexturePaint texture;
-
- public ScrollPaneBackground()
- {
- bgImage = ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND);
-// Rectangle rect
-// = new Rectangle(0, 0,
-// bgImage.getWidth(null),
-// bgImage.getHeight(null));
-
-// texture = new TexturePaint(bgImage, rect);
- }
-
- public void paintComponent(Graphics g)
- {
- // do the superclass behavior first
- super.paintComponent(g);
-
- g.setColor(new Color(
- GuiActivator.getResources().getColor("contactListBackground")));
-
- // paint the background with the choosen color
- g.fillRect(0, 0, getWidth(), getHeight());
-
- // paint the image
- if (bgImage != null)
- {
- Graphics2D g2 = (Graphics2D) g;
-
-// g2.setPaint(texture);
-
- g2.drawImage(bgImage,
- this.getWidth() - bgImage.getWidth(),
- this.getHeight() - bgImage.getHeight(),
- this);
- }
- }
-
- public void setView(JComponent view)
- {
- view.setOpaque(false);
- super.setView(view);
- }
- }
}