diff --git a/resources/config/defaults.properties b/resources/config/defaults.properties index 0daef985e..9f4bcfa34 100644 --- a/resources/config/defaults.properties +++ b/resources/config/defaults.properties @@ -38,6 +38,7 @@ impl.gui.WINDOW_TRANSPARENCY=180 impl.gui.IS_WINDOW_DECORATED=true impl.gui.IS_WINDOW_BACKGROUND_ENABLED=false impl.gui.IS_WINDOW_COLOR_BACKGROUND_ENABLED=true +impl.gui.IS_WINDOW_IMAGE_BACKGROUND_ENABLED=false impl.gui.IS_TEXTURE_BACKGROUND=false impl.gui.GREY_HISTORY_ENABLED=false diff --git a/src/net/java/sip/communicator/util/swing/SIPCommFrame.java b/src/net/java/sip/communicator/util/swing/SIPCommFrame.java index 07b531131..c8f57ccec 100644 --- a/src/net/java/sip/communicator/util/swing/SIPCommFrame.java +++ b/src/net/java/sip/communicator/util/swing/SIPCommFrame.java @@ -9,6 +9,8 @@ import java.awt.*; import java.awt.event.*; import java.awt.geom.*; +import java.awt.image.*; +import java.net.*; import java.util.*; import javax.swing.*; @@ -399,10 +401,16 @@ public static class MainContentPane { private final boolean isColorBgEnabled; + private final boolean isImageBgEnabled; + private final Color bgStartColor; private final Color bgEndColor; + private BufferedImage bgImage = null; + + private TexturePaint texture = null; + public MainContentPane() { super(new BorderLayout()); @@ -433,6 +441,25 @@ public MainContentPane() bgStartColor = null; bgEndColor = null; } + + isImageBgEnabled = + new Boolean(resources.getSettingsString( + "impl.gui.IS_WINDOW_IMAGE_BACKGROUND_ENABLED")) + .booleanValue(); + + if (isImageBgEnabled) + { + final URL bgImagePath + = resources.getImageURL("service.gui.WINDOW_TITLE_BAR_BG"); + + bgImage = ImageUtils.getBufferedImage(bgImagePath); + + final Rectangle rect = + new Rectangle(0, 0, bgImage.getWidth(), + bgImage.getHeight()); + + texture = new TexturePaint(bgImage, rect); + } } public void paintComponent(Graphics g) @@ -453,6 +480,18 @@ public void paintComponent(Graphics g) g.dispose(); } } + + if (isImageBgEnabled) + { + if (bgImage != null && texture != null) + { + Graphics2D g2 = (Graphics2D) g; + + g2.setPaint(texture); + + g2.fillRect(0, 0, this.getWidth(), bgImage.getHeight()); + } + } } private void internalPaintComponent(Graphics g)