aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYana Stamcheva <yana@jitsi.org>2008-01-15 00:15:58 +0000
committerYana Stamcheva <yana@jitsi.org>2008-01-15 00:15:58 +0000
commitff416512a02541a4507a16b961b2415aef1f7c22 (patch)
tree5ae7450133ff250c80d867bc1ac6d2fdfd51083f
parent1a31bb3f9e396aa86c5e07d414fc855730a0e52e (diff)
downloadjitsi-ff416512a02541a4507a16b961b2415aef1f7c22.zip
jitsi-ff416512a02541a4507a16b961b2415aef1f7c22.tar.gz
jitsi-ff416512a02541a4507a16b961b2415aef1f7c22.tar.bz2
All Look & feel and GUI color constants are now moved to a properties file in resources folder.
-rw-r--r--src/net/java/sip/communicator/impl/gui/utils/ColorResources.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/utils/ColorResources.java b/src/net/java/sip/communicator/impl/gui/utils/ColorResources.java
new file mode 100644
index 0000000..1efef5d
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/gui/utils/ColorResources.java
@@ -0,0 +1,59 @@
+/*
+ * 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.utils;
+
+import java.util.*;
+
+import net.java.sip.communicator.util.*;
+
+/**
+ * Accesses the color resources saved in the colorResources.properties file.
+ *
+ * @author Yana Stamcheva
+ */
+public class ColorResources
+{
+ /**
+ * Logger for this class.
+ */
+ private static Logger log = Logger.getLogger(ColorResources.class);
+
+ /**
+ * Name of the bundle where we will search for color resources.
+ */
+ private static final String BUNDLE_NAME
+ = "resources.colors.colorResources";
+
+ /**
+ * Bundle which handle access to localized resources.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle( BUNDLE_NAME,
+ Locale.getDefault(),
+ ColorResources.class.getClassLoader());
+
+ /**
+ * Returns an int RGB color corresponding to the given key.
+ *
+ * @param key The key of the string.
+ *
+ * @return An internationalized string corresponding to the given key.
+ */
+ public static int getColor(String key)
+ {
+ try
+ {
+ return Integer.parseInt(RESOURCE_BUNDLE.getString(key), 16);
+ }
+ catch (MissingResourceException e)
+ {
+ log.error("Missing color resource.", e);
+
+ return 0xFFFFFF;
+ }
+ }
+}