How can I display the tooltip in a tree node?
I implement a TreeCellRenderer and has already set the tooltiptext through the following code:
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded,
boolean leaf, int row,
boolean hasFocus) {
Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
if(Leaf.class.isInstance(userObject)) {
Leaf leaf = (Leaf)userObject;
setToolTipText(leaf.getString());
}Why can't the tree display the tooltip when a move the mouse on the leaf of the tree?
Thank you!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
public class Test3 extends JFrame {
public Test3() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = getContentPane();
JTree jt = new JTree() {
public String getToolTipText(MouseEvent evt) {
if (getRowForLocation(evt.getX(), evt.getY()) == -1)
return null;
TreePath curPath = getPathForLocation(evt.getX(),
evt.getY());
return curPath.getLastPathComponent().toString();
content.add(new JScrollPane(jt), BorderLayout.CENTER);
jt.setToolTipText("");
setSize(400, 400);
setVisible(true);
public static void main(String[] args) { new Test3();
}It sounds a solution. I use the following code and also can display the tooltip,but there's also a problem:
mytree.setCellRenderer(new MyTreeCellRenderer());
ToolTipManager.sharedInstance().registerComponent(mytree);the above code only effective when the function getTreeCellRendererComponent in MyTreeCellRenderer like the following:
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded,
boolean leaf, int row,
boolean hasFocus) {
String stringValue = tree.convertValueToText(value, selected,
expanded, leaf, row, hasFocus);
setText(stringValue);
setToolTipText(stringValue); //Tooltips used by the tree
/* Set the icon of the node */
Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
if(Device.class.isInstance(userObject)) {
setIcon(deviceIcon);
} else {
setIcon(nullIcon);
Business b = (Business)userObject;
setFont(defaultFont);
/* Update the selected flag for the next paint. */
this.selected = selected;
this.hasFocus = hasFocus;
if(selected) // && hasFocus)
setForeground(Color.white);
else
setForeground(Color.black);
return this;
}but when the code is bellow,it displays nothing(Only the leaf node need tooltip):
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded,
boolean leaf, int row,
boolean hasFocus) {
String stringValue = tree.convertValueToText(value, selected,
expanded, leaf, row, hasFocus);
setText(stringValue);
//setToolTipText(stringValue); //Tooltips used by the tree
/* Set the icon of the node */
Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
if(Device.class.isInstance(userObject)) {
setIcon(deviceIcon);
} else {
setIcon(nullIcon);
Business b = (Business)userObject;
if(b.isShowOrder())
setToolTipText(b.getContaId()); // only some node need tooltip, not all node
setFont(defaultFont);
/* Update the selected flag for the next paint. */
this.selected = selected;
this.hasFocus = hasFocus;
if(selected) // && hasFocus)
setForeground(Color.white);
else
setForeground(Color.black);
return this;
}Anyone knows why?
Similar Messages
-
How can I display the data in table in separate column?
I have a vi reading data one by one in the same column.
How can I display the data with separate column?
like this:
data 1 | read | read
data 2 | read | read
data 3 | read | read
(would you mind if I will ask for an example
because it is much easier for me to work
with an example)
THANK YOU.If you're reading your data in as a 1D array, this is as simple as using the Reshape Array to make a 2D array. I've attached an example in LabVIEW 6.1 format. The example rearranges a single column of data fill several columns horizontally, but you can easily modify this code to fill the columns downward instead.
Attachments:
Data_Column_Example.vi 18 KB -
I can successfully view and control a VI remotly. However, the remote VI dinamically loads another VI, this VI loaded dinamically is a VI that allows open others VIs, I want to see the files that contains the server machine, in the client machine, but the front panel of the dinamic VI appears only on the server and not on the client, How can I display the fron panel with the files of the server machine of the dinamically loaded VI on the client computer?
Attachments:
micliente.llb 183 KB
miservidor.llb 186 KB
rdsubvis.llb 214 KBI down loaded your files but could use some instructions on what needs run.
It seems that you are so close yet so far. You need to get the data on the server machine over to the client. I generally do this by doing a call by reference (on the client machine) of a VI that is served by the server. THe VI that executes on the server should pass the data you want to diplay via one of its output terminals. You can simply wire from this terminal (back on the client again) to an indicator of your choosing.
Now theorectically, I do not think that there is anything that prevents use from getting the control refnum of the actual indicator (on the server) of the indicator that has the data, and read its "Value" using a property node. I have never tried this idea but it seems t
hat all of the parts are there. You will need to know the name of the VI that holds the data as well as the indicator's name. You will also have to serve all VI's. This is not a good idea.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
How can I display the range for LastFullMonth in the header of a report
How can I display the month for LastFullMonth in the header of a report run in the past so that a report that ran sept 1 2009 selecting data for LastFullMonth (august 2009) displays sept 2009 in the header even if there is no data selected by the report?
Good,
Sometimes I answer these questions and completly miss it....
( lack of understanding on my part ) -
How can I display the HTML page from servlet which is called by an applet
How can I display the HTML page from servlet which is called by an
applet using the doPost method. If I print the response i can able to see the html document. How I can display it in the browser.
I am calling my struts action class from the applet. I want to show the response in the same browser.
Code samples will be appreciated.hi
I got one way for this .
call a javascript in showDocument() to submit the form -
public class Userdefined extends Exception {
Userdefined(String sparam){
System.out.println(sparam);
Userdefined(){
private static int acno[]={100,105};
private static double bal[]={100.00,200.00};
public static void main(String args[]) {
try{
for(int i=0;i<2;i++)
System.out.println("ACCCCNO------>"+acno[i]+"BAl------>"+bal);
if(bal[i]<150.00)
Userdefined udexp=new Userdefined("bal less");
throw udexp;
catch(Userdefined e){
System.out.println("--->"+e);
How can i display the message "less amt" using my parmeterized constructor.VinayTK wrote:
How can i display the message "less amt" using my parmeterized constructor.Erm ... what? You can't --- at least not with the stuff you've got there.
A properly formed question, with some idea of what you're trying to accomplish would be a huuuuge help.
Winston
BTW: Congratulations. At my age, 'first's in computing are rare; but it's definitely the first time I've seen an Exception class with a main() method.
Edited by: YoungWinston on Sep 1, 2009 9:46 AM -
How can i display the error count
Hi I'm using jdev11g
How can i display the count of errors in validation error message pop up instead of displaying the entire list.Searching the forum would help
Re: How to customize Error? -
How can I display the vendor associated with result of my running total sum
I have a report that lists vendors with their most vecent order dates. I need to set up a rotation so that the vendor with the latest order date is next to be selected. I used the running total summary to pick the latest date. How can I display the vendor associated with result of my running total summary?
If your "latest" order date means the "oldest" order date, why don't you try this:
Go to Report tab -> Record Sort Expert -> Choose your order date in ascending order
This will make your oldest order your first record shown.
You can then create a running total count for each record.
Lastly, in your section expert under conditional suppress X+2 formula, write this:
{#CountRecords}>1
The result will only show the oldest record in your report.
I hope that helps,
Zack H. -
How can we display the list of Report Names in Dashboard Prompt?
How can we display the list of Report Names in Dashboard Prompt?
Hi,
No its not possible to display list of reports in dashboard prompts.
Can do this using SQl results in prompt(we write query checking out report names manualy),but its not easy thing if you are having many report names to be displayed.
Assign points and close your threads if answered.
Refer : http://forums.oracle.com/forums/ann.jspa?annID=939
Regards,
Srikanth -
How can i display the Number instead of E
Hello Everyone ;
I am getting confused. How can i display the Number but the Exponential value is coming as E.
SQL> select sum(amount_sold) from sales;
SUM(AMOUNT_SOLD)
1.1287E+11
Table details ..
SQL> desc sales
Name Null? Type
AMOUNT_SOLD NUMBER
i want to change 1.1287E+11 to "numeric"
DB : 10.2.0.4
os : rhel 5.1Just a minor correction on an obvious math/responding too fast error: 1.1287E+11 is a 12 digit number. You move the decimal 11 positions to the right which would add 7 zeroes to the value.
MPOWEL01> l
1 select length(to_char(1.1287E+11)), to_char(1.1287E+11,'999,999,999,999'), 1.1287E+11 "TEST"
2* from sys.dual
MPOWEL01> col TEST format 999999999999
MPOWEL01> /
LENGTH(TO_CHAR(1.1287E+11)) TO_CHAR(1.1287E+ TEST
12 112,870,000,000 112870000000the problem was that the OP failed to alias the sum result to the formatted column rather than the lenght of the data.
HTH -- Mark D Powell -- -
How can i display the days of the month in my report, please help
dear all
my table name is day_close_table
it contains these columns:
product_code number,
the_date date,
sale_qty number,
buy_qty number
price number
i need to make report like the fiollowing
product : 10144 from: 1-jan-2006 to :10-jan-2006
days | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Sale | 50| 10| 20| 15|10|5 | 6 | 11|12|6 |
buy |10 | 20 | 10| 0 | 0 | 0 | 10| 1 | 1| 1|
i created two query and i decieded to join them
the first one is to display days in horizon direction
my query is:
SELECT TO_CHAR(THE_DATE,'DD-MONTH')D,
FROM HS_DAY_CLOSE;
my question is how can i display the records in horizone direction
please helpi solved this problem using this query
SELECT STOCK_CODE, COUNTRY_ID,
SUM(DECODE(to_char(the_date,'dd') ,'01', buy_qty)) "1",
SUM(DECODE(to_char(the_date,'dd') , '02', buy_qty)) "2",
SUM(DECODE(to_char(the_date,'dd') , '03', buy_qty)) "3",
SUM(DECODE(to_char(the_date,'dd') , '04', buy_qty)) "4",
SUM(DECODE(to_char(the_date,'dd') , '05', buy_qty)) "5",
SUM(DECODE(to_char(the_date,'dd') , '06', buy_qty)) "6",
SUM(DECODE(to_char(the_date,'dd') , '07', buy_qty)) "7",
SUM(DECODE(to_char(the_date,'dd') , '08', buy_qty)) "8",
SUM(DECODE(to_char(the_date,'dd') , '09', buy_qty)) "9",
SUM(DECODE(to_char(the_date,'dd') , '10', buy_qty)) "10",
SUM(DECODE(to_char(the_date,'dd') , '11', buy_qty)) "11",
SUM(DECODE(to_char(the_date,'dd') , '12', buy_qty)) "12",
SUM(DECODE(to_char(the_date,'dd') , '13', buy_qty)) "13",
SUM(DECODE(to_char(the_date,'dd') , '14', buy_qty)) "14",
SUM(DECODE(to_char(the_date,'dd') , '15', buy_qty)) "15",
SUM(DECODE(to_char(the_date,'dd') , '16', buy_qty)) "16",
SUM(DECODE(to_char(the_date,'dd') , '17', buy_qty)) "17",
SUM(DECODE(to_char(the_date,'dd') , '18', buy_qty)) "18",
SUM(DECODE(to_char(the_date,'dd') , '19', buy_qty)) "19",
SUM(DECODE(to_char(the_date,'dd') , '20', buy_qty)) "20",
SUM(DECODE(to_char(the_date,'dd') , '21', buy_qty)) "21",
SUM(DECODE(to_char(the_date,'dd') , '22', buy_qty)) "22",
SUM(DECODE(to_char(the_date,'dd') , '23', buy_qty)) "23",
SUM(DECODE(to_char(the_date,'dd') , '24', buy_qty)) "24",
SUM(DECODE(to_char(the_date,'dd') , '25', buy_qty)) "25",
SUM(DECODE(to_char(the_date,'dd') , '26', buy_qty)) "26",
SUM(DECODE(to_char(the_date,'dd') , '27', buy_qty)) "27",
SUM(DECODE(to_char(the_date,'dd') , '28', buy_qty)) "28",
SUM(DECODE(to_char(the_date,'dd') , '29', buy_qty)) "29",
SUM(DECODE(to_char(the_date,'dd') , '30', buy_qty)) "30",
SUM(DECODE(to_char(the_date,'dd') , '31', buy_qty)) "31"
FROM HS_DAY_CLOSE
GROUP BY STOCK_CODE,COUNTRY_ID -
How can i display the login details in the Web Ui
Hi All,
How can i display the information regarding the person who logged into the Web Ui and where can i find the seetings regardin this.Please provide your valuable suggestions
Regrads,
Lakshman.Plook at this link https://wiki.sdn.sap.com/wiki/display/CRM/WelcomeUserMessageinWeb+UI and you will solve your problem.
have a nice day. -
How can i display the latest " 4 Posts" in Facebook WebPart in SharePoint?
Hi All,
I have created Facebook WebPart in SharePoint, using below code
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=807273262643415&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like-box" data-href="https://www.facebook.com/FacebookDevelopers" data-width="300" data-height="200" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="true"
data-show-border="true"></div>
Now all Likes and Posts are displayed, here i want to display the latest " 4 Posts " only.
how can i display the latest " 4 Posts".Hi,
As a workaround, we can use jQuery to hide or remove other posts.
http://www.w3schools.com/jquery/jquery_dom_remove.asp
You can also connect the Facebook to find whether it provide a api to achieve your requirement or not.
Or you can try to modify the js file. Facebook provide a debug version of the JavaScript SDK.
https://developers.facebook.com/docs/javascript/quickstart/v2.2
Best Regards
Dennis Guo
TechNet Community Support -
How can I display the rows into columns.
How can I display the rows into columns. I mean
Create table STYLE_M
(Master varchar2(10), child varchar2(10));
Insert itno style_m
('MASTER1','CHILD1');
Insert itno style_m
('MASTER2','CHILD1');
Insert itno style_m
('MASTER2','CHILD2');
Insert itno style_m
('MASTER3','CHILD1');
Insert itno style_m
('MASTER3','CHILD2');
Insert itno style_m
('MASTER3','CHILD3');
Note : The Master may have any number of childs.
I want to display like this..
Master child1, child2, child3, .......(dynamic)
MASTER1 CHILD1
MASTER2 CHILD1 CHILD2
MASTER3 CHILD1 CHILD2 CHILD3
Sorry for disturbing you. Please hlp me out if you have any slution.
Thanks alot.
Ram DontineniHere's a straight SQL "non-dynamic" approach.
This would be used if you knew the amount of children.
SELECT
master,
MAX(DECODE(r, 1, child, NULL)) || ' ' || MAX(DECODE(r, 2, child, NULL)) || ' ' || MAX(DECODE(r, 3, child, NULL)) children
FROM
SELECT
master,
child,
ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r
FROM
style_m
GROUP BY
master
MASTER CHILDREN
MASTER1 CHILD1
MASTER2 CHILD1 CHILD2
MASTER3 CHILD1 CHILD2 CHILD3 Since you said that the number of children can vary, I incorporated the same logic into a dynamic query.
SET AUTOPRINT ON
VAR x REFCURSOR
DECLARE
v_sql VARCHAR2(1000) := 'SELECT master, ';
v_group_by VARCHAR2(200) := 'FROM (SELECT master, child, ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r FROM style_m) GROUP BY master';
v_count PLS_INTEGER;
BEGIN
SELECT
MAX(COUNT(*))
INTO v_count
FROM
style_m
GROUP BY
master;
FOR i IN 1..v_count
LOOP
v_sql := v_sql || 'MAX(DECODE(r, ' || i || ', child, NULL))' || ' || '' '' || ';
END LOOP;
v_sql := RTRIM(v_sql, ' || '' '' ||') ||' children ' || v_group_by;
OPEN :x FOR v_sql;
END;
PL/SQL procedure successfully completed.
MASTER CHILDREN
MASTER1 CHILD1
MASTER2 CHILD1 CHILD2
MASTER3 CHILD1 CHILD2 CHILD3I'll point your other thread to this one. -
How can I display the holiday list in the portal
System
ECC 6.0
EP 7.0
ESS/MSS 1.0
how can I display the holiday list in the portal.
There will be a holiday list created by the ABAP-er in ECC, how can I include it in the portal?Hi,
Create a WebDynpro Iview to create a simple application that pulls information from the RFM(that you has ABAPer created).
Start from <a href="https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#backend">Here</a>
(Or)
To get an idea, download the world time BP from below link. It has calender with holidays displayed.
http://www.sweetlets.com/world_times_preview.html
Regards,
N.
Maybe you are looking for
-
I cannot install Itunes 10.5.1
I am running Windows 7 Professional x64, fully updated. I cannot update Itunes 10.5 to 10.5.1 to get Cloud support. The installer fails and gives me an error message saying "There is a problem with this Windows Installer package. A program required f
-
I just got a new laptop (HP Envy 17 3D) which has the 64 bit version of Windows 7 professional. I downloaded iTunes and after it finished importing all the music, which I had copied to the music directory, I noticed that there were duplicates of each
-
Item does not display in correct position with TileLayout
Please take a look at below coding. If I choose Frank and click button “age<5", the damn Frank stays still rather than the first column. What else should I do after refreshing the data list? Best Regards, <?xml version="1.0" encoding="utf-8"?> <s:Vie
-
JMS Queue servicing algorithm problems
I'm using WLS 5.1, and have run into a problem with the way that WLS services JMS queues. I have two queues (Q1 and Q2, created in that order), each of which is serviced by a session pool. The problem is that a
-
How can I get back to my origanl size writing in emails?
when I was forwarding emails on to a few people I held done the control botton...as I did...everything shrunk...how do I fix this?