Results 1 to 8 of 8
Thread: Tooltip HTML format problem
- 07-14-2011, 09:32 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
Tooltip HTML format problem
I am using an HTML formatted tool tip on a JButton.
All is fine the first time I launch my applet.
However, if I close the Applet browser window and re-launch, the tool tip is blank.
This is only for <html> formatted text, non-HTML strings are fine.
It is not browser specific (same behavior for IE,FF,SF,etc).
Is this a known problem, or maybe I'm missing something?
example:
btn.setToolTipText("<html>does not work after re-launch</html>");
btn.setToolTipText("works fine after re-launch");
- 07-14-2011, 10:11 PM #2
Hard to understand how a program will work one time and then not another.
Is there a difference when you load the html page in the browser between the time it works and the time it doesn't work?
Or is this a case of you moving off the html page with the applet and coming back to it?
The applet has methods that are called when that happens.
- 07-14-2011, 10:17 PM #3
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
I'm not doing anything funky. The HTML <APPLET> tags is also quite generic
Java Code:<APPLET ARCHIVE = "/java/test/MyApplet.jar" CODE = "test/MyApplet.class" NAME = "test" HEIGHT = "100%" WIDTH = "100%" MAYSCRIPT > </APPLET>
Java Code:package test; import java.awt.event.*; import javax.swing.*; public class MyApplet extends javax.swing.JApplet implements Runnable { public static final long serialVersionUID = 1L; private final String TT_HTML = "<html>HTML</html>"; private final String TT_NON_HTML = "NonHTML"; /** Initializes the MyApplet */ public void init() { initComponents(); } public void start(){ updateBtnControl(); } public void run() { } private void updateBtnControl() { String tt = btnControl.getToolTipText(); if ((tt==null) || (tt.equalsIgnoreCase(TT_HTML))) { btnControl.setToolTipText(TT_NON_HTML); } else { btnControl.setToolTipText(TT_HTML); } } // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { btnControl = new javax.swing.JButton(); btnControl.setFocusable(false); btnControl.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnControl.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnControl.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnControlActionPerformed(evt); } }); getContentPane().add(btnControl, java.awt.BorderLayout.CENTER); }// </editor-fold> private void btnControlActionPerformed(java.awt.event.ActionEvent evt) { updateBtnControl(); } // Variables declaration - do not modify private javax.swing.JButton btnControl; // End of variables declaration }
- 07-14-2011, 10:37 PM #4
What's supposed to happen when the applet is loaded in a browser?
I get a full screen button with no text.
Then what?
- 07-14-2011, 10:43 PM #5
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
Norm;
Yes, that sounds about right.
I stripped my Applet down to bare bones for demonstration purposes.
You are looking at a big button with no text or icon.
The tool tip toggles every time to click this button (after a mouse over).
You should notice that the tool tip will toggle between "HTML" and "NonHTML".
If you kill the browser and relaunch, the "HTML" tool tip goes away.
I am also creating my window something like;
javascript:void(window.open(\"/launch.html\",\"1062731320\",\"status=yes,scrollba rs=yes,resizable=yes,menubar=no,toolbar=no,directo ries=no,location=no,width=700,height=500\"))
- 07-14-2011, 10:48 PM #6
Have you added printlns to all the methods and the constructor to see when they are called?
I get the second TT sometimes as a short dark blue line vs the text.
When I changed this variable I get the full text:
private final String TT_HTML = "<html>HTML that is longer than the other one</html>";Last edited by Norm; 07-14-2011 at 11:04 PM.
- 07-15-2011, 09:19 PM #7
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
I always get the "short dark blue line vs the text" (:
So you are able to reproduce the error?
It is odd that it works for you after increasing TT_HTML variable.
- 07-15-2011, 09:22 PM #8
Similar Threads
-
output format problem.
By jim01 in forum New To JavaReplies: 8Last Post: 04-18-2011, 09:00 AM -
Format editing in HTML view with JEditorPane
By peterme in forum Advanced JavaReplies: 4Last Post: 02-23-2011, 09:05 PM -
Tooltip problem with two monitors
By rogerbacon in forum New To JavaReplies: 6Last Post: 07-12-2010, 03:38 PM -
Problem to ToolTip in Java 3d
By roshithmca in forum AWT / SwingReplies: 1Last Post: 02-05-2008, 03:46 AM -
Problem with '/' character in HTML and JSP
By Marcus in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 07-04-2007, 05:32 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks