1) dial buttons added

2) some changes in the buttons behaviour
cusax-fix
Yana Stamcheva 20 years ago
parent cc7012d537
commit ea597f23fc

@ -47,6 +47,7 @@ public CallPanel(){
hangupButtonPressedIcon,
null);
this.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
this.init();
}

@ -92,7 +92,7 @@ public static void main(String[] args){
MainFrame mainFrame = new MainFrame(clist, user);
mainFrame.setTitle("Communicator");
mainFrame.setTitle("SipCommunicator");
mainFrame.setIconImage(LookAndFeelConstants.SIP_LOGO);

@ -109,9 +109,6 @@ else if(this.isMouseOver()){
g2.setPaint(p1);
g2.fillRect(0, this.getHeight() - LookAndFeelConstants.CONTACTPANEL_GRADIENT_SIZE - 1, this.getWidth(), this.getHeight() - 1);
}
g2.setColor(LookAndFeelConstants.CONTACTPANEL_LINES_COLOR);
g2.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1);
}
public boolean isMouseOver() {

@ -20,52 +20,52 @@ public class DialPanel extends JPanel {
private Font buttonTextFont = new Font("Verdana", Font.BOLD, 12);
private SIPCommButton oneButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.ONE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton twoButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.TWO_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton threeButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.THREE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton fourButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.FOUR_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton fiveButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.FIVE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton sixButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.SIX_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton sevenButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.SEVEN_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton eightButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.EIGHT_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton nineButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.NINE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton starButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.STAR_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton zeroButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.ZERO_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton diezButton = new SIPCommButton
(LookAndFeelConstants.DIAL_BUTTON_BG,
LookAndFeelConstants.DIAL_BUTTON_ROLLOVER_BG);
(LookAndFeelConstants.DIEZ_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private JPanel dialPadPanel = new JPanel(new GridLayout(4, 3, 5, 5));
@ -76,7 +76,7 @@ public DialPanel(){
}
public void init(){
oneButton.setFont(this.buttonTextFont);
twoButton.setFont(this.buttonTextFont);
threeButton.setFont(this.buttonTextFont);
@ -89,7 +89,7 @@ public void init(){
zeroButton.setFont(this.buttonTextFont);
diezButton.setFont(this.buttonTextFont);
starButton.setFont(this.buttonTextFont);
dialPadPanel.add(oneButton);
dialPadPanel.add(twoButton);
dialPadPanel.add(threeButton);

@ -27,7 +27,7 @@ public class LookAndFeelConstants {
public static final int MAINFRAME_WIDTH = 30;
public static final int CONTACTPANEL_HEIGHT = 25;
public static final int CONTACTPANEL_HEIGHT = 20;
public static final int CONTACTPANEL_WIDTH = 10;
@ -43,10 +43,10 @@ public class LookAndFeelConstants {
========================================================================*/
public static final Color CONTACTPANEL_SELECTED_START_COLOR =
new Color(166, 207, 239);
new Color(82, 111, 156);
public static final Color CONTACTPANEL_SELECTED_END_COLOR =
new Color(255, 255, 255);
new Color(209, 212, 225);
public static final Color CONTACTPANEL_MOVER_START_COLOR =
new Color(210, 210, 210);
@ -82,13 +82,7 @@ public class LookAndFeelConstants {
public static final Image QUICK_MENU_BUTTON_ROLLOVER_BG = LookAndFeelConstants
.loadImage("../resources/buttons/quickMenuButtonRolloverBg.png");
//public static final Image CALL_BUTTON_ICON = LookAndFeelConstants
// .loadImage("../resources/buttons/callIcon.png");
//public static final Image HANG_UP_BUTTON_ICON = LookAndFeelConstants
// .loadImage("../resources/buttons/hangupIcon.png");
public static final Image CALL_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/callButton.png");
@ -110,12 +104,48 @@ public class LookAndFeelConstants {
public static final Image STATUS_SELECTOR_BOX = LookAndFeelConstants
.loadImage("../resources/buttons/combobox.png");
public static final Image DIAL_BUTTON_BG = LookAndFeelConstants
public static final Image BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/dialButtonBg.png");
public static final Image DIAL_BUTTON_ROLLOVER_BG = LookAndFeelConstants
public static final Image BUTTON_ROLLOVER_BG = LookAndFeelConstants
.loadImage("../resources/buttons/dialButtonRolloverBg.png");
public static final Image ONE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/one.png");
public static final Image TWO_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/two.png");
public static final Image THREE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/three.png");
public static final Image FOUR_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/four.png");
public static final Image FIVE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/five.png");
public static final Image SIX_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/six.png");
public static final Image SEVEN_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/seven.png");
public static final Image EIGHT_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/eight.png");
public static final Image NINE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/nine.png");
public static final Image STAR_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/star.png");
public static final Image ZERO_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/zero.png");
public static final Image DIEZ_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/diez.png");
/*=========================================================================
* ------------------------ STATUS LABELS ---------------------------------
========================================================================*/

@ -22,7 +22,8 @@ public class MainTabbedPane extends JTabbedPane {
public MainTabbedPane(ContactList clist){
ContactListPanel contactList = new ContactListPanel(clist);
//this.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
this.addTab("Contacts", contactList);
this.addTab("Call list", new JPanel());
this.addTab("Dial", dialPanel);

@ -20,12 +20,7 @@
* The quick menu.
*/
public class QuickMenu extends JToolBar{
private Image addButtonIcon = LookAndFeelConstants.QUICK_MENU_ADD_ICON;
private Image configureButtonIcon = LookAndFeelConstants.QUICK_MENU_CONFIGURE_ICON;
private Image searchButtonIcon = LookAndFeelConstants.QUICK_MENU_SEARCH_ICON;
private Image infoButtonIcon = LookAndFeelConstants.QUICK_MENU_INFO_ICON;
SIPCommButton infoButton;
SIPCommButton toolsButton;
SIPCommButton addButton;
@ -37,10 +32,25 @@ public QuickMenu(){
this.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
infoButton = new SIPCommButton(infoButtonIcon);
toolsButton = new SIPCommButton(configureButtonIcon);
searchButton = new SIPCommButton(searchButtonIcon);
addButton = new SIPCommButton(addButtonIcon);
infoButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_INFO_ICON);
toolsButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_CONFIGURE_ICON);
searchButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_SEARCH_ICON);
addButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_ADD_ICON);
this.init();
}

@ -17,6 +17,12 @@
*/
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";
private Image bgImage;
private Image bgRolloverImage;
@ -24,41 +30,84 @@ public class SIPCommButton extends JButton {
private Image iconImage;
private Image pressedImage;
private String iconLayout = SIPCommButton.CENTER_ICON_LAYOUT;
/**
* Default constructor
*/
public SIPCommButton() {
super();
this.bgImage = LookAndFeelConstants.QUICK_MENU_BUTTON_BG;
this.bgRolloverImage = LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG;
this.bgImage = LookAndFeelConstants.BUTTON_BG;
this.bgRolloverImage = LookAndFeelConstants.BUTTON_ROLLOVER_BG;
this.setIcon(new ImageIcon(this.bgImage));
this.setPreferredSize(new Dimension(this.bgImage.getWidth(null),
this.bgImage.getHeight(null)));
}
/**
* Button with text.
*
* @param text
*/
public SIPCommButton(String text) {
super(text);
this.bgImage = LookAndFeelConstants.QUICK_MENU_BUTTON_BG;
this.bgRolloverImage = LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG;
this.bgImage = LookAndFeelConstants.BUTTON_BG;
this.bgRolloverImage = LookAndFeelConstants.BUTTON_ROLLOVER_BG;
this.setPreferredSize(new Dimension(this.bgImage.getWidth(null),
this.bgImage.getHeight(null)));
}
/**
* Button with icon.
*
* @param iconImage
*/
public SIPCommButton(Image iconImage) {
super();
this.iconImage = iconImage;
this.bgImage = LookAndFeelConstants.QUICK_MENU_BUTTON_BG;
this.bgRolloverImage = LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG;
this.bgImage = LookAndFeelConstants.BUTTON_BG;
this.bgRolloverImage = LookAndFeelConstants.BUTTON_ROLLOVER_BG;
this.setPreferredSize(new Dimension(this.bgImage.getWidth(null),
this.bgImage.getHeight(null)));
this.setIcon(new ImageIcon(this.bgImage));
}
/**
* Button with icon.
*
* @param iconImage
*/
public SIPCommButton(Image iconImage, String iconLayout) {
super();
this.iconImage = iconImage;
this.iconLayout = iconLayout;
this.bgImage = LookAndFeelConstants.BUTTON_BG;
this.bgRolloverImage = LookAndFeelConstants.BUTTON_ROLLOVER_BG;
this.setPreferredSize(new Dimension(this.bgImage.getWidth(null),
this.bgImage.getHeight(null)));
this.setIcon(new ImageIcon(this.bgImage));
}
/**
* Custom button.
*
* @param bgImage The background image.
* @param rolloverImage The rollover image
* @param iconImage The icon.
*/
public SIPCommButton (Image bgImage, Image rolloverImage, Image iconImage) {
super();
@ -72,6 +121,14 @@ public SIPCommButton (Image bgImage, Image rolloverImage, Image iconImage) {
this.setIcon(new ImageIcon(this.bgImage));
}
/**
* Custom button.
*
* @param bgImage The background image.
* @param rolloverImage The rollover image
* @param iconImage The button icon.
* @param pressedImage The image when button is pressed.
*/
public SIPCommButton ( Image bgImage,
Image rolloverImage,
Image pressedImage,
@ -100,19 +157,37 @@ public SIPCommButton(Image bgImage, Image rolloverImage) {
this.setIcon(new ImageIcon(this.bgImage));
}
/**
* Paint the SIPCommButton.
*/
public void paint(Graphics g) {
g.drawImage(this.bgImage, 0, 0, this);
if (this.iconImage != null) {
g.drawImage(this.iconImage,
(this.bgImage.getWidth(null) -
this.iconImage.getWidth(null)) / 2,
//draw the button icon depending the current 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);
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.getModel().isRollover()) {
@ -122,11 +197,26 @@ public void paint(Graphics g) {
if (this.iconImage != null) {
g.drawImage(this.iconImage,
(this.bgImage.getWidth(null) -
this.iconImage.getWidth(null)) / 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);
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);
}
}
@ -141,11 +231,26 @@ public void paint(Graphics g) {
if (this.iconImage != null) {
g.drawImage(this.iconImage,
(this.bgImage.getWidth(null) -
this.iconImage.getWidth(null)) / 2 + 1,
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);
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);
}
}
}

Loading…
Cancel
Save