From 952b59ea79de7adae5b1d14716e0441a789a8f50 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Fri, 13 Mar 2009 14:50:53 +0000 Subject: [PATCH] Remove unused component and add the possibility to decorate the account status panel. --- .../communicator/impl/gui/main/MainFrame.java | 62 +------------------ .../gui/main/presence/AccountStatusPanel.java | 37 +++++++++++ 2 files changed, 38 insertions(+), 61 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java index ae58d0e4c..e871801b0 100755 --- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java @@ -58,7 +58,7 @@ public class MainFrame private final Logger logger = Logger.getLogger(MainFrame.class); private final TransparentPanel mainPanel - = new TransparentPanel(new BorderLayout(0, 8)); + = new TransparentPanel(new BorderLayout(0, 0)); private final TransparentPanel statusBarPanel = new TransparentPanel(new BorderLayout()); @@ -208,7 +208,6 @@ private void init() menusPanel.setUI(new SIPCommOpaquePanelUI()); - northPanel.add(new LogoBar(), BorderLayout.NORTH); northPanel.add(menusPanel, BorderLayout.CENTER); northPanel.add(accountStatusPanel, BorderLayout.SOUTH); @@ -1155,65 +1154,6 @@ public void run() } } - /** - * The logo bar is positioned on the top of the window and is meant to - * contain the application logo. - */ - private static class LogoBar - extends JPanel - { - private final TexturePaint texture; - - /** - * Creates the logo bar and specify the size. - */ - public LogoBar() - { - int width = GuiActivator.getResources() - .getSettingsInt("impl.gui.LOGO_BAR_WIDTH"); - int height = GuiActivator.getResources() - .getSettingsInt("impl.gui.LOGO_BAR_HEIGHT"); - Dimension size = new Dimension(width, height); - - this.setMinimumSize(size); - this.setPreferredSize(size); - - BufferedImage bgImage = - ImageLoader.getImage(ImageLoader.WINDOW_TITLE_BAR_BG); - - Rectangle rect = - new Rectangle(0, 0, bgImage.getWidth(null), bgImage - .getHeight(null)); - - texture = new TexturePaint(bgImage, rect); - } - - /** - * Paints the logo bar. - * - * @param g the Graphics object used to paint the background - * image of this logo bar. - */ - public void paintComponent(Graphics g) - { - super.paintComponent(g); - - Image logoImage - = ImageLoader.getImage(ImageLoader.WINDOW_TITLE_BAR); - - g.drawImage(logoImage, 0, 0, null); - g.setColor(new Color(GuiActivator.getResources() - .getColor("service.gui.LOGO_BAR_BACKGROUND"))); - - Graphics2D g2 = (Graphics2D) g; - - g2.setPaint(texture); - - g2.fillRect(logoImage.getWidth(null), 0, - this.getWidth(), this.getHeight()); - } - } - /** * Removes all native plugins from this container. */ diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java b/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java index 8ce710bac..3eaffc3b2 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/AccountStatusPanel.java @@ -7,6 +7,7 @@ package net.java.sip.communicator.impl.gui.main.presence; import java.awt.*; +import java.awt.image.*; import javax.swing.*; @@ -26,6 +27,21 @@ public class AccountStatusPanel private static final int AVATAR_ICON_WIDTH = 45; + private final Color bgColor = new Color(GuiActivator.getResources() + .getColor("service.gui.LOGO_BAR_BACKGROUND")); + + private final Image logoBgImage + = ImageLoader.getImage(ImageLoader.WINDOW_TITLE_BAR); + + private final BufferedImage bgImage = + ImageLoader.getImage(ImageLoader.WINDOW_TITLE_BAR_BG); + + private final Rectangle rect = + new Rectangle(0, 0, bgImage.getWidth(null), bgImage + .getHeight(null)); + + private final TexturePaint texture = new TexturePaint(bgImage, rect); + private JMenuBar statusMenuBar = new JMenuBar(); private GlobalStatusSelectorBox statusComboBox; @@ -49,6 +65,8 @@ public AccountStatusPanel(MainFrame mainFrame) { super(new BorderLayout(10, 0)); + this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + statusComboBox = new GlobalStatusSelectorBox(mainFrame); if (ConfigurationManager.isTransparentWindowEnabled()) @@ -189,4 +207,23 @@ public void run() }).start(); } } + + public void paintComponent(Graphics g) + { + super.paintComponent(g); + + if (logoBgImage != null) + { + g.setColor(bgColor); + + Graphics2D g2 = (Graphics2D) g; + + g2.setPaint(texture); + + g2.fillRect(0, 0, this.getWidth(), this.getHeight()); + + g.drawImage(logoBgImage, + this.getWidth() - logoBgImage.getWidth(null), 0, null); + } + } }