当前位置: 首页>>代码示例>>Java>>正文


Java JButton.setToolTipText方法代码示例

本文整理汇总了Java中javax.swing.JButton.setToolTipText方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setToolTipText方法的具体用法?Java JButton.setToolTipText怎么用?Java JButton.setToolTipText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JButton的用法示例。


在下文中一共展示了JButton.setToolTipText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ColorValueCellEditor

import javax.swing.JButton; //导入方法依赖的package包/类
public ColorValueCellEditor(final ParameterTypeColor type) {
	this.type = type;
	button = new JButton("Choose Color...");
	button.setToolTipText(type.getDescription());
	button.setIconTextGap(6);
	button.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent e) {
			Color newColor = JColorChooser.showDialog(RapidMinerGUI.getMainFrame(), "Choose Color for " + type.getKey(),
					((ColorIcon) button.getIcon()).getColor());
			if (newColor != null) {
				setEditorColor(newColor);
			}
			fireEditingStopped();
		}
	});
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:ColorValueCellEditor.java

示例2: createLocationSector

import javax.swing.JButton; //导入方法依赖的package包/类
private Component createLocationSector() {
    JPanel panel = new JPanel(new BorderLayout());
    location = new JTextField();
    location.setPreferredSize(new Dimension(180, location
            .getPreferredSize().height));
    JButton button = new JButton("...");
    button.setToolTipText("Base.Location.ToolTip");
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser(location.getText());
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(Preferences.this) == JFileChooser.APPROVE_OPTION) {
                location.setText(chooser.getSelectedFile()
                        .getAbsolutePath());
            }

        }
    });
    panel.add(location, BorderLayout.CENTER);
    panel.add(button, BorderLayout.EAST);
    return panel;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:25,代码来源:Preferences.java

示例3: createSidePane

import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createSidePane() {
    JButton configureButton = new JButton( ImageUtilities.loadImageIcon(CONFIG_ICON, false) );        
    configureButton.setToolTipText( getLocalizedComponentTooltip("configureButton") );
    configureButton.addActionListener(configureActionHandler);
    
    JButton reconnectButton = new JButton( ImageUtilities.loadImageIcon(RECONNECT_ICON, false) );
    reconnectButton.addActionListener( (e) -> reconnect() );
    reconnectButton.setToolTipText( getLocalizedComponentTooltip("reconnectButton") );
    
    JButton clearButton = new JButton( ImageUtilities.loadImageIcon(CLEAR_ICON, false) );
    clearButton.addActionListener( (e) -> clear() );
    clearButton.setToolTipText( getLocalizedComponentTooltip("clearButton") );
    
    JPanel pane = new JPanel();
    pane.setLayout( new BoxLayout(pane, BoxLayout.PAGE_AXIS) );
    pane.add( configureButton );
    pane.add( Box.createRigidArea( new Dimension(0, 3) ) );
    pane.add( reconnectButton );
    pane.add( Box.createRigidArea( new Dimension(0, 3) ) );
    pane.add( clearButton );
    
    pane.setBorder( BorderFactory.createEmptyBorder(3, 3, 3, 3) );
    return pane;
}
 
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:25,代码来源:SerialMonitorDisplayPane.java

示例4: createMaximizeButton

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Creates button to maximize currently selected document in the given tab displayer.
 * @param controller Tab displayer's controller.
 * @return Button to maximize selected document tab.
 */
public static JButton createMaximizeButton( final Controller controller ) {
    final JButton btn = new JButton();
    btn.setIcon( ImageUtilities.loadImageIcon( "org/netbeans/core/multitabs/resources/maximize.png", true) ); //NOI18N
    btn.setToolTipText( NbBundle.getMessage(ButtonFactory.class, "Hint_MaximizeRestore") );
    btn.addActionListener( new ActionListener() {

        @Override
        public void actionPerformed( ActionEvent e ) {
            controller.postActionEvent( new TabActionEvent( btn, TabbedContainer.COMMAND_MAXIMIZE, -1 ) );
        }
    });
    btn.setFocusable( false );
    return btn;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ButtonFactory.java

示例5: addTip

import javax.swing.JButton; //导入方法依赖的package包/类
void addTip(Controllable f, JButton b) {
    String s = f.getPropertyTooltip(b.getText());
    if (s == null) {
        return;
    }
    b.setToolTipText(s);
    b.setForeground(Color.BLUE);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:ControlPanel.java

示例6: createButton

import javax.swing.JButton; //导入方法依赖的package包/类
public static JButton createButton (Icon icon, String tooltip) {
    final JButton button = new JButton(icon);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    button.setPreferredSize(size);
    button.setMargin(new Insets(1, 1, 1, 1));
    button.setBorder(new EmptyBorder(button.getBorder().getBorderInsets(button)));
    button.setToolTipText(tooltip);
    button.setFocusable(false);
    return button;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:VariablesViewButtons.java

示例7: PreviewValueCellEditor

import javax.swing.JButton; //导入方法依赖的package包/类
public PreviewValueCellEditor(ParameterTypePreview type) {
	this.type = type;
	button = new JButton("Show Preview...");
	button.setToolTipText(type.getDescription());
	button.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent e) {
			buttonPressed();
		}
	});
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:13,代码来源:PreviewValueCellEditor.java

示例8: createZoomOutButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createZoomOutButton() {
    JButton outButton = new JButton(ImageUtilities.image2Icon(ImageUtilities.loadImage("org/netbeans/modules/debugger/jpda/visual/resources/zoomOut.gif")));
    outButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomOut"));
    outButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomOutA11yDescr"));
    outButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            canvas.zoomOut();
        }
    });
    outButton.setAlignmentX(CENTER_ALIGNMENT);
    return outButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例9: createZoomOrigButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createZoomOrigButton() {
    JButton origButton = new JButton(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomOrig"));
    origButton.setToolTipText(NbBundle.getMessage(ScreenshotComponent.class, "TLTP_ZoomOrig"));
    origButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ScreenshotComponent.class, "LBL_ZoomOrigA11yDescr"));
    origButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            canvas.zoom(1);
        }
    });
    origButton.setAlignmentX(CENTER_ALIGNMENT);
    return origButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ScreenshotComponent.java

示例10: AttributeFileValueCellEditor

import javax.swing.JButton; //导入方法依赖的package包/类
public AttributeFileValueCellEditor(ParameterTypeAttributeFile type) {
	super(type);
	JButton button = new JButton(new ResourceAction(true, "edit_attributefile") {

		private static final long serialVersionUID = 1L;

		@Override
		public void actionPerformed(ActionEvent e) {
			buttonPressed();
		}
	});
	button.setMargin(new Insets(0, 0, 0, 0));
	button.setToolTipText("Edit or create attribute description files and data (XML).");
	addButton(button, GridBagConstraints.RELATIVE);

	addButton(createFileChooserButton(), GridBagConstraints.REMAINDER);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:AttributeFileValueCellEditor.java

示例11: setNewVersionAvailable

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Notify the panel than a new version of the app is available
 * @param newVersionAvailable
 */
public void setNewVersionAvailable(final String content) {
	final JButton showUpdateDialog = new JButton(Resources.getImageIcon("update.png"));
	showUpdateDialog.setToolTipText(Resources.getLabel("new.version.title"));
	showUpdateDialog.addActionListener(e -> showUpdateDialog(content));
	add(showUpdateDialog);
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:11,代码来源:ControlPanel.java

示例12: initComponent

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Initialize all gui related stuff
 */
private void initComponent() {
	setLayout(new GridLayout(2, 1));
	stationPanel = new JPanel(new BorderLayout(5, 5));
	stationPanel.setBorder(BorderFactory.createTitledBorder(new EtchedBorder(), "Stations in " + bd.getRegionName(regionKey)));

	// Creates panel with add station button and spinner
	JPanel addPanel = new JPanel(new BorderLayout());
	addStation = new JButton("Add Station");
	addStation.setToolTipText("Adds a station to selected blocking region");
	addStation.setMinimumSize(DIM_BUTTON_S);
	addPanel.add(addStation, BorderLayout.CENTER);
	//build spinner panel
	JPanel spinnerPanel = new JPanel();
	JLabel spinnerDescrLabel = new JLabel("Stations:");
	stationNumSpinner = new JSpinner();
	stationNumSpinner.setPreferredSize(DIM_BUTTON_XS);
	spinnerPanel.add(spinnerDescrLabel);
	spinnerPanel.add(stationNumSpinner);
	addPanel.add(spinnerPanel, BorderLayout.SOUTH);
	// Creates a tmp panel to put addStation panel on the northeast corner
	JPanel tmpPanel = new JPanel(new BorderLayout());
	tmpPanel.add(addPanel, BorderLayout.NORTH);
	stationPanel.add(tmpPanel, BorderLayout.EAST);
	// Creates table to display stations
	stationTable = new StationTable();
	WarningScrollTable warning = new WarningScrollTable(stationTable, WARNING_STATIONS);
	warning.addCheckVector(sd.getStationKeysNoSourceSink());
	stationPanel.add(warning);
	add(stationPanel);

	// Creates blocking region panel
	blockingPanel = new BlockingRegionParameterPanel(cd, bd, regionKey);
	// Hides unneeded global properties (specified by table)
	blockingPanel.setGlobalVisible(false);
	add(blockingPanel);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:40,代码来源:BlockingStationPanel.java

示例13: askForNextAction

import javax.swing.JButton; //导入方法依赖的package包/类
@NbBundle.Messages({
    "# {0} - branch to merge",
    "MSG_PullAction_mergeNeeded_text=A merge commit is needed to synchronize current branch with {0}.\n\n"
        + "Do you want to Rebase the current branch onto {0} or Merge it with {0}?",
    "LBL_PullAction_mergeNeeded_title=Merge Commit Needed",
    "CTL_PullAction_mergeButton_text=&Merge",
    "CTL_PullAction_mergeButton_TTtext=Merge the two created heads",
    "CTL_PullAction_rebaseButton_text=&Rebase",
    "CTL_PullAction_rebaseButton_TTtext=Rebase current branch on top of the fetched branch"
})
private Callable<ActionProgress> askForNextAction () {
    JButton btnMerge = new JButton();
    Mnemonics.setLocalizedText(btnMerge, Bundle.CTL_PullAction_mergeButton_text());
    btnMerge.setToolTipText(Bundle.CTL_PullAction_mergeButton_TTtext());
    JButton btnRebase = new JButton();
    Mnemonics.setLocalizedText(btnRebase, Bundle.CTL_PullAction_rebaseButton_text());
    btnRebase.setToolTipText(Bundle.CTL_PullAction_rebaseButton_TTtext());
    Object value = DialogDisplayer.getDefault().notify(new NotifyDescriptor(
            Bundle.MSG_PullAction_mergeNeeded_text(branchToMerge),
            Bundle.LBL_PullAction_mergeNeeded_title(),
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.QUESTION_MESSAGE,
            new Object[] { btnRebase, btnMerge, NotifyDescriptor.CANCEL_OPTION },
            btnRebase));
    if (value == btnMerge) {
        return new Merge();
    } else if (value == btnRebase) {
        return new Rebase();
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:PullAction.java

示例14: addButton

import javax.swing.JButton; //导入方法依赖的package包/类
private JButton addButton(String iconPath, String tooltip) {
	JButton button = new JButton(createImageIcon(iconPath));
	button.setToolTipText(tooltip);
	button.addActionListener(this);
	this.add(button);
	return button;
}
 
开发者ID:mdonnyk,项目名称:the-one-mdonnyk,代码行数:8,代码来源:GUIControls.java

示例15: getGoodsButton

import javax.swing.JButton; //导入方法依赖的package包/类
protected JButton getGoodsButton(final GoodsType goodsType, String text) {
    JButton result = getButton(goodsType, text,
        new ImageIcon(getImageLibrary().getIconImage(goodsType)));
    result.setToolTipText(Messages.getName(goodsType));
    return result;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:7,代码来源:ColopediaGameObjectTypePanel.java


注:本文中的javax.swing.JButton.setToolTipText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。