diff options
author | Yana Stamcheva <yana@jitsi.org> | 2008-11-13 16:29:29 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2008-11-13 16:29:29 +0000 |
commit | aede2603103d99f8a29a1217c83500c88a6e7e30 (patch) | |
tree | 755a21fde1a4cf0de061226955e036ffa6aa2c47 | |
parent | a42efbc21e10144a792d49d5feffb0f86319775e (diff) | |
download | jitsi-aede2603103d99f8a29a1217c83500c88a6e7e30.zip jitsi-aede2603103d99f8a29a1217c83500c88a6e7e30.tar.gz jitsi-aede2603103d99f8a29a1217c83500c88a6e7e30.tar.bz2 |
Updated and added some new custom components.
14 files changed, 753 insertions, 477 deletions
diff --git a/lib/installer-exclude/laf-widget.jar b/lib/installer-exclude/laf-widget.jar Binary files differnew file mode 100644 index 0000000..4219e85 --- /dev/null +++ b/lib/installer-exclude/laf-widget.jar diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java index bb4acad..2ae495a 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/ChatToolbarButton.java @@ -9,8 +9,6 @@ package net.java.sip.communicator.impl.gui.customcontrols; import java.awt.*; -import net.java.sip.communicator.impl.gui.utils.*; - /** * The <tt>MsgToolbarButton</tt> is a <tt>SIPCommButton</tt> that has * specific background and rollover images. It is used in the chat window @@ -18,17 +16,16 @@ import net.java.sip.communicator.impl.gui.utils.*; * * @author Yana Stamcheva */ -public class ChatToolbarButton extends SIPCommButton { - +public class ChatToolbarButton extends SIPCommButton +{ /** * Creates an instance of <tt>MsgToolbarButton</tt>. * @param iconImage The icon to display on this button. */ - public ChatToolbarButton(Image iconImage) { - super(ImageLoader.getImage(ImageLoader.CHAT_TOOLBAR_BUTTON_BG), - ImageLoader - .getImage(ImageLoader.CHAT_TOOLBAR_ROLLOVER_BUTTON_BG), - iconImage, - null); + public ChatToolbarButton(Image iconImage) + { + super(null, iconImage); + + this.setPreferredSize(new Dimension(26, 26)); } } diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ContactPhotoLabel.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ContactPhotoLabel.java deleted file mode 100644 index 45b2d25..0000000 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/ContactPhotoLabel.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.impl.gui.customcontrols; - -import java.awt.*; - -import javax.swing.*; - -import net.java.sip.communicator.impl.gui.utils.*; -import net.java.sip.communicator.util.*; - -/** - * A custom label, used to show contact images in a frame, where appropriate. - * - * @author Yana Stamcheva - */ -public class ContactPhotoLabel extends JLabel -{ - private Image photoFrameImage - = ImageLoader.getImage(ImageLoader.USER_PHOTO_FRAME); - - private ImageIcon labelIcon; - - /** - * Creates a ContactPhotoLabel by specifying the width and the height of the - * label. These are used to paint the frame in the correct bounds. - * - * @param width the width of the label. - * @param height the height of the label. - */ - public ContactPhotoLabel(int width, int height) - { - this.labelIcon - = ImageUtils.scaleIconWithinBounds( photoFrameImage, - width, - height); - - this.setAlignmentX(CENTER_ALIGNMENT); - this.setAlignmentY(CENTER_ALIGNMENT); - } - - /** - * Overrides {@link JComponent#paintComponent(Graphics)}. - */ - public void paintComponent(Graphics g) - { - super.paintComponent(g); - - g.drawImage(labelIcon.getImage(), 0, 0, null); - } -} diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ErrorDialog.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ErrorDialog.java index 8b0d80d..cf17be8 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/ErrorDialog.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/ErrorDialog.java @@ -49,13 +49,16 @@ public class ErrorDialog private JScrollPane stackTraceScrollPane = new JScrollPane(); - private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + private TransparentPanel buttonsPanel + = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); - private JPanel infoMessagePanel = new JPanel(); + private TransparentPanel infoMessagePanel = new TransparentPanel(); - private JPanel messagePanel = new JPanel(new BorderLayout()); + private TransparentPanel messagePanel + = new TransparentPanel(new BorderLayout()); - private JPanel mainPanel = new JPanel(new BorderLayout(10, 10)); + private TransparentPanel mainPanel + = new TransparentPanel(new BorderLayout(10, 10)); /** * Set visible or hide the details of the error. diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java b/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java new file mode 100644 index 0000000..b9f5a30 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/FramedImage.java @@ -0,0 +1,108 @@ +/* + * 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.impl.gui.customcontrols; + +import java.awt.*; + +import javax.swing.*; + +import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.*; + +/** + * A custom component, used to show contact images in a frame, + * where appropriate. + * + * @author Yana Stamcheva + */ +public class FramedImage + extends JComponent +{ + private ImageIcon shadowIcon; + + private ImageIcon frameIcon; + + private ImageIcon imageIcon; + + private int width; + + private int height; + + /** + * Creates a ContactPhotoLabel by specifying the width and the height of the + * label. These are used to paint the frame in the correct bounds. + * + * @param imageIcon the icon to show within the frame + * @param width the width of the label. + * @param height the height of the label. + */ + public FramedImage(ImageIcon imageIcon, int width, int height) + { + super(); + + this.width = width; + + this.height = height; + + this.setPreferredSize(new Dimension(width, height)); + + Image photoFrameImage + = ImageLoader.getImage(ImageLoader.USER_PHOTO_FRAME); + + this.frameIcon + = ImageUtils.scaleIconWithinBounds( photoFrameImage, + width, + height); + + this.shadowIcon + = ImageUtils.scaleIconWithinBounds( + ImageLoader.getImage(ImageLoader.USER_PHOTO_SHADOW), + width, + height); + + if (imageIcon != null) + { + this.setImageIcon(imageIcon); + } + } + + public FramedImage(int width, int height) + { + this(null, width, height); + } + + public ImageIcon getImageIcon() + { + return imageIcon; + } + + public void setImageIcon(ImageIcon imageIcon) + { + this.imageIcon + = ImageUtils.getScaledRoundedImage( imageIcon.getImage(), + width - 2, + height - 2); + } + + /** + * Overrides {@link JComponent#paintComponent(Graphics)}. + */ + public void paintComponent(Graphics g) + { + g.drawImage(imageIcon.getImage(), + width/2 - imageIcon.getIconWidth()/2, + height/2 - imageIcon.getIconHeight()/2, null); + + g.drawImage(frameIcon.getImage(), + width/2 - frameIcon.getIconWidth()/2, + height/2 - frameIcon.getIconHeight()/2, null); + + g.drawImage(shadowIcon.getImage(), + width/2 - shadowIcon.getIconWidth()/2, + 1, null); + } +} diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/ImageBackgroundViewport.java b/src/net/java/sip/communicator/impl/gui/customcontrols/ImageBackgroundViewport.java deleted file mode 100644 index fb6f587..0000000 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/ImageBackgroundViewport.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.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.*; - -/** - * The <tt>ImageBackgroundViewport</tt> is an extension of JViewport, which - * sets a background image to the viewport. This custom viewport is meant to - * be used by scrollpanes that would like to have the application background - * image as a background. - * - * @author Yana Stamcheva - */ -public class ImageBackgroundViewport extends JViewport -{ - private BufferedImage bgImage; - - private TexturePaint texture; - - private boolean isTextureBackground; - - /** - * Creates an instance of <tt>ImageBackgroundViewport</tt>. - */ - 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); - } - } - - /** - * Paints the background image according to the isTextureBackground - * property. - */ - 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); - } - } - } - - /** - * Sets the view of this JViewport. - * - * @param view the view to set. - */ - public void setView(JComponent view) - { - view.setOpaque(false); - super.setView(view); - } - - /** - * Returns the background image of this viewport. - * - * @return the background image of this viewport. - */ - public Image getBackgroundImage() - { - return bgImage; - } -}
\ No newline at end of file diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java b/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java index 3f111b7..741737f 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/MessageDialog.java @@ -42,13 +42,15 @@ public class MessageDialog private StyledHTMLEditorPane messageArea = new StyledHTMLEditorPane(); - private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + private TransparentPanel buttonsPanel + = new TransparentPanel(new FlowLayout(FlowLayout.CENTER)); - private JPanel checkBoxPanel = new JPanel( - new FlowLayout(FlowLayout.LEADING)); + private TransparentPanel checkBoxPanel + = new TransparentPanel(new FlowLayout(FlowLayout.LEADING)); + + private TransparentPanel messagePanel + = new TransparentPanel(new BorderLayout(5, 5)); - private JPanel messagePanel = new JPanel(new BorderLayout(5, 5)); - private boolean isConfirmationEnabled = true; private int returnCode; diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SCScrollPane.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SCScrollPane.java new file mode 100644 index 0000000..dd55d00 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SCScrollPane.java @@ -0,0 +1,136 @@ +/* + * 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.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 SCScrollPane + extends JScrollPane +{ + private BufferedImage bgImage; + + private TexturePaint texture; + + private boolean isTextureBackground; + + boolean isWindowImageBgEnabled; + + public SCScrollPane() + { + super(); + + this.setBorder(null); + this.setOpaque(false); + + this.setViewport(new SCViewport()); + + this.getVerticalScrollBar().setUnitIncrement(30); + + String windowImageBackgroundProperty + = "net.java.sip.communicator.impl.gui.isWindowImageBackgroundEnabled"; + + isWindowImageBgEnabled = new Boolean(GuiActivator.getResources() + .getSettingsString(windowImageBackgroundProperty)).booleanValue(); + + if (isWindowImageBgEnabled) + this.initBackgroundImage(); + } + + private void initBackgroundImage() + { + 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); + } + } + + /** + * Sets the view of this JViewport. + * + * @param view the view to set. + */ + public void setViewportView(JComponent view) + { + view.setOpaque(false); + view.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); + + super.setViewportView(view); + } + + private class SCViewport extends JViewport + { + public SCViewport() + { + this.setOpaque(false); + this.setBorder(null); + } + + public void paintComponent(Graphics g) + { + super.paintComponent(g); + + Graphics2D g2 = (Graphics2D) g; + + AntialiasingManager.activateAntialiasing(g2); + + g2.setColor(Color.WHITE); + + g2.fillRoundRect(0, 0, + this.getWidth() - 1, + this.getHeight() - 1, + 15, 15); + + g2.setColor(Color.GRAY); + + g2.drawRoundRect(0, 0, + this.getWidth() - 1, + this.getHeight() - 1, 15, 15); + + // paint the image + if (isWindowImageBgEnabled && bgImage != null) + { + 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); + } + } + } + } +} diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java index 134a0f7..a1e06f8 100755 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommButton.java @@ -7,9 +7,12 @@ package net.java.sip.communicator.impl.gui.customcontrols; import java.awt.*; +import java.awt.event.*; import javax.swing.*; +import org.jvnet.lafwidget.animation.*; + import net.java.sip.communicator.impl.gui.utils.*; /** @@ -18,65 +21,66 @@ import net.java.sip.communicator.impl.gui.utils.*; * * @author Yana Stamcheva */ -public class SIPCommButton extends JButton { - - public static final String LEFT_ICON_LAYOUT = "left"; - - public static final String CENTER_ICON_LAYOUT = "center"; - - public static final String RIGHT_ICON_LAYOUT = "right"; - +public class SIPCommButton + extends JButton +{ private Image bgImage; - private Image bgRolloverImage; - - private Image iconImage; - private Image pressedImage; - private String iconLayout = SIPCommButton.CENTER_ICON_LAYOUT; + private Image iconImage; /** - * Creates a button with custom background image, rollover image and - * icon image. + * Creates a button with custom background image and icon image. * * @param bgImage The background image. - * @param rolloverImage The rollover image. * @param iconImage The icon. */ - public SIPCommButton(Image bgImage, - Image rolloverImage, - Image iconImage, - Image pressedImage) { + public SIPCommButton( Image bgImage, + Image pressedImage, + Image iconImage) + { super(); + MouseRolloverHandler mouseHandler = new MouseRolloverHandler(); + + this.addMouseListener(mouseHandler); + this.addMouseMotionListener(mouseHandler); + this.bgImage = bgImage; - this.bgRolloverImage = rolloverImage; - this.iconImage = iconImage; this.pressedImage = pressedImage; + this.iconImage = iconImage; - this.setPreferredSize(new Dimension(this.bgImage.getWidth(null), - this.bgImage.getHeight(null))); + if (bgImage != null) + { + this.setPreferredSize(new Dimension(bgImage.getWidth(null), + bgImage.getHeight(null))); - this.setIcon(new ImageIcon(this.bgImage)); + this.setIcon(new ImageIcon(this.bgImage)); + } } /** - * Creates a button with custom background image and rollover image. + * Creates a button with custom background image. * * @param bgImage The background button image. - * @param rolloverImage The rollover button image. */ - public SIPCommButton(Image bgImage, Image rolloverImage) { - super(); - - this.bgImage = bgImage; - this.bgRolloverImage = rolloverImage; + public SIPCommButton( Image bgImage, + Image iconImage) + { + this(bgImage, null, iconImage); + } - this.setPreferredSize(new Dimension(this.bgImage.getWidth(null), - this.bgImage.getHeight(null))); + /** + * Creates a button with custom background image. + * + * @param bgImage The background button image. + */ + public SIPCommButton(Image bgImage) + { + this(bgImage, null); } - + /** * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> * to paint the button background and icon, and all additional effects @@ -95,7 +99,8 @@ public class SIPCommButton extends JButton { * non-opaque color. If you do not honor the opaque property you will * likely see visual artifacts. */ - if (isOpaque()) { + if (isOpaque()) + { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); } @@ -104,181 +109,159 @@ public class SIPCommButton extends JButton { { // If there's no icon, we make grey the backgroundImage // when disabled. - if (this.iconImage == null && !isEnabled()) { - Image disabledImage = new ImageIcon(LightGrayFilter + Image paintBgImage; + if (this.iconImage == null && !isEnabled()) + { + paintBgImage = new ImageIcon(LightGrayFilter .createDisabledImage(bgImage)).getImage(); - - g.drawImage(disabledImage, 0, 0, this); - } - else { - g.drawImage(this.bgImage, 0, 0, this); } + else + paintBgImage = bgImage; + + g.drawImage(paintBgImage, + this.getWidth()/2 - this.bgImage.getWidth(null)/2, + this.getHeight()/2 - this.bgImage.getHeight(null)/2, + this); } - if (this.iconImage != null) { - if (!isEnabled()) { - Image disabledImage = new ImageIcon(LightGrayFilter + if (this.iconImage != null) + { + Image paintIconImage; + if (!isEnabled()) + { + paintIconImage = new ImageIcon(LightGrayFilter .createDisabledImage(iconImage)).getImage(); - - // draw the button icon depending the current button layout - if (this.iconLayout - .equals(SIPCommButton.CENTER_ICON_LAYOUT)) { - g.drawImage(disabledImage, - (this.bgImage.getWidth(null) - disabledImage - .getWidth(null)) / 2, (this.bgImage - .getHeight(null) - disabledImage - .getHeight(null)) / 2, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(disabledImage, 7, - (this.bgImage.getHeight(null) - disabledImage - .getHeight(null)) / 2, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(disabledImage, this.bgImage.getWidth(null) - 3, - (this.bgImage.getHeight(null) - disabledImage - .getHeight(null)) / 2, this); - } - } else { - // draw the button icon depending the current button layout - if (this.iconLayout - .equals(SIPCommButton.CENTER_ICON_LAYOUT)) { - g.drawImage(this.iconImage, - (this.bgImage.getWidth(null) - this.iconImage - .getWidth(null)) / 2, (this.bgImage - .getHeight(null) - this.iconImage - .getHeight(null)) / 2, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(this.iconImage, 7, - (this.bgImage.getHeight(null) - this.iconImage - .getHeight(null)) / 2, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(this.iconImage, - this.bgImage.getWidth(null) - 3, (this.bgImage - .getHeight(null) - this.iconImage - .getHeight(null)) / 2, this); - } } + else + paintIconImage = iconImage; + g.drawImage(paintIconImage, + this.getWidth()/2 - this.iconImage.getWidth(null)/2, + this.getHeight()/2 - this.iconImage.getHeight(null)/2, + this); } - if (this.bgRolloverImage != null && this.getModel().isRollover()) { + // Rollover state. + FadeTracker fadeTracker = FadeTracker.getInstance(); - g.drawImage(this.bgRolloverImage, 0, 0, this); + float visibility = this.getModel().isRollover() ? 1.0f : 0.0f; + if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) + { + visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER); + } - if (this.iconImage != null) { + g.setColor(new Color(1.0f, 1.0f, 1.0f, visibility/2)); - if (this.iconLayout - .equals(SIPCommButton.CENTER_ICON_LAYOUT)) { - g.drawImage(this.iconImage, - (this.bgImage.getWidth(null) - this.iconImage - .getWidth(null)) / 2, (this.bgImage - .getHeight(null) - this.iconImage - .getHeight(null)) / 2, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(this.iconImage, 7, - (this.bgImage.getHeight(null) - this.iconImage - .getHeight(null)) / 2, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(this.iconImage, - this.bgImage.getWidth(null) - 3, (this.bgImage - .getHeight(null) - this.iconImage - .getHeight(null)) / 2, this); - } - } + if (this.bgImage != null) + { + g.fillRoundRect(this.getWidth()/2 - this.bgImage.getWidth(null)/2, + this.getHeight()/2 - this.bgImage.getHeight(null)/2, + bgImage.getWidth(null), bgImage.getHeight(null), + 10, 10); + } + else + { + g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 10, 10); } - if (this.getModel().isPressed()) { - - if (this.pressedImage != null) { + // Pressed state. + if (this.getModel().isPressed()) + { + if (this.pressedImage != null) + { g.drawImage(this.pressedImage, 0, 0, this); - } else { - - g.drawImage(this.bgRolloverImage, 0, 0, this); - - if (this.iconImage != null) { - - if (this.iconLayout - .equals(SIPCommButton.CENTER_ICON_LAYOUT)) { - g.drawImage(this.iconImage, - (this.bgImage.getWidth(null) - this.iconImage - .getWidth(null)) / 2 + 1, (this.bgImage - .getHeight(null) - this.iconImage - .getHeight(null)) / 2 + 1, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(this.iconImage, 7 + 1, (this.bgImage - .getHeight(null) - this.iconImage - .getHeight(null)) / 2 + 1, this); - } - else if (this.iconLayout - .equals(SIPCommButton.LEFT_ICON_LAYOUT)) { - g.drawImage(this.iconImage, - this.bgImage.getWidth(null) - 3 + 1, - (this.bgImage.getHeight(null) - this.iconImage - .getHeight(null)) / 2 + 1, this); - } - } + } + else if (this.iconImage != null) + { + g.drawImage(this.iconImage, + this.getWidth()/2 - this.iconImage.getWidth(null)/2 + 1, + this.getHeight()/2 - this.iconImage.getHeight(null)/2 + 1, + this); } } } - /** - * Returns the background image of this button. - * @return the background image of this button. - */ - public Image getBgImage() { + public Image getBackgroundImage() + { return bgImage; } - /** - * Sets the background image to this button. - * @param bgImage The background image to set. - */ - public void setBgImage(Image bgImage) { + public void setBackgroundImage(Image bgImage) + { this.bgImage = bgImage; } - /** - * Returns the background rollover image of this button. - * @return the background rollover image of this button. - */ - public Image getBgRolloverImage() { - return bgRolloverImage; - } + protected class ButtonRepaintCallback implements FadeTrackerCallback + { + public void fadeEnded(FadeKind arg0) + { + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + SIPCommButton.this.repaint(); + } + }); + } - /** - * Sets the background rollover image to this button. - * @param bgRolloverImage The background rollover image to set. - */ - public void setBgRolloverImage(Image bgRolloverImage) { - this.bgRolloverImage = bgRolloverImage; - } + public void fadePerformed(FadeKind arg0, float arg1) + { + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + SIPCommButton.this.repaint(); + } + }); + } - /** - * Returns the icon image of this button. - * @return the icon image of this button. - */ - public Image getIconImage() { - return iconImage; + public void fadeReversed(FadeKind arg0, boolean arg1, float arg2) + { + + } } - /** - * Sets the icon image to this button. - * @param iconImage The icon image to set. - */ - public void setIconImage(Image iconImage) { - this.iconImage = iconImage; + protected class MouseRolloverHandler + implements MouseListener, + MouseMotionListener + { + public void mouseMoved(MouseEvent e) + {} + + public void mouseExited(MouseEvent e) + { + getModel().setRollover(false); + + FadeTracker fadeTracker = FadeTracker.getInstance(); + + fadeTracker.trackFadeOut(FadeKind.ROLLOVER, + SIPCommButton.this, + true, + new ButtonRepaintCallback()); + } + + public void mouseClicked(MouseEvent e) + {} + + public void mouseEntered(MouseEvent e) + { + getModel().setRollover(true); + + FadeTracker fadeTracker = FadeTracker.getInstance(); + + fadeTracker.trackFadeIn(FadeKind.ROLLOVER, + SIPCommButton.this, + true, + new ButtonRepaintCallback()); + } + + public void mousePressed(MouseEvent e) + {} + + public void mouseReleased(MouseEvent e) + {} + + public void mouseDragged(MouseEvent e) + {} } } diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java index b9d8252..730b7d5 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommDialog.java @@ -8,61 +8,71 @@ package net.java.sip.communicator.impl.gui.customcontrols; import java.awt.*; import java.awt.event.*; +import java.awt.geom.*; import javax.swing.*; import net.java.sip.communicator.impl.gui.*; +import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.util.*; public abstract class SIPCommDialog extends JDialog { private Logger logger = Logger.getLogger(SIPCommDialog.class); - + private ActionMap amap; private InputMap imap; - + private boolean isSaveSizeAndLocation = true; public SIPCommDialog() { - this.addWindowListener(new DialogWindowAdapter()); + super(); - this.initInputMap(); + this.init(); } public SIPCommDialog(Dialog owner) { super(owner); - - this.addWindowListener(new DialogWindowAdapter()); - - this.initInputMap(); + + this.init(); } public SIPCommDialog(Frame owner) { super(owner); - - this.addWindowListener(new DialogWindowAdapter()); - - this.initInputMap(); + + this.init(); } public SIPCommDialog(Dialog owner, boolean isSaveSizeAndLocation) { this(owner); - + this.isSaveSizeAndLocation = isSaveSizeAndLocation; } - + public SIPCommDialog(Frame owner, boolean isSaveSizeAndLocation) { this(owner); - + this.isSaveSizeAndLocation = isSaveSizeAndLocation; } - + + /** + * Initializes this dialog. + */ + private void init() + { + this.setContentPane(new MainContentPane()); + + this.addWindowListener(new DialogWindowAdapter()); + + this.initInputMap(); + } + private void initInputMap() { amap = this.getRootPane().getActionMap(); @@ -362,6 +372,100 @@ public abstract class SIPCommDialog extends JDialog super.dispose(); } + private class MainContentPane extends JPanel + { + Color bgStartColor = new Color(GuiActivator.getResources() + .getColor("mainBackgroundStartColor")); + + Color bgEndColor = new Color(GuiActivator.getResources() + .getColor("mainBackgroundEndColor")); + + GeneralPath headerBackground = new GeneralPath(); + + public MainContentPane() + { + super(new BorderLayout()); + + this.setBackground(new Color( + GuiActivator.getResources() + .getColor("desktopBackgroundColor"))); + + int borderSize = GuiActivator.getResources() + .getSettingsInt("mainWindowBorderSize"); + + this.setBorder(BorderFactory + .createEmptyBorder( borderSize, + borderSize, + borderSize, + borderSize)); + } + + public void paintComponent(Graphics g) + { + super.paintComponent(g); + + Graphics2D g2 = (Graphics2D) g; + + AntialiasingManager.activateAntialiasing(g2); + + GradientPaint bgGradientColor + = new GradientPaint(this.getWidth()/2, 0, + bgStartColor, + this.getWidth()/2, + 80, + bgEndColor); + + GradientPaint borderShadow = new GradientPaint(0, 0, + new Color(255, 255, 255, 200), + this.getWidth(), + this.getHeight(), + new Color(0, 0, 0, 150)); + + g2.setPaint(borderShadow); + g2.fillRoundRect(3, 3, + this.getWidth() - 6, + this.getHeight() - 6, + 10, 10); + + g2.setPaint(bgGradientColor); + g2.fillRoundRect(5, 5, this.getWidth() - 10, 80, 10, 10); + + g2.setColor(bgEndColor); + g2.fillRoundRect(5, 80, + this.getWidth() - 10, + this.getHeight() - 85, 10, 10); + + GradientPaint curveShadow = new GradientPaint(0, 0, + new Color(255, 255, 255, 150), + this.getWidth(), + this.getHeight(), + new Color(255, 255, 255, 50)); + + g2.setPaint(curveShadow); + g2.setStroke(new BasicStroke(1f)); + CubicCurve2D curve1 = new CubicCurve2D.Float( + 50, -1, 250, 30, 50, 150, 0, 300); + + g2.draw(curve1); + + CubicCurve2D curve2 = new CubicCurve2D.Float( + this.getWidth() - 20, 0, + this.getWidth(), 100, + this.getWidth()/2, 100, + 0, 150); + + g2.draw(curve2); + + CubicCurve2D curve3 = new CubicCurve2D.Float( + 0, 90, + this.getWidth()/3, 60, + 2*this.getWidth()/3, 60, + this.getWidth(), 90); + + g2.draw(curve3); + } + } + /** * All functions implemented in this method will be invoked when user * presses the Escape key. diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java index 6974c4f..3a34f7a 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommFrame.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.impl.gui.customcontrols; import java.awt.*; import java.awt.event.*; +import java.awt.geom.*; import java.util.*; import javax.swing.*; @@ -36,8 +37,6 @@ public abstract class SIPCommFrame public SIPCommFrame() { - this.setContentPane(new MainPanel()); - this.init(); } @@ -46,6 +45,8 @@ public abstract class SIPCommFrame */ private void init() { + this.setContentPane(new MainContentPane()); + this.setIconImage( ImageLoader.getImage(ImageLoader.SIP_COMMUNICATOR_LOGO)); @@ -401,28 +402,97 @@ public abstract class SIPCommFrame } } - private class MainPanel extends JPanel + private class MainContentPane extends JPanel { - public MainPanel() + Color bgStartColor = new Color(GuiActivator.getResources() + .getColor("mainBackgroundStartColor")); + + Color bgEndColor = new Color(GuiActivator.getResources() + .getColor("mainBackgroundEndColor")); + + GeneralPath headerBackground = new GeneralPath(); + + public MainContentPane() { super(new BorderLayout()); - this.setOpaque(false); + this.setBackground(new Color( + GuiActivator.getResources() + .getColor("desktopBackgroundColor"))); + + int borderSize = GuiActivator.getResources() + .getSettingsInt("mainWindowBorderSize"); + + this.setBorder(BorderFactory + .createEmptyBorder( borderSize, + borderSize, + borderSize, + borderSize)); } - protected void paintComponent(Graphics g) + public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - g2.setColor(new Color(255, 255, 255, - ConfigurationManager.getWindowTransparency())); - - g2.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 5, 5); + AntialiasingManager.activateAntialiasing(g2); + + GradientPaint bgGradientColor + = new GradientPaint(this.getWidth()/2, 0, + bgStartColor, + this.getWidth()/2, + 80, + bgEndColor); + + GradientPaint borderShadow = new GradientPaint(0, 0, + new Color(255, 255, 255, 200), + this.getWidth(), + this.getHeight(), + new Color(0, 0, 0, 150)); + + g2.setPaint(borderShadow); + g2.fillRoundRect(3, 3, + this.getWidth() - 6, + this.getHeight() - 6, + 10, 10); + + g2.setPaint(bgGradientColor); + g2.fillRoundRect(5, 5, this.getWidth() - 10, 80, 10, 10); + + g2.setColor(bgEndColor); + g2.fillRoundRect(5, 80, + this.getWidth() - 10, + this.getHeight() - 85, 10, 10); + + GradientPaint curveShadow = new GradientPaint(0, 0, + new Color(255, 255, 255, 150), + this.getWidth(), + this.getHeight(), + new Color(255, 255, 255, 50)); + + g2.setPaint(curveShadow); + g2.setStroke(new BasicStroke(1f)); + CubicCurve2D curve1 = new CubicCurve2D.Float( + 50, -1, 250, 30, 50, 150, 0, 300); + + g2.draw(curve1); + + CubicCurve2D curve2 = new CubicCurve2D.Float( + this.getWidth() - 20, 0, + this.getWidth(), 100, + this.getWidth()/2, 100, + 0, 150); + + g2.draw(curve2); + + CubicCurve2D curve3 = new CubicCurve2D.Float( + 0, 90, + this.getWidth()/3, 60, + 2*this.getWidth()/3, 60, + this.getWidth(), 90); + + g2.draw(curve3); } } diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommTabbedPane.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommTabbedPane.java index b8c4d19..a711792 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommTabbedPane.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommTabbedPane.java @@ -15,7 +15,6 @@ import java.awt.*; import java.awt.event.*; import java.util.*; -import javax.accessibility.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; @@ -34,9 +33,8 @@ public class SIPCommTabbedPane extends JTabbedPane implements ChangeListener { - private int overTabIndex = -1; - + private int lastSelectedIndex; /** @@ -46,31 +44,40 @@ public class SIPCommTabbedPane * @param closingTabs support for closable tabs * @param maximizingTabs support for maximisable tabs */ - public SIPCommTabbedPane(boolean closingTabs, boolean maximizingTabs) { + public SIPCommTabbedPane(boolean closingTabs, boolean maximizingTabs) + { super.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); - + + UIManager.getDefaults() + .put("TabbedPane.tabAreaInsets", new Insets(0, 5, 0, 0)); + + UIManager.getDefaults() + .put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0)); + this.setUI(new SIPCommTabbedPaneEnhancedUI()); if(closingTabs) this.setCloseIcon(true); - + if(maximizingTabs) this.setMaxIcon(true); - + this.addChangeListener(this); } /** * Returns the index of the last tab on which the mouse did an action. */ - public int getOverTabIndex() { + public int getOverTabIndex() + { return overTabIndex; } /** * Returns <code>true</code> if the close icon is enabled. */ - public boolean isCloseEnabled() { + public boolean isCloseEnabled() + { SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); return ui.isCloseEnabled(); } @@ -78,7 +85,8 @@ public class SIPCommTabbedPane /** * Returns <code>true</code> if the max/detach icon is enabled. */ - public boolean isMaxEnabled() { + public boolean isMaxEnabled() + { SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); return ui.isMaxEnabled(); } @@ -87,14 +95,16 @@ public class SIPCommTabbedPane * Override JTabbedPane method. Does nothing. * @param tabLayoutPolicy The tab layout policy. */ - public void setTabLayoutPolicy(int tabLayoutPolicy) { + public void setTabLayoutPolicy(int tabLayoutPolicy) + { } /** * Override JTabbedPane method. Does nothing. * @param tabPlacement The tab placement. */ - public void setTabPlacement(int tabPlacement) { + public void setTabPlacement(int tabPlacement) + { } /** @@ -102,7 +112,8 @@ public class SIPCommTabbedPane * * @param b whether the tabbedPane should have a close icon or not */ - public void setCloseIcon(boolean b) { + public void setCloseIcon(boolean b) + { SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); ui.setCloseIcon(b); } @@ -112,7 +123,8 @@ public class SIPCommTabbedPane * * @param b whether the tabbedPane should have a max/detach icon or not */ - public void setMaxIcon(boolean b) { + public void setMaxIcon(boolean b) + { SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); ui.setMaxIcon(b); } @@ -123,8 +135,8 @@ public class SIPCommTabbedPane * * @param index index of the tabbedPane to be detached */ - public void detachTab(int index) { - + public void detachTab(int index) + { if (index < 0 || index >= getTabCount()) return; @@ -208,7 +220,8 @@ public class SIPCommTabbedPane * @see #fireCloseTabEvent * @see #removeCloseListener */ - public synchronized void addCloseListener(CloseListener l) { + public synchronized void addCloseListener(CloseListener l) + { listenerList.add(CloseListener.class, l); } @@ -219,7 +232,8 @@ public class SIPCommTabbedPane * @see #fireMaxTabEvent * @see #removeMaxListener */ - public synchronized void addMaxListener(MaxListener l) { + public synchronized void addMaxListener(MaxListener l) + { listenerList.add(MaxListener.class, l); } @@ -230,7 +244,8 @@ public class SIPCommTabbedPane * @see #fireDoubleClickTabEvent * @see #removeDoubleClickListener */ - public synchronized void addDoubleClickListener(DoubleClickListener l) { + public synchronized void addDoubleClickListener(DoubleClickListener l) + { listenerList.add(DoubleClickListener.class, l); } @@ -241,7 +256,8 @@ public class SIPCommTabbedPane * @see #firePopupOutsideTabEvent * @see #removePopupOutsideListener */ - public synchronized void addPopupOutsideListener(PopupOutsideListener l) { + public synchronized void addPopupOutsideListener(PopupOutsideListener l) + { listenerList.add(PopupOutsideListener.class, l); } @@ -252,7 +268,8 @@ public class SIPCommTabbedPane * @see #fireCloseTabEvent * @see #addCloseListener */ - public synchronized void removeCloseListener(CloseListener l) { + public synchronized void removeCloseListener(CloseListener l) + { listenerList.remove(CloseListener.class, l); } @@ -263,7 +280,8 @@ public class SIPCommTabbedPane * @see #fireMaxTabEvent * @see #addMaxListener */ - public synchronized void removeMaxListener(MaxListener l) { + public synchronized void removeMaxListener(MaxListener l) + { listenerList.remove(MaxListener.class, l); } @@ -275,7 +293,8 @@ public class SIPCommTabbedPane * @see #fireDoubleClickTabEvent * @see #addDoubleClickListener */ - public synchronized void removeDoubleClickListener(DoubleClickListener l) { + public synchronized void removeDoubleClickListener(DoubleClickListener l) + { listenerList.remove(DoubleClickListener.class, l); } @@ -288,7 +307,8 @@ public class SIPCommTabbedPane * @see #addPopupOutsideListener */ public synchronized void removePopupOutsideListener( - PopupOutsideListener l) { + PopupOutsideListener l) + { listenerList.remove(PopupOutsideListener.class, l); } @@ -307,11 +327,13 @@ public class SIPCommTabbedPane * * @see #addCloseListener */ - public void fireCloseTabEvent(MouseEvent e, int overTabIndex) { + public void fireCloseTabEvent(MouseEvent e, int overTabIndex) + { this.overTabIndex = overTabIndex; EventListener[] closeListeners = getListeners(CloseListener.class); - for (int i = 0; i < closeListeners.length; i++) { + for (int i = 0; i < closeListeners.length; i++) + { ((CloseListener) closeListeners[i]).closeOperation(e); } } @@ -331,11 +353,13 @@ public class SIPCommTabbedPane * * @see #addMaxListener */ - public void fireMaxTabEvent(MouseEvent e, int overTabIndex) { + public void fireMaxTabEvent(MouseEvent e, int overTabIndex) + { this.overTabIndex = overTabIndex; EventListener[] maxListeners = getListeners(MaxListener.class); - for (int i = 0; i < maxListeners.length; i++) { + for (int i = 0; i < maxListeners.length; i++) + { ((MaxListener) maxListeners[i]).maxOperation(e); } } @@ -355,12 +379,14 @@ public class SIPCommTabbedPane * * @see #addDoubleClickListener */ - public void fireDoubleClickTabEvent(MouseEvent e, int overTabIndex) { + public void fireDoubleClickTabEvent(MouseEvent e, int overTabIndex) + { this.overTabIndex = overTabIndex; EventListener[] dClickListeners = getListeners(DoubleClickListener.class); - for (int i = 0; i < dClickListeners.length; i++) { + for (int i = 0; i < dClickListeners.length; i++) + { ((DoubleClickListener) dClickListeners[i]).doubleClickOperation(e); } } @@ -377,12 +403,14 @@ public class SIPCommTabbedPane * * @see #addPopupOutsideListener */ - public void firePopupOutsideTabEvent(MouseEvent e) { + public void firePopupOutsideTabEvent(MouseEvent e) + { this.overTabIndex = -1; EventListener[] popupListeners = getListeners(PopupOutsideListener.class); - for (int i = 0; i < popupListeners.length; i++) { + for (int i = 0; i < popupListeners.length; i++) + { ((PopupOutsideListener) popupListeners[i]).popupOutsideOperation(e); } } @@ -392,10 +420,11 @@ public class SIPCommTabbedPane * hightlight if the tab which is selected. * @param tabIndex The index of the tab to be selected. */ - public void setSelectedIndex(int tabIndex) { - + public void setSelectedIndex(int tabIndex) + { SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); - if (ui.isTabHighlighted(tabIndex)) { + if (ui.isTabHighlighted(tabIndex)) + { ui.tabRemoveHighlight(tabIndex); } super.setSelectedIndex(tabIndex); @@ -406,8 +435,10 @@ public class SIPCommTabbedPane * * @param tabIndex The tab index. */ - public void highlightTab(int tabIndex) { + public void highlightTab(int tabIndex) + { SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); + if (!ui.isTabHighlighted(tabIndex) && this.getSelectedIndex() != tabIndex) ui.tabAddHightlight(tabIndex); diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/TitlePanel.java b/src/net/java/sip/communicator/impl/gui/customcontrols/TitlePanel.java index f0abf57..1375f66 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/TitlePanel.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/TitlePanel.java @@ -1,38 +1,36 @@ /* * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. - * - * Distributable under LGPL license. - * See terms of license at gnu.org. + * + * Distributable under LGPL license. See terms of license at gnu.org. */ package net.java.sip.communicator.impl.gui.customcontrols; import java.awt.*; -import javax.swing.*; -import net.java.sip.communicator.impl.gui.utils.*; +import javax.swing.*; /** - * The <tt>TitlePanel</tt> is a decorated panel, that could be used for a - * header or a title area. This panel is used for example in the + * The <tt>TitlePanel</tt> is a decorated panel, that could be used for a header + * or a title area. This panel is used for example in the * <tt>ConfigurationFrame</tt>. * * @author Yana Stamcheva */ -public class TitlePanel extends JPanel { - +public class TitlePanel + extends TransparentPanel +{ private JLabel titleLabel = new JLabel(); - /** - * The size of the gradient used for painting the background of some - * components. - */ - private static final int GRADIENT_SIZE = 10; + private Color gradientStartColor = new Color(255, 255, 255, 200); + + private Color gradientEndColor = new Color(255, 255, 255, 50); /** * Creates an instance of <tt>TitlePanel</tt>. */ - public TitlePanel() { + public TitlePanel() + { super(new FlowLayout(FlowLayout.CENTER)); @@ -47,8 +45,8 @@ public class TitlePanel extends JPanel { * * @param title A String title. */ - public TitlePanel(String title) { - + public TitlePanel(String title) + { super(new FlowLayout(FlowLayout.CENTER)); this.titleLabel.setFont(this.getFont().deriveFont(Font.BOLD, 14)); @@ -59,50 +57,37 @@ public class TitlePanel extends JPanel { } /** - * Overrides the <code>paintComponent</code> method of <tt>JPanel</tt> - * to paint a gradient background of this panel. + * Overrides the <code>paintComponent</code> method of <tt>JPanel</tt> to + * paint a gradient background of this panel. */ - public void paintComponent(Graphics g) { + public void paintComponent(Graphics g) + { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; - GradientPaint p = new GradientPaint(this.getWidth() / 2, 0, - Constants.GRADIENT_DARK_COLOR, this.getWidth() / 2, - GRADIENT_SIZE, - Constants.GRADIENT_LIGHT_COLOR); - - GradientPaint p1 = new GradientPaint(this.getWidth() / 2, this - .getHeight() - - GRADIENT_SIZE, - Constants.GRADIENT_LIGHT_COLOR, this.getWidth() / 2, - this.getHeight(), Constants.GRADIENT_DARK_COLOR); + GradientPaint p = + new GradientPaint(this.getWidth() / 2, 0, + gradientStartColor, + this.getWidth() / 2, + getHeight(), + gradientEndColor); g2.setPaint(p); - g2.fillRect(0, 0, this.getWidth(), GRADIENT_SIZE); - - g2.setColor(Constants.GRADIENT_LIGHT_COLOR); - g2.fillRect(0, GRADIENT_SIZE, this.getWidth(), - this.getHeight() - GRADIENT_SIZE); - - g2.setPaint(p1); - g2.fillRect(0, this.getHeight() - GRADIENT_SIZE - - 1, this.getWidth(), this.getHeight() - 1); - - g2.setColor(Constants.BORDER_COLOR); - g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 5, 5); + g2.fillRoundRect(0, 0, this.getWidth(), getHeight(), 10, 10); } /** * Sets the title String. + * * @param title The title String. */ public void setTitleText(String title) { this.removeAll(); - + this.titleLabel.setText(title); - + this.add(titleLabel); } } diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/TransparentPanel.java b/src/net/java/sip/communicator/impl/gui/customcontrols/TransparentPanel.java new file mode 100644 index 0000000..1c00a3e --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/TransparentPanel.java @@ -0,0 +1,23 @@ +package net.java.sip.communicator.impl.gui.customcontrols; + +import java.awt.*; + +import javax.swing.*; + +public class TransparentPanel + extends JPanel +{ + public TransparentPanel () + { + super(); + + this.setOpaque(false); + } + + public TransparentPanel (LayoutManager layoutManager) + { + super(layoutManager); + + this.setOpaque(false); + } +} |