本文整理汇总了Java中javax.swing.JToggleButton.putClientProperty方法的典型用法代码示例。如果您正苦于以下问题:Java JToggleButton.putClientProperty方法的具体用法?Java JToggleButton.putClientProperty怎么用?Java JToggleButton.putClientProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JToggleButton
的用法示例。
在下文中一共展示了JToggleButton.putClientProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getToolbarPresenter
import javax.swing.JToggleButton; //导入方法依赖的package包/类
@Override
public Component getToolbarPresenter() {
JToggleButton toggleButton = new JToggleButton();
toggleButtonRef = new WeakReference<>(toggleButton);
toggleButton.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
toggleButton.setIcon((Icon) getValue(SMALL_ICON));
toggleButton.setAction(this); // this will make hard ref to button => check GC
return toggleButton;
}
示例2: getToolbarPresenter
import javax.swing.JToggleButton; //导入方法依赖的package包/类
@Override
public Component getToolbarPresenter() {
toggleButton = new JToggleButton();
toggleButton.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
toggleButton.setIcon((Icon) getValue(SMALL_ICON));
toggleButton.setAction(this); // this will make hard ref to button => check GC
return toggleButton;
}
示例3: getToolbarPresenter
import javax.swing.JToggleButton; //导入方法依赖的package包/类
@Override
public Component getToolbarPresenter() {
JToggleButton b = new MyGaGaButton();
b.setModel(new HighlightButtonModel());
b.putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
b.setAction(this);
return b;
}
示例4: updateToolbar
import javax.swing.JToggleButton; //导入方法依赖的package包/类
private void updateToolbar(FileObject file, Collection<CssStylesPanelProvider> activeProviders) {
toolBar.removeAll();
if (activeProviders.size() <= 1) {
//remove the whole toolbar, if there's one or zero providers
removeToolbar();
} else {
addToolbar();
}
// Button group for document and source buttons
ButtonGroup buttonGroup = new ButtonGroup();
boolean first = true;
CssStylesPanelProvider selected = (file == null) ? null : selectedTabs.get(file.getMIMEType());
//do the active providers contain the pre-selected provider for this mimetype?
boolean containsPreselected = selected == null ? false : activeProviders.contains(selected);
for (CssStylesPanelProvider provider : activeProviders) {
JToggleButton button = new JToggleButton();
button.setText(provider.getPanelDisplayName());
button.setActionCommand(provider.getPanelID());
button.addActionListener(toolbarListener);
button.setFocusable(true);
button.setFocusPainted(false);
button.setRolloverEnabled(true);
//copied from org.netbeans.core.multiview.TabsComponent.createButton to make the look
//similar to the editor tabs
Border b = (getButtonBorder());
if (b != null) {
button.setBorder(b);
}
if (AQUA) {
button.putClientProperty("JButton.buttonType", "square"); //NOI18N
button.putClientProperty("JComponent.sizeVariant", "small"); //NOI18N
}
buttonGroup.add(button);
toolBar.add(button);
if (containsPreselected) {
//one of the active providers is already pre-selected by user
if (provider == selected) {
//the selected one - activate it
button.setSelected(true);
setActiveProvider(provider);
} else {
button.setSelected(false);
}
} else {
//no provider has been explicitly selected by the user yet
button.setSelected(first);
if (first) {
setActiveProvider(provider);
first = false;
}
}
}
revalidate();
repaint();
}
示例5: FilesPanel
import javax.swing.JToggleButton; //导入方法依赖的package包/类
public FilesPanel(VCSCommitPanel master, Map<String, VCSCommitFilter> filters, int preferedHeight) {
super(master, master.getModifier().getMessage(VCSCommitPanelModifier.BundleMessage.FILE_PANEL_TITLE), DEFAULT_DISPLAY_FILES);
this.filters = filters;
master.getCommitTable().labelFor(filesLabel);
JComponent table = master.getCommitTable().getComponent();
Mnemonics.setLocalizedText(filesLabel, getMessage("CTL_CommitForm_FilesToCommit")); // NOI18N
filesLabel.setMaximumSize(new Dimension(Integer.MAX_VALUE, filesLabel.getMaximumSize().height));
table.setPreferredSize(new Dimension(0, preferedHeight));
ButtonGroup bg = new ButtonGroup();
toolbar = new JToolBar();
toolbar.setFloatable(false);
for (VCSCommitFilter filter : filters.values()) {
JToggleButton tgb = new JToggleButton();
tgb.setIcon(filter.getIcon());
tgb.setToolTipText(filter.getTooltip());
tgb.setFocusable(false);
tgb.setSelected(filter.isSelected());
tgb.addActionListener(this);
tgb.putClientProperty(TOOLBAR_FILTER, filter);
bg.add(tgb);
toolbar.add(tgb);
}
toolbar.setAlignmentX(LEFT_ALIGNMENT);
sectionPanel.add(toolbar);
sectionPanel.add(table);
sectionPanel.add(VCSCommitPanel.makeVerticalStrut(filesLabel, table, RELATED, sectionPanel));
sectionPanel.add(filesLabel);
sectionPanel.setAlignmentX(LEFT_ALIGNMENT);
filesLabel.setAlignmentX(LEFT_ALIGNMENT);
table.setAlignmentX(LEFT_ALIGNMENT);
}