本文整理匯總了Java中javax.swing.JToggleButton.setToolTipText方法的典型用法代碼示例。如果您正苦於以下問題:Java JToggleButton.setToolTipText方法的具體用法?Java JToggleButton.setToolTipText怎麽用?Java JToggleButton.setToolTipText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JToggleButton
的用法示例。
在下文中一共展示了JToggleButton.setToolTipText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createToggleButton
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private static JToggleButton createToggleButton (final String id, String iconPath, String tooltip) {
Icon icon = ImageUtilities.loadImageIcon(iconPath, false);
boolean isSelected = isButtonSelected(id);
final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
// ensure small size, just for the icon
Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
toggleButton.setPreferredSize(size);
toggleButton.setMargin(new Insets(1, 1, 1, 1));
if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
// We do not want an ugly border with the exception of Mac, where it paints the toggle state!
toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
}
toggleButton.setToolTipText(tooltip);
toggleButton.setFocusable(false);
return toggleButton;
}
示例2: createToggle
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton createToggle(Map<String, Boolean> fStates, int index) {
boolean isSelected = filtersDesc.isSelected(index);
boolean enabled = filtersDesc.isEnabled(index);
Icon icon = filtersDesc.getIcon(index);
// ensure small size, just for the icon
JToggleButton result = new JToggleButton(icon, enabled && isSelected);
Dimension size = new Dimension(21, 21); // 3 less than other buttons
result.setMaximumSize(size);
result.setMinimumSize(size);
result.setPreferredSize(size);
if ("Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
result.setBorderPainted(true);
} else {
result.setBorderPainted(false);
}
// result.setMargin(new Insets(2, 3, 2, 3));
result.setToolTipText(filtersDesc.getTooltip(index));
result.setEnabled(enabled);
fStates.put(filtersDesc.getKey(index), Boolean.valueOf(isSelected));
return result;
}
示例3: createToggleButton
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private static JToggleButton createToggleButton (final String id, String iconName, String tooltip) {
Icon icon = loadIcon(iconName);
boolean isSelected = isButtonSelected(id);
final JToggleButton toggleButton = new JToggleButton(icon, isSelected);
// ensure small size, just for the icon
Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
toggleButton.setPreferredSize(size);
toggleButton.setMargin(new Insets(1, 1, 1, 1));
if (!"Aqua".equals(UIManager.getLookAndFeel().getID())) { //NOI18N
// We do not want an ugly border with the exception of Mac, where it paints the toggle state!
toggleButton.setBorder(new EmptyBorder(toggleButton.getBorder().getBorderInsets(toggleButton)));
}
toggleButton.setToolTipText(tooltip);
toggleButton.setFocusable(false);
return toggleButton;
}
示例4: newOptionButton
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton newOptionButton(Icon icon, String tooltip, String accessibleName, final String property) {
JToggleButton newButton = new JToggleButton(icon);
newButton.setToolTipText(tooltip);
newButton.getAccessibleContext().setAccessibleName(accessibleName);
boolean isSelected = NbPreferences.forModule(StatisticsPanel.class).getBoolean(property, false);
newButton.setSelected(isSelected);
newButton.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
boolean selected;
switch (e.getStateChange()) {
case ItemEvent.SELECTED:
selected = true;
break;
case ItemEvent.DESELECTED:
selected = false;
break;
default:
return;
}
ResultWindow.getInstance().updateOptionStatus(property, selected);
}
});
return newButton;
}
示例5: createActivateBreakpointsActionButton
import javax.swing.JToggleButton; //導入方法依賴的package包/類
@NbBundle.Messages({"CTL_DeactivateAllBreakpoints=Deactivate all breakpoints in current session",
"CTL_ActivateAllBreakpoints=Activate all breakpoints in current session",
"CTL_NoDeactivation=The current session does not allow to deactivate breakpoints",
"CTL_NoSession=No debugger session"})
public static AbstractButton createActivateBreakpointsActionButton() {
ImageIcon icon = ImageUtilities.loadImageIcon(DEACTIVATED_LINE_BREAKPOINT, false);
final JToggleButton button = new JToggleButton(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(Bundle.CTL_DeactivateAllBreakpoints());
button.setFocusable(false);
final BreakpointsActivator ba = new BreakpointsActivator(button);
button.addActionListener(ba);
DebuggerManager.getDebuggerManager().addDebuggerListener(DebuggerManager.PROP_CURRENT_ENGINE, new DebuggerManagerAdapter() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
DebuggerEngine de = (DebuggerEngine) evt.getNewValue();
ba.setCurrentEngine(de);
}
});
ba.setCurrentEngine(DebuggerManager.getDebuggerManager().getCurrentEngine());
return button;
}
示例6: getModeButtonMap
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private Map<JGraphMode,JToggleButton> getModeButtonMap() {
if (this.modeButtonMap == null) {
this.modeButtonMap = new EnumMap<>(JGraphMode.class);
ButtonGroup modeButtonGroup = new ButtonGroup();
for (JGraphMode any : JGraphMode.values()) {
JToggleButton button = new JToggleButton(getModeAction(any));
Options.setLAF(button);
button.setToolTipText(any.getName());
button.setEnabled(isEnabled());
this.modeButtonMap.put(any, button);
modeButtonGroup.add(button);
}
this.modeButtonMap.get(EDIT_MODE).setSelected(true);
}
return this.modeButtonMap;
}
示例7: createWorkspaceToolBar
import javax.swing.JToggleButton; //導入方法依賴的package包/類
public void createWorkspaceToolBar() {
JToolBar workspaceToolBar = new JToolBar();
workspaceToolBar.setFloatable(false);
for (ActionDescriptor descriptor : getActionDescriptors()) {
final Action action = descriptor.getAction();
if (action instanceof ShowWorkspaceAction) {
JToggleButton button = new JToggleButton(action);
button.setText(cut((String) action
.getValue(Action.ACTION_COMMAND_KEY)));
button.setToolTipText((String) action
.getValue(Action.ACTION_COMMAND_KEY));
button.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
action.actionPerformed(e);
}
});
button.setFocusable(false);
workspaceToolBar.add(button);
}
}
factory.setNorthEastCornerComponent(workspaceToolBar);
}
示例8: init
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void init() {
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
setFloatable(false);
add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 32767)));
JLabel label = new JLabel("Properties");
label.setFont(new Font("Default", Font.BOLD, 12));
add(label);
add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));
add(Utils.createButton("Add Row", "add", "Ctrl+Plus", WebORTable.this));
add(Utils.createButton("Delete Rows", "remove", "Ctrl+Minus", WebORTable.this));
addSeparator();
add(Utils.createButton("Move Rows Up", "up", "Ctrl+Up", WebORTable.this));
add(Utils.createButton("Move Rows Down", "down", "Ctrl+Down", WebORTable.this));
addSeparator();
frameToggle = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/web/propViewer"));
frameToggle.addItemListener(WebORTable.this);
frameToggle.setToolTipText("Show/Hide Frame Property");
frameToggle.setActionCommand("Toggle Frame");
add(frameToggle);
}
示例9: init
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void init() {
initComponents();
detailsPanel = new JPanel(new GridLayout(1, 1));
Color color = Utils.getTextBackground();
detailsPanel.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue()));
lblEmptyDetails = new JLabel(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_EmptyDetails"), JLabel.CENTER);
lblEmptyDetails.setFont(italicFont);
lblEmptyDetails.setEnabled(false);
JScrollPane scrollPane = new JScrollPane(detailsPanel);
splitPane.setRightComponent(scrollPane);
toolBar.setFocusable(false);
toolBar.setFloatable(false);
btnSearch = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/notifications/resources/find16.png", true));
btnSearch.setToolTipText(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_SearchToolTip"));
btnSearch.setFocusable(false);
btnSearch.setSelected(NotificationSettings.isSearchVisible());
//TODO delete 2 lines then quick search API clear text correctly
// btnSearch.setToolTipText("Disabled due to Quick Search API defects");
// btnSearch.setEnabled(false);
btnSearch.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setSearchVisible(btnSearch.isSelected());
}
});
toolBar.add(btnSearch);
toolBar.add(new FiltersMenuButton(notificationManager.getActiveFilter()));
initLeft();
showDetails();
}
示例10: createToggleButton
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton createToggleButton() {
JToggleButton console = new JToggleButton(Utils.getIconByResourceName("/ui/resources/toolbar/console"));
console.setActionCommand("Console");
console.setToolTipText("Show/Hide Console Box");
console.addActionListener(actionListener);
return console;
}
示例11: createToggle
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton createToggle (Map<String,Boolean> fStates, int index) {
boolean isSelected = filtersDesc.isSelected(index);
Icon icon = filtersDesc.getSelectedIcon(index);
// ensure small size, just for the icon
JToggleButton result = new JToggleButton(icon, isSelected);
Dimension size = new Dimension(icon.getIconWidth() + 6, icon.getIconHeight() + 4);
result.setPreferredSize(size);
result.setMargin(new Insets(2,3,2,3));
result.setToolTipText(filtersDesc.getTooltip(index));
fStates.put(filtersDesc.getName(index), Boolean.valueOf(isSelected));
return result;
}
示例12: createToggle
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton createToggle (Map<String,Boolean> fStates, int index) {
boolean isSelected = getPreferences().getBoolean( filtersDesc.getName(index), filtersDesc.isSelected(index) );
Icon icon = filtersDesc.getSelectedIcon(index);
// ensure small size, just for the icon
JToggleButton result = new JToggleButton(icon, isSelected);
Dimension size = new Dimension(icon.getIconWidth() + 6, icon.getIconHeight() + 4);
result.setPreferredSize(size);
result.setMargin(new Insets(2,3,2,3));
result.setToolTipText(filtersDesc.getTooltip(index));
result.setFocusable(false);
fStates.put(filtersDesc.getName(index), Boolean.valueOf(isSelected));
return result;
}
示例13: newShowButton
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton newShowButton(String iconId,
String tooltip,
String accessibleName,
Status status) {
JToggleButton btn = new JToggleButton(ImageUtilities.loadImageIcon(iconId, true));
btn.setToolTipText(tooltip);
btn.getAccessibleContext().setAccessibleName(accessibleName);
btn.setSelected((filterMask & status.getBitMask()) == 0);
btn.addItemListener(new FilterItemListener(status));
return btn;
}
示例14: init
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void init() {
add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 32767)));
JLabel label = new JLabel("Properties");
label.setFont(new Font("Default", Font.BOLD, 12));
add(label);
add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));
toggleImage = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/image/image"));
toggleImage.addItemListener(ImageORTable.this);
toggleImage.setActionCommand("ToggleImage");
toggleImage.setToolTipText("Show/Hide Image");
add(toggleImage);
JButton offset = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOffset"));
offset.addActionListener(ImageORTable.this);
offset.setToolTipText("Show Offset");
offset.setActionCommand("Show Offset");
add(offset);
JButton findOn = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOnScreen"));
findOn.addActionListener(ImageORTable.this);
findOn.setToolTipText("Find on Screen");
findOn.setActionCommand("Find on Screen");
add(findOn);
JButton editor = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/propViewer"));
editor.addActionListener(ImageORTable.this);
editor.setToolTipText("Show Property Editor");
editor.setActionCommand("Show Property Editor");
add(editor);
}
示例15: FilteringToolbar
import javax.swing.JToggleButton; //導入方法依賴的package包/類
public FilteringToolbar(String name) {
if (!UIUtils.isNimbusLookAndFeel())
setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
filterButton = new JToggleButton(Icons.getIcon(GeneralIcons.FILTER)) {
protected void fireActionPerformed(ActionEvent e) {
if (isSelected()) showFilter(); else hideFilter();
}
};
filterButton.setToolTipText(name);
add(filterButton);
}