本文整理了Java中javax.swing.JButton.getToolTipText()
方法的一些代码示例,展示了JButton.getToolTipText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.getToolTipText()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:getToolTipText
暂无
代码示例来源:origin: org.netbeans.api/org-openide-awt
bStop.addActionListener(browserListener);
bBack.getAccessibleContext().setAccessibleName(bBack.getToolTipText());
bForward.getAccessibleContext().setAccessibleName(bForward.getToolTipText());
bReload.getAccessibleContext().setAccessibleName(bReload.getToolTipText());
bStop.getAccessibleContext().setAccessibleName(bStop.getToolTipText());
txtLocation.getAccessibleContext().setAccessibleDescription(
NbBundle.getMessage(HtmlBrowser.class, "ACSD_HtmlBrowser_Location")
代码示例来源:origin: MinecraftForge/Installer
@Override
public void actionPerformed(ActionEvent e)
{
openURL(sponsorButton.getToolTipText());
}
});
代码示例来源:origin: datacleaner/DataCleaner
@Override
public String getTooltip() {
return _button.getToolTipText();
}
代码示例来源:origin: stackoverflow.com
public void actionPerformed(ActionEvent e) {
// get the button that was pressed
JButton b = (JButton) e.getSource();
// fire appropriate event
if(b.getToolTipText().equals("Set up simulation for normal execution")) {
fireSimulationEvent(SimulationEvent.NORMAL_SETUP_EVENT);
}
else if(b.getToolTipText().equals("Set up to test Queen Lifespan or Food Levels")) {
fireSimulationEvent(SimulationEvent.QUEEN_TEST_EVENT);
}
else if (b.getToolTipText().equals("Set up simulation for testing the Forager ant (Scouts are included)")) {
// set for testing the forager ant
fireSimulationEvent(SimulationEvent.FORAGER_TEST_EVENT);
} else if (b.getToolTipText().equals("Set up simulation for testing the Soldier ant (Scouts are included")) {
// set for testing the soldier ant
fireSimulationEvent(SimulationEvent.SOLDIER_TEST_EVENT);
} else if (b.getToolTipText().equals("Run the simulation continuously")) {
// run the simulation continuously
fireSimulationEvent(SimulationEvent.RUN_EVENT);
} else if (b.getToolTipText().equals("Step through the simulation one turn at a time")) {
// run the simulation one turn at a time
fireSimulationEvent(SimulationEvent.STEP_EVENT);
} else if (b.getToolTipText().equals("Stop or Pause the simulation")) {
//stop everything
fireSimulationEvent(SimulationEvent.STOP_EVENT);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = TOOLTIP_TEXT_JSDOC)
@Override
public String getToolTipText() {
return super.getToolTipText();
}
代码示例来源:origin: org.jsystemtest.systemobjects/swing-so
public boolean checkComponent(Component comp){
if (comp instanceof JButton){
String toolTipStrin = ((JButton)comp).getToolTipText();
String name = ((JButton)comp).getText();
if(name != null && !name.equals("")){
if(name.indexOf(toFind) >= 0){
return true;
}
}
if(toolTipStrin != null){
if(toolTipStrin.indexOf(toFind) >= 0){
return true;
}
}
}
return false;
}
代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client
@Override
public void actionPerformed(ActionEvent e) {
File f;
if (saving) {
f = DialogUtils.chooseFileForSave(button.getToolTipText(), field.getText());
} else {
f = DialogUtils.chooseFileForOpen(button.getToolTipText(), null, null);
}
if(f != null){
setPath(f.getAbsolutePath());
}
}
});
代码示例来源:origin: com.axway.ats.framework/ats-uiengine
private String getProperties(
Component c ) {
String properties = Formatting.inEdtFormat(c);
if (c instanceof JButton) {
String tooltip = ((JButton) c).getToolTipText();
if (!StringUtils.isNullOrEmpty(tooltip)) {
int lastBrIndex = properties.lastIndexOf(']');
if (lastBrIndex > 0) {
properties = properties.substring(0, lastBrIndex) + ", tooltip='" + tooltip
+ "'" + properties.substring(lastBrIndex);
} else {
return c.getClass().getName() + " [tooltip='" + tooltip + "']";
}
}
}
return properties;
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
@Override
public String getToolTipText(MouseEvent event)
{
JButton button = getButtonAt(event.getX());
if (null == button)
{
return super.getToolTipText(event);
}
else
{
return button.getToolTipText();
}
}
代码示例来源:origin: realXuJiang/bigtable-sql
@Override
public String getToolTipText(MouseEvent event)
{
JButton button = getButtonAt(event.getX());
if (null == button)
{
return super.getToolTipText(event);
}
else
{
return button.getToolTipText();
}
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
@Override
public String getToolTipText()
{
String superText = super.getToolTipText();
if( superText == null || superText.length() == 0 )
{
return null; // Swing will not register us with the tooltip manager unless it detects a change
}
if( getAction() != null )
{
return GosuObjectUtil.toString( getAction().getValue( Action.SHORT_DESCRIPTION ) );
}
else
{
return superText;
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
private JMenuItem initFrom(final JButton _bt) {
if (_bt == null) {
return null;
}
final JMenuItem it = new JMenuItem();
it.setIcon(_bt.getIcon());
it.setText(_bt.getText());
it.setToolTipText(_bt.getToolTipText());
it.setEnabled(_bt.isEnabled());
it.setActionCommand(_bt.getActionCommand());
it.addActionListener(this);
return it;
}
代码示例来源:origin: stackoverflow.com
@Override
public Object getValueAt(int row, int column)
{
JButton button = getRow(row);
switch (column)
{
case 0: return button.getText();
case 1: return button.getToolTipText();
case 2: return button.isEnabled();
case 3: return button.isVisible();
default: return null;
}
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
public String getToolTipText()
{
if( getAction() != null )
{
String tip;
tip = GosuObjectUtil.toString( getAction().getValue( Action.SHORT_DESCRIPTION ) );
if( tip == null || tip.isEmpty() )
{
tip = GosuObjectUtil.toString( getAction().getValue( Action.NAME ) );
}
String value = (String)getAction().getValue( Action.ACCELERATOR_KEY );
if( value != null && !value.isEmpty() )
{
tip += " (" + value + ")";
}
return tip;
}
else
{
return super.getToolTipText();
}
}
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
public String getToolTipText()
{
if( getAction() != null )
{
String tip;
if( _tooltip != null )
{
tip = _tooltip.get();
}
else
{
tip = GosuObjectUtil.toString( getAction().getValue( Action.SHORT_DESCRIPTION ) );
if( tip == null || tip.isEmpty() )
{
tip = GosuObjectUtil.toString( getAction().getValue( Action.NAME ) );
}
}
String value = (String)getAction().getValue( Action.ACCELERATOR_KEY );
if( value != null && !value.isEmpty() )
{
tip += " (" + value + ")";
}
return tip;
}
else
{
return super.getToolTipText();
}
}
代码示例来源:origin: vasl-developers/vasl
private void CopyActionButton(JButton objDestButton, JButton objSourceButton, boolean bAction)
{
objDestButton.setText(objSourceButton.getText());
try
{
if (objSourceButton.getIcon() != null)
objDestButton.setIcon(objSourceButton.getIcon());
}
catch (Exception ex)
{
}
if (bAction)
{
if (objSourceButton.getAction() != null)
objDestButton.setAction(objSourceButton.getAction());
}
else
{
for (int l_i = 0; l_i < objSourceButton.getActionListeners().length; l_i++)
objDestButton.addActionListener(objSourceButton.getActionListeners()[l_i]);
}
objDestButton.setToolTipText(objSourceButton.getToolTipText());
objSourceButton.setVisible(false);
}
代码示例来源:origin: triplea-game/triplea
@Test
void checkActionListener() {
// button action will be to add one to our integer, we'll fire the button action and verify we get the +1
final AtomicInteger integer = new AtomicInteger(0);
final JButton button = JButtonBuilder.builder()
.title("title")
.actionListener(integer::incrementAndGet)
.toolTip("toolTip")
.build();
Arrays.stream(button.getActionListeners())
.forEach(listener -> listener.actionPerformed(new ActionEvent(new Object(), 0, "")));
assertThat(integer.get(), is(1));
assertThat(button.getToolTipText(), is("toolTip"));
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-about
public AboutUIBuilder(Frame parent) {
Objects.requireNonNull(parent);
this.ui = new AboutUI(parent, true);
Action closeAction = new AbstractAction(CLOSE_ACTION) {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
ui.dispose();
}
};
closeAction.putValue(Action.NAME, null);
closeAction.putValue(Action.SMALL_ICON, ui.getClose().getIcon());
closeAction.putValue(Action.SHORT_DESCRIPTION, ui.getClose().getToolTipText());
ui.getClose().setAction(closeAction);
JRootPane rootPane = ui.getRootPane();
rootPane.setDefaultButton(ui.getClose());
rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), CLOSE_ACTION);
rootPane.getActionMap().put(CLOSE_ACTION, closeAction);
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets-about
public AboutUIBuilder(Frame parent) {
Preconditions.checkNotNull(parent);
this.ui = new AboutUI(parent, true);
Action closeAction = new AbstractAction(CLOSE_ACTION) {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
ui.dispose();
}
};
closeAction.putValue(Action.NAME, null);
closeAction.putValue(Action.SMALL_ICON, ui.getClose().getIcon());
closeAction.putValue(Action.SHORT_DESCRIPTION, ui.getClose().getToolTipText());
ui.getClose().setAction(closeAction);
JRootPane rootPane = ui.getRootPane();
rootPane.setDefaultButton(ui.getClose());
rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), CLOSE_ACTION);
rootPane.getActionMap().put(CLOSE_ACTION, closeAction);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2
public Component getToolbarPresenter() {
JButton button = new JButton();
fixButtonLF(button);
if (shared.iconResource() != null)
button.putClientProperty("hideActionText", Boolean.TRUE);//NOI18N
// need to assign Action after setting hideActionText
button.setAction(this);
if (getAccelerator() != null) {
String ttt = button.getToolTipText();
KeyStroke ks = getAccelerator();
String ksText = " ("; // NOI18N
int modifiers = ks.getModifiers();
if (modifiers > 0) {
ksText += KeyEvent.getKeyModifiersText(modifiers);
// NB buttons use +
// NB menu items use - (but sometimes +)
// JLF uses - always
ksText += "+"; // NOI18N
}
ksText += KeyEvent.getKeyText(ks.getKeyCode());
ksText += ")"; // NOI18N
ttt += ksText;
button.setToolTipText(ttt);
button.setMnemonic(0);
}
return button;
}
内容来源于网络,如有侵权,请联系作者删除!