java - Can't turn off tooltips for text area inside scroll pane -
all swing components in app (except labels) have tooltips can annoying 1 time user knows what's going on, have preferences
menu allows turning them off. name every component , set tooltip text "" [e.g., txtpattern.settooltiptext("");
] (and 10 others), decided (with aid started awhile back) write code more elegant (a learning experience):
private void tipsoff(container container){ component [] c = container.getcomponents(); (component cc : c) ((jcomponent)cc).settooltiptext(""); } private void mnipreftooltipsactionperformed(java.awt.event.actionevent evt) { if(! mnipreftooltips.isselected()){ tipsoff(gui.getcontentpane()); tipsoff(gui.pnlletters); tipsoff(gui.mbrmenubar); } else{ gui.dispose(); gui = new io(); gui.setvisible(true); } }
i have problem, tooltips not turned off 2 big text areas @ bottom of gui (highlighted in navigator pane). 2 buttons (marked greenish in nav. pane) processed correctly. these items supposed processed via first phone call tipsoff
, processes gui.getcontentpane())
.
(i added 2 lines bellow seek rectify problem. nope.)
tipsoff(gui.scroutput); tipsoff(gui.scrscratch);
(also tried this. nope.)
tipsoff(gui.txaoutput); tipsoff(gui.txascratchwork);
how can elegantly (i.e., assume have many text areas, not 2) turn off text area tooltips?
p.s. message access of private field of object
first phone call tipsoff
. don't care, owing nature of task @ hand.
use tooltipmanager.sharedinstance().setenabled( false )
disable tool tips in swing application.
benefits compared approach
it works :-) you not clear tooltips, easy re-enable them again. illustration if want offer ui user activate/de-activate tooltips approach work. in approach, have restore tooltips cleared, hard in generic way. java swing tooltip jscrollpane jtextarea
No comments:
Post a Comment