/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
*/
package jalview.gui;
+import jalview.util.MessageManager;
+
import java.awt.Color;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionListener;
+import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
*/
public static String wrapTooltip(boolean enclose, String ttext)
{
-
if (ttext.length() < 60)
{
- return enclose ? "<html>"+ttext+"</html>" : ttext;
+ return enclose ? "<html>" + ttext + "</html>" : ttext;
}
else
{
- return (enclose ? "<html>" : "") + "<table width=350 border=0><tr><td>" + ttext
+ return (enclose ? "<html>" : "")
+ + "<table width=350 border=0><tr><td>" + ttext
+ "</td></tr></table>" + ((enclose ? "</html>" : ""));
}
}
}
}
+ public static void jvInitComponent(AbstractButton comp, String i18nString)
+ {
+ setColorAndFont(comp);
+ if (i18nString != null && !i18nString.isEmpty())
+ {
+ comp.setText(MessageManager.getString(i18nString));
+ }
+ }
+
+ public static void jvInitComponent(JComponent comp)
+ {
+ setColorAndFont(comp);
+ }
+
+ private static void setColorAndFont(JComponent comp)
+ {
+ comp.setBackground(Color.white);
+ comp.setFont(JvSwingUtils.getLabelFont());
+ }
+
}