Remove unused component and add the possibility to decorate the account status panel.

cusax-fix
Yana Stamcheva 18 years ago
parent 851cc7842d
commit 952b59ea79

@ -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 <tt>Graphics</tt> 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.
*/

@ -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);
}
}
}

Loading…
Cancel
Save