More native MacOS interface for main components.

cusax-fix
Yana Stamcheva 15 years ago
parent 0082a836f4
commit a1f0592d6c

@ -1510,6 +1510,8 @@ javax.swing.event, javax.swing.border"/>
<zipfileset src="lib/installer-exclude/jna.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/transparency.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/swing-worker-1.2.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/mac_widgets-0.9.5.jar" prefix=""/>
<zipfileset src="lib/installer-exclude/forms-1.2.1.jar" prefix=""/>
</jar>
</target>

@ -184,4 +184,8 @@ service.gui.CALL_MEMBER_NAME_BACKGROUND=BDFFA3
# Conference call local user title panel background color.
service.gui.CALL_LOCAL_USER_BACKGROUND=A6D6FF
service.gui.SEARCH_BACKGROUND=4A9BDB
# The background used in opaque Mac panels.
service.gui.MAC_PANEL_BACKGROUND=f0f0f0
# The background of the search field.
service.gui.SEARCH_BACKGROUND=4A9BDB

@ -39,6 +39,8 @@
import org.osgi.framework.*;
import com.explodingpixels.macwidgets.*;
/**
* The main application window. This class is the core of this UI
* implementation. It stores all available protocol providers and their
@ -237,20 +239,18 @@ private void init()
registerKeyActions();
TransparentPanel northPanel
= new TransparentPanel(new BorderLayout(0, 0));
JComponent northPanel = createTopComponent();
this.setJMenuBar(menu);
northPanel.add(accountStatusPanel, BorderLayout.CENTER);
TransparentPanel searchPanel
= new TransparentPanel(new BorderLayout(2, 0));
searchPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
searchPanel.add(searchField);
searchPanel.add(new CallHistoryButton(), BorderLayout.EAST);
centerPanel.add(searchPanel, BorderLayout.NORTH);
northPanel.add(accountStatusPanel, BorderLayout.CENTER);
northPanel.add(searchPanel, BorderLayout.SOUTH);
centerPanel.add(contactListPanel, BorderLayout.CENTER);
this.mainPanel.add(northPanel, BorderLayout.NORTH);
@ -261,6 +261,48 @@ private void init()
contentPane.add(statusBarPanel, BorderLayout.SOUTH);
}
/**
* Creates the toolbar panel for this chat window, depending on the current
* operating system.
*
* @return the created toolbar
*/
private JComponent createTopComponent()
{
JComponent topComponent = null;
if (OSUtils.IS_MAC)
{
UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
MacUtils.makeWindowLeopardStyle(getRootPane());
macToolbarPanel.getComponent().setLayout(new BorderLayout(3, 3));
macToolbarPanel.getComponent()
.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
macToolbarPanel.disableBackgroundPainter();
macToolbarPanel.installWindowDraggerOnWindow(this);
// Set the color of the center panel.
centerPanel.setOpaque(true);
centerPanel.setBackground(
new Color(GuiActivator.getResources()
.getColor("service.gui.MAC_PANEL_BACKGROUND")));
topComponent = macToolbarPanel.getComponent();
}
else
{
JPanel panel = new TransparentPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
topComponent = panel;
}
return topComponent;
}
/**
* Sets frame size and position.
*/

@ -243,9 +243,6 @@ public CallDialog(Call call)
*/
private void init()
{
TransparentPanel buttonsPanel
= new TransparentPanel(new BorderLayout(5, 5));
hangupButton = new SIPCommButton(
ImageLoader.getImage(ImageLoader.HANGUP_BUTTON_BG));
@ -269,9 +266,6 @@ private void init()
"service.gui.CREATE_CONFERENCE_CALL"));
conferenceButton.addActionListener(this);
contentPane.add(callPanel, BorderLayout.CENTER);
contentPane.add(buttonsPanel, BorderLayout.SOUTH);
hangupButton.setName(HANGUP_BUTTON);
hangupButton.setToolTipText(
GuiActivator.getResources().getI18NString("service.gui.HANG_UP"));
@ -307,13 +301,14 @@ private void init()
addOneToOneSpecificComponents();
}
buttonsPanel.add(settingsPanel, BorderLayout.WEST);
buttonsPanel.add(hangupButton, BorderLayout.EAST);
buttonsPanel.setBorder(
new ExtendedEtchedBorder(EtchedBorder.LOWERED, 1, 0, 0, 0));
settingsPanel.add(volumeControlButton);
dtmfHandler = new DTMFHandler(this);
JComponent bottomBar = createBottomBar();
contentPane.add(callPanel, BorderLayout.CENTER);
contentPane.add(bottomBar, BorderLayout.SOUTH);
}
/**
@ -1098,4 +1093,32 @@ public boolean isRecordingStarted()
{
return recordButton.isSelected();
}
/**
* Creates the bottom bar panel for this call dialog, depending on the
* current operating system.
*
* @return the created bottom bar
*/
private JComponent createBottomBar()
{
JComponent bottomBar = new TransparentPanel();
bottomBar.setBorder(
new ExtendedEtchedBorder(EtchedBorder.LOWERED, 1, 0, 0, 0));
if (OSUtils.IS_MAC)
{
bottomBar.setOpaque(true);
bottomBar.setBackground(
new Color(GuiActivator.getResources()
.getColor("service.gui.MAC_PANEL_BACKGROUND")));
}
bottomBar.setLayout(new BorderLayout());
bottomBar.add(settingsPanel, BorderLayout.WEST);
bottomBar.add(hangupButton, BorderLayout.EAST);
return bottomBar;
}
}

@ -10,6 +10,8 @@
import javax.swing.*;
import com.explodingpixels.macwidgets.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@ -39,6 +41,11 @@ public class OneToOneCallPanel
*/
private static final long serialVersionUID = 0L;
/**
* The component showing the name of the underlying call peer.
*/
private final JLabel nameLabel = new JLabel("", JLabel.CENTER);
/**
* The panel representing the underlying <tt>CallPeer</tt>.
*/
@ -96,9 +103,6 @@ public OneToOneCallPanel( CallDialog callDialog,
this.call = call;
this.callPeer = callPeer;
this.setBorder(BorderFactory
.createEmptyBorder(5, 0, 5, 0));
this.setTransferHandler(new CallTransferHandler(call));
this.addCallPeerPanel(callPeer);
@ -117,6 +121,13 @@ public void addCallPeerPanel(CallPeer peer)
{
peerPanel = new OneToOneCallPeerPanel(this, peer);
/* Create the main Components of the UI. */
nameLabel.setText(peer.getDisplayName());
JComponent topBar = createTopComponent();
topBar.add(nameLabel);
this.add(topBar, BorderLayout.NORTH);
this.add(peerPanel);
// Create an adapter which would manage all common call peer
@ -471,4 +482,52 @@ public CallDialog getCallDialog()
{
return callDialog;
}
/**
* Sets the name of the peer.
* @param name the name of the peer
*/
public void setPeerName(String name)
{
this.nameLabel.setText(name);
}
/**
* Creates the toolbar panel for this chat window, depending on the current
* operating system.
*
* @return the created toolbar
*/
private JComponent createTopComponent()
{
JComponent topComponent = null;
if (OSUtils.IS_MAC)
{
UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
MacUtils.makeWindowLeopardStyle(callDialog.getRootPane());
macToolbarPanel.getComponent().setLayout(new BorderLayout());
macToolbarPanel.disableBackgroundPainter();
macToolbarPanel.installWindowDraggerOnWindow(callDialog);
// Set the color of the center panel.
peerPanel.setOpaque(true);
peerPanel.setBackground(new Color(GuiActivator.getResources()
.getColor("service.gui.MAC_PANEL_BACKGROUND")));
topComponent = macToolbarPanel.getComponent();
}
else
{
JPanel panel = new TransparentPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
topComponent = panel;
}
return topComponent;
}
}

@ -58,11 +58,6 @@ public class OneToOneCallPeerPanel
*/
private CallPeerAdapter callPeerAdapter;
/**
* The component showing the name of the underlying call peer.
*/
private final JLabel nameLabel = new JLabel("", JLabel.CENTER);
/**
* The component showing the status of the underlying call peer.
*/
@ -125,7 +120,7 @@ public class OneToOneCallPeerPanel
/**
* The name of the peer.
*/
private final String peerName;
private String peerName;
/**
* The list containing all video containers.
@ -180,6 +175,16 @@ public class OneToOneCallPeerPanel
*/
private JLabel remoteLevelLabel;
/**
* The center component.
*/
private final Component center;
/**
* The status bar component.
*/
private final Component statusBar;
/**
* Creates a <tt>CallPeerPanel</tt> for the given call peer.
*
@ -195,26 +200,14 @@ public OneToOneCallPeerPanel( CallRenderer callRenderer,
this.setPeerImage(CallManager.getPeerImage(callPeer));
/* Create the main Components of the UI. */
nameLabel.setText(peerName);
nameLabel.setAlignmentX(JLabel.CENTER);
Component center = createCenter();
Component statusBar = createStatusBar();
center = createCenter();
statusBar = createStatusBar();
/* Lay out the main Components of the UI. */
setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
if (nameLabel != null)
{
constraints.fill = GridBagConstraints.NONE;
constraints.gridx = 0;
constraints.gridy = 0;
constraints.weightx = 0;
add(nameLabel, constraints);
}
if (center != null)
{
/*
@ -975,7 +968,9 @@ public void paintComponent(Graphics g)
*/
public void setPeerName(String name)
{
this.nameLabel.setText(name);
peerName = name;
((OneToOneCallPanel) callRenderer).setPeerName(name);
}
/**

@ -162,6 +162,14 @@ public ChatPanel(ChatWindow chatWindow)
this.add(messagePane, BorderLayout.CENTER);
this.add(sendPanel, BorderLayout.SOUTH);
if (OSUtils.IS_MAC)
{
setOpaque(true);
setBackground(
new Color(GuiActivator.getResources()
.getColor("service.gui.MAC_PANEL_BACKGROUND")));
}
this.addComponentListener(new TabSelectionComponentListener());
}

@ -33,6 +33,8 @@
import org.osgi.framework.*;
import com.explodingpixels.macwidgets.*;
/**
* The chat window is the place, where users can write and send messages, view
* received messages. The ChatWindow supports two modes of use: "Group all
@ -63,13 +65,12 @@ public class ChatWindow
private final java.util.List<ChatChangeListener> chatChangeListeners =
new Vector<ChatChangeListener>();
private final JPanel mainPanel = new JPanel(new BorderLayout());
private final NorthPanel northPanel = new NorthPanel(new BorderLayout());
private final JPanel mainPanel
= new TransparentPanel(new BorderLayout());
private final JPanel statusBarPanel = new JPanel(new BorderLayout());
private final JPanel statusBarPanel
= new TransparentPanel(new BorderLayout());
private final JPanel pluginPanelNorth = new JPanel();
private final JPanel pluginPanelSouth = new JPanel();
private final JPanel pluginPanelWest = new JPanel();
private final JPanel pluginPanelEast = new JPanel();
@ -78,7 +79,9 @@ public class ChatWindow
private final MessageWindowMenuBar menuBar;
private final MainToolBar mainToolBar;
private MainToolBar mainToolBar;
private final Component toolbarPanel;
/**
* Creates an instance of <tt>ChatWindow</tt> by passing to it an instance
@ -93,8 +96,6 @@ public ChatWindow()
this.addWindowFocusListener(this);
this.setHierarchicallyOpaque(false);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
//If in mode TABBED_CHAT_WINDOW initialize the tabbed pane
@ -129,17 +130,9 @@ public void stateChanged(ChangeEvent evt)
this.setJMenuBar(menuBar);
mainToolBar = new MainToolBar(this);
boolean chatToolbarVisible = ConfigurationManager.isChatToolbarVisible();
northPanel.setVisible(chatToolbarVisible);
northPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
northPanel.add(mainToolBar, BorderLayout.CENTER);
northPanel.add(contactPhotoPanel, BorderLayout.EAST);
this.mainPanel.add(northPanel, BorderLayout.NORTH);
toolbarPanel = createToolBar();
this.getContentPane().add(toolbarPanel, BorderLayout.NORTH);
this.getContentPane().add(mainPanel, BorderLayout.CENTER);
this.getContentPane().add(statusBarPanel, BorderLayout.SOUTH);
@ -171,20 +164,6 @@ public void stateChanged(ChangeEvent evt)
this.setSize(width, height);
}
/**
* Sets the given isOpaque property to this panel and all its contained
* components.
*
* @param isOpaque <code>true</code> to set this panel paque and
* <code>false</code> - otherwise.
*/
public void setHierarchicallyOpaque(boolean isOpaque)
{
northPanel.setOpaque(isOpaque);
mainPanel.setOpaque(isOpaque);
statusBarPanel.setOpaque(isOpaque);
}
/**
* Shows or hides the Toolbar depending on the value of parameter b.
*
@ -193,9 +172,9 @@ public void setHierarchicallyOpaque(boolean isOpaque)
public void setToolbarVisible(boolean b)
{
// The north panel is the one containing the toolbar and contact photo.
northPanel.setVisible(b);
toolbarPanel.setVisible(b);
}
/**
* Shows or hides the Stylebar depending on the value of parameter b.
*
@ -263,6 +242,52 @@ public void addChat(ChatPanel chatPanel)
l.chatChanged(chatPanel);
}
/**
* Creates the toolbar panel for this chat window, depending on the current
* operating system.
*
* @return the created toolbar
*/
private Component createToolBar()
{
Component toolbarPanel = null;
mainToolBar = new MainToolBar(this);
boolean chatToolbarVisible
= ConfigurationManager.isChatToolbarVisible();
if (OSUtils.IS_MAC)
{
UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
MacUtils.makeWindowLeopardStyle(getRootPane());
macToolbarPanel.addComponentToLeft(mainToolBar);
macToolbarPanel.addComponentToRight(contactPhotoPanel);
macToolbarPanel.disableBackgroundPainter();
macToolbarPanel.installWindowDraggerOnWindow(this);
macToolbarPanel.getComponent()
.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
macToolbarPanel.getComponent().setVisible(chatToolbarVisible);
toolbarPanel = macToolbarPanel.getComponent();
}
else
{
ToolbarPanel panel = new ToolbarPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
panel.add(mainToolBar, BorderLayout.CENTER);
panel.add(contactPhotoPanel, BorderLayout.EAST);
panel.setVisible(chatToolbarVisible);
toolbarPanel = panel;
}
return toolbarPanel;
}
/**
* Adds a given <tt>ChatPanel</tt> to this chat window.
*
@ -783,8 +808,6 @@ public void bringToFront()
*/
private void initPluginComponents()
{
pluginPanelNorth.setLayout(
new BoxLayout(pluginPanelNorth, BoxLayout.Y_AXIS));
pluginPanelEast.setLayout(
new BoxLayout(pluginPanelEast, BoxLayout.Y_AXIS));
pluginPanelSouth.setLayout(
@ -792,7 +815,6 @@ private void initPluginComponents()
pluginPanelWest.setLayout(
new BoxLayout(pluginPanelWest, BoxLayout.Y_AXIS));
this.getContentPane().add(pluginPanelNorth, BorderLayout.NORTH);
this.getContentPane().add(pluginPanelEast, BorderLayout.EAST);
this.getContentPane().add(pluginPanelWest, BorderLayout.WEST);
this.mainPanel.add(pluginPanelSouth, BorderLayout.SOUTH);
@ -940,12 +962,7 @@ private void addPluginComponent(Component c,
{
if (container.equals(Container.CONTAINER_CHAT_WINDOW))
{
if (constraints.equals(BorderLayout.NORTH))
{
pluginPanelNorth.add(c);
pluginPanelNorth.repaint();
}
else if (constraints.equals(BorderLayout.SOUTH))
if (constraints.equals(BorderLayout.SOUTH))
{
pluginPanelSouth.add(c);
pluginPanelSouth.repaint();
@ -983,9 +1000,7 @@ private void removePluginComponent( Component c,
{
if (container.equals(Container.CONTAINER_CHAT_WINDOW))
{
if (constraints.equals(BorderLayout.NORTH))
pluginPanelNorth.remove(c);
else if (constraints.equals(BorderLayout.SOUTH))
if (constraints.equals(BorderLayout.SOUTH))
pluginPanelSouth.remove(c);
else if (constraints.equals(BorderLayout.WEST))
pluginPanelWest.remove(c);
@ -1239,13 +1254,13 @@ private void removeNonReadChatState()
}
}
private static class NorthPanel
private static class ToolbarPanel
extends JPanel
implements Skinnable
{
private Image logoBgImage;
public NorthPanel(LayoutManager layoutManager)
public ToolbarPanel(LayoutManager layoutManager)
{
super(layoutManager);

@ -24,9 +24,9 @@
public class ConfigFormDescriptor
{
private final Logger logger = Logger.getLogger(ConfigFormDescriptor.class);
private final ConfigurationForm configForm;
private ImageIcon configFormIcon;
private Component configFormPanel;
@ -41,20 +41,20 @@ public class ConfigFormDescriptor
public ConfigFormDescriptor(ConfigurationForm configForm)
{
this.configForm = configForm;
byte[] icon = null;
try
{
icon = configForm.getIcon();
configFormTitle = configForm.getTitle();
}
catch (Exception e)
{
logger.error("Could not load configuration form.", e);
}
if(icon != null)
configFormIcon = new ImageIcon(icon);
}

@ -33,12 +33,12 @@ public class ConfigFormListCellRenderer
*/
public static final int SELECTED_GRADIENT_SIZE = 5;
private final JLabel textLabel = new JLabel();
private final JLabel textLabel = new EmphasizedLabel("");
private final JLabel iconLabel = new JLabel();
private boolean isSelected = false;
/**
* Initialize the panel containing the node.
*/
@ -49,7 +49,7 @@ public ConfigFormListCellRenderer()
this.setPreferredSize(new Dimension(60, 50));
Font font = getFont();
this.textLabel.setFont(font.deriveFont(Font.BOLD, font.getSize() - 2));
this.textLabel.setFont(font.deriveFont(11f));
this.iconLabel.setHorizontalAlignment(JLabel.CENTER);
this.textLabel.setHorizontalAlignment(JLabel.CENTER);

@ -17,6 +17,8 @@
import org.osgi.framework.*;
import com.explodingpixels.macwidgets.*;
/**
* The <tt>ConfigurationFrame</tt> is the dialog opened when the "Options" menu
* is selected. It contains different basic configuration forms, like General,
@ -73,7 +75,7 @@ public ConfigurationFrame(MainFrame mainFrame)
configScrollList.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
configScrollList.setBorder(BorderFactory.createEmptyBorder());
configScrollList.setBorder(null);
configScrollList.setOpaque(false);
configScrollList.getViewport().setOpaque(false);
configScrollList.getViewport().add(configList);
@ -86,16 +88,18 @@ public ConfigurationFrame(MainFrame mainFrame)
this.addDefaultForms();
TransparentPanel mainPanel
= new TransparentPanel(new BorderLayout(5, 5));
= new TransparentPanel(new BorderLayout());
centerPanel.setMinimumSize(new Dimension(600, 100));
centerPanel.setMaximumSize(
new Dimension( 600, Integer.MAX_VALUE));
new Dimension(600, Integer.MAX_VALUE));
this.setResizable(false);
mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
mainPanel.add(centerPanel, BorderLayout.SOUTH);
mainPanel.add(configScrollList, BorderLayout.NORTH);
JComponent topComponent = createTopComponent();
topComponent.add(configScrollList);
mainPanel.add(topComponent, BorderLayout.NORTH);
centerPanel.setBorder(BorderFactory.createEmptyBorder( BORDER_SIZE,
BORDER_SIZE,
@ -135,6 +139,42 @@ public ConfigurationFrame(MainFrame mainFrame)
}
}
/**
* Creates the toolbar panel for this chat window, depending on the current
* operating system.
*
* @return the created toolbar
*/
private JComponent createTopComponent()
{
JComponent topComponent = null;
if (OSUtils.IS_MAC)
{
UnifiedToolBar macToolbarPanel = new UnifiedToolBar();
MacUtils.makeWindowLeopardStyle(getRootPane());
macToolbarPanel.getComponent().setLayout(new BorderLayout());
macToolbarPanel.disableBackgroundPainter();
macToolbarPanel.installWindowDraggerOnWindow(this);
centerPanel.setOpaque(true);
centerPanel.setBackground(
new Color(GuiActivator.getResources()
.getColor("service.gui.MAC_PANEL_BACKGROUND")));
topComponent = macToolbarPanel.getComponent();
}
else
{
JPanel panel = new TransparentPanel(new BorderLayout());
topComponent = panel;
}
return topComponent;
}
/**
* Some configuration forms constructed from the ui implementation itself
* are added here in the configuration dialog.

@ -432,9 +432,20 @@ protected void paintComponent(Graphics g)
super.paintComponent(g);
g = g.create();
if (!(treeNode instanceof GroupNode) && !isSelected)
return;
AntialiasingManager.activateAntialiasing(g);
Graphics2D g2 = (Graphics2D) g;
try
{
internalPaintComponent(g);
if (OSUtils.IS_MAC)
internalPaintComponentMacOS(g2);
else
internalPaintComponent(g2);
}
finally
{
@ -446,17 +457,10 @@ protected void paintComponent(Graphics g)
* Paint a background for all groups and a round blue border and background
* when a cell is selected.
*
* @param g the <tt>Graphics</tt> object through which we paint
* @param g2 the <tt>Graphics2D</tt> object through which we paint
*/
private void internalPaintComponent(Graphics g)
private void internalPaintComponent(Graphics2D g2)
{
if (!(treeNode instanceof GroupNode) && !isSelected)
return;
AntialiasingManager.activateAntialiasing(g);
Graphics2D g2 = (Graphics2D) g;
Shape clipShape
= GraphicUtils.createRoundedClipShape(
getWidth(), getHeight(), 20, 20);
@ -505,6 +509,39 @@ else if (treeNode instanceof GroupNode)
g2.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 20, 20);
}
/**
* Paint a background for all groups and a round blue border and background
* when a cell is selected.
*
* @param g2 the <tt>Graphics2D</tt> object through which we paint
*/
private void internalPaintComponentMacOS(Graphics2D g2)
{
Color borderColor = Color.GRAY;
if (isSelected)
{
g2.setPaint(new GradientPaint(0, 0,
Color.WHITE, 0, getHeight(), Constants.SELECTED_COLOR));
borderColor = Constants.SELECTED_COLOR;
}
else if (treeNode instanceof GroupNode)
{
g2.setPaint(new GradientPaint(0, 0,
Constants.CONTACT_LIST_GROUP_BG_GRADIENT_COLOR,
0, getHeight(),
Constants.CONTACT_LIST_GROUP_BG_COLOR));
borderColor = Constants.CONTACT_LIST_GROUP_BG_COLOR;
}
g2.fillRect(0, 0, getWidth(), getHeight());
g2.setColor(borderColor);
g2.drawLine(0, 0, getWidth(), 0);
g2.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
}
/**
* Returns the height of this icon. Used for the drag&drop component.
* @return the height of this icon

@ -109,7 +109,7 @@ protected void customPaintBackground(Graphics g)
int dy = (c.getY() + c.getHeight()) / 2
- searchIcon.getIconHeight()/2;
g2.drawImage(searchIcon.getImage(), c.getX(), dy + 1, null);
g2.drawImage(searchIcon.getImage(), c.getX() + 5, dy + 1, null);
// Paint call button.
Rectangle callRect = getCallButtonRect();

@ -41,12 +41,12 @@ public class AccountStatusPanel
/**
* The desired height of the avatar.
*/
private static final int AVATAR_ICON_HEIGHT = 45;
private static final int AVATAR_ICON_HEIGHT = 40;
/**
* The desired width of the avatar.
*/
private static final int AVATAR_ICON_WIDTH = 45;
private static final int AVATAR_ICON_WIDTH = 40;
/**
* The image object storing the avatar.
@ -57,7 +57,7 @@ public class AccountStatusPanel
* The label showing the name of the user.
*/
private final JLabel accountNameLabel
= new JLabel(
= new EmphasizedLabel(
GuiActivator
.getResources().getI18NString("service.gui.ACCOUNT_ME"));
@ -106,8 +106,6 @@ public AccountStatusPanel(MainFrame mainFrame)
{
super(new BorderLayout(10, 0));
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
if (ConfigurationManager.isTransparentWindowEnabled())
this.setUI(new SIPCommOpaquePanelUI());
@ -123,7 +121,7 @@ public AccountStatusPanel(MainFrame mainFrame)
this.accountImageLabel = imageWithMenu;
accountNameLabel.setFont(
accountNameLabel.getFont().deriveFont(Font.BOLD));
accountNameLabel.getFont().deriveFont(12f));
accountNameLabel.setOpaque(false);
statusComboBox = new GlobalStatusSelectorBox(mainFrame);

@ -151,6 +151,9 @@ public GlobalStatusSelectorBox(MainFrame mainFrame)
this.addSeparator();
this.setUI(new SIPCommStatusMenuUI());
this.setFont(titleLabel.getFont().deriveFont(Font.PLAIN, 11f));
this.setIcon(offlineItem.getIcon());
this.setIconTextGap(2);
this.setOpaque(false);
@ -158,7 +161,6 @@ public GlobalStatusSelectorBox(MainFrame mainFrame)
this.setToolTipText("<html><b>" + GuiActivator.getResources()
.getI18NString("service.gui.SET_GLOBAL_STATUS")
+ "</b></html>");
this.setUI(new SIPCommStatusMenuUI());
fitSizeToText();
}

@ -132,6 +132,10 @@ public void windowOpened(WindowEvent e)
removeWindowListener(this);
}
});
if (OSUtils.IS_MAC)
getRootPane()
.putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);
}
/**

@ -0,0 +1,99 @@
/*
* 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.util.swing;
import java.awt.*;
import javax.swing.*;
/**
* A label with white shadow.
* Based on code published on http://explodingpixels.wordpress.com.
*
* @author Yana Stamcheva
*/
public class EmphasizedLabel
extends JLabel
{
private boolean fUseEmphasisColor;
/**
* The color used to paint the shadow.
*/
public static final Color EMPHASIZED_FONT_COLOR =
new Color(255, 255, 255, 110);
/**
* The color used to paint focused view.
*/
public static final Color EMPHASIZED_FOCUSED_FONT_COLOR =
new Color(0x000000);
/**
* The color used to paint unfocused view.
*/
public static final Color EMPHASIZED_UNFOCUSED_FONT_COLOR =
new Color(0x3f3f3f);
/**
* Creates an instance of <tt>EmphasizedLabel</tt>.
*
* @param text the text to show in this label
*/
public EmphasizedLabel(String text)
{
super(text);
}
/**
* Overrides the <tt>getPreferredSize()</tt> method in order to enlarge the
* height of this label, which should welcome the lightening shadow.
*/
@Override
public Dimension getPreferredSize()
{
Dimension d = super.getPreferredSize();
d.height += 1;
return d;
}
/**
* Overrides the <tt>getForeground()</tt> method in order to provide
* different foreground color, depending on whether the label is focused.
*/
@Override
public Color getForeground()
{
Color retVal;
Window window = SwingUtilities.getWindowAncestor(this);
boolean hasFoucs = window != null && window.isFocused();
if (fUseEmphasisColor)
retVal = EMPHASIZED_FONT_COLOR;
else if (hasFoucs)
retVal = EMPHASIZED_FOCUSED_FONT_COLOR;
else
retVal = EMPHASIZED_UNFOCUSED_FONT_COLOR;
return retVal;
}
/**
* Paints this label.
*
* @param g the <tt>Graphics</tt> object used for painting
*/
@Override
protected void paintComponent(Graphics g)
{
fUseEmphasisColor = true;
g.translate(0,1);
super.paintComponent(g);
g.translate(0,-1);
fUseEmphasisColor = false;
super.paintComponent(g);
}
}

@ -126,7 +126,9 @@ public SIPCommDialog(Frame owner, boolean isSaveSizeAndLocation)
*/
private void init()
{
this.setContentPane(new SIPCommFrame.MainContentPane());
// If on MacOS we would use the native background.
if (!OSUtils.IS_MAC)
this.setContentPane(new SIPCommFrame.MainContentPane());
this.addWindowListener(new DialogWindowAdapter());

@ -68,7 +68,9 @@ public abstract class SIPCommFrame
*/
public SIPCommFrame()
{
this.setContentPane(new MainContentPane());
// If on MacOS we would use the native background.
if (!OSUtils.IS_MAC)
this.setContentPane(new MainContentPane());
init();

Loading…
Cancel
Save