diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index f63932394..c13b7879a 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -496,11 +496,12 @@ plugin.callhistoryform.INCOMING=Incoming plugin.callhistoryform.OUTGOING=Outgoing # facebookaccregwizz -plugin.facebookaccregwizz.PROTOCOL_NAME=Facebook +plugin.facebookaccregwizz.EXPERIMENTAL_WARNING=
The support for this protocol is experimental and may not work as expected. Please report bugs to dev@sip-communicator.dev.java.net. +plugin.facebookaccregwizz.INVALID_EMAIL_ADDRESS=Invalid email address plugin.facebookaccregwizz.PROTOCOL_DESCRIPTION=The Facebook Chat protocol +plugin.facebookaccregwizz.PROTOCOL_NAME=Facebook plugin.facebookaccregwizz.USERNAME=Email: plugin.facebookaccregwizz.USERNAME_AND_PASSWORD=Email and Password -plugin.facebookaccregwizz.INVALID_EMAIL_ADDRESS=Invalid email address # generalconfig plugin.generalconfig.AUTO_START=Auto - start {0} when computer restarts or reboots. diff --git a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java index d64db96ab..05481d716 100644 --- a/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/facebookaccregwizz/FirstWizardPage.java @@ -21,6 +21,7 @@ * and the password of the account. * * @author Dai Zhiwei + * @author Lubomir Marinov */ public class FirstWizardPage extends TransparentPanel @@ -115,6 +116,14 @@ private void init() valuesPanel.add(emailExampleLabel); valuesPanel.add(passField); + JLabel experimentalWarningLabel + = new JLabel( + Resources.getString( + "plugin.facebookaccregwizz.EXPERIMENTAL_WARNING")); + experimentalWarningLabel.setForeground(Color.RED); + setPreferredWidthInCharCount(experimentalWarningLabel, 50); + + userPassPanel.add(experimentalWarningLabel, BorderLayout.NORTH); userPassPanel.add(labelsPanel, BorderLayout.WEST); userPassPanel.add(valuesPanel, BorderLayout.CENTER); userPassPanel.add(rememberPassBox, BorderLayout.SOUTH); @@ -127,6 +136,34 @@ private void init() this.add(userPassPanel, BorderLayout.NORTH); } + /** + * Sets the preferred width of a specificJLabel to a value
+ * which is likely to cause it to display a specific number of characters
+ * per line. Because setting the preferred width requires also setting the
+ * preferred height, the preferred height is set to a value which is likely
+ * to cause the specified JLabel to display its whole text.
+ *
+ * @param label
+ * the JLabel to set the preferred width of
+ * @param charCount
+ * the number of characters per line to be displayed after
+ * setting the preferred width
+ */
+ private void setPreferredWidthInCharCount(JLabel label, int charCount)
+ {
+ FontMetrics fontMetrics = label.getFontMetrics(label.getFont());
+ String text = label.getText();
+ int textWidth = fontMetrics.stringWidth(text);
+ int labelWidth = charCount * textWidth / text.length();
+
+ label.setPreferredSize(
+ new Dimension(
+ labelWidth,
+ fontMetrics.getHeight()
+ * (textWidth / labelWidth
+ + (textWidth % labelWidth > 0 ? 1 : 0))));
+ }
+
/**
* Implements the WizardPage.getIdentifier to return
* this page identifier.
@@ -317,7 +354,7 @@ private boolean isExistingAccount(String email)
return false;
}
- public Object getSimpleForm()
+ public Object getSimpleForm()
{
return userPassPanel;
}