本文整理汇总了Java中javax.swing.JComponent.getClientProperty方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.getClientProperty方法的具体用法?Java JComponent.getClientProperty怎么用?Java JComponent.getClientProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.getClientProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import javax.swing.JComponent; //导入方法依赖的package包/类
@Override
public void initialize(WizardDescriptor wizard) {
wiz = wizard;
delegateIterator.initialize(wizard);
superclassPanelCurrent = false;
if (superclassPanel == null && specifySuperclass) {
superclassPanel = new SuperclassWizardPanel();
ResourceBundle bundle = NbBundle.getBundle(TemplateWizardIterator.class);
JComponent comp = (JComponent)delegateIterator.current().getComponent();
String[] contentData = (String[])comp.getClientProperty(WizardDescriptor.PROP_CONTENT_DATA); // NOI18N
String[] newContentData = new String[contentData.length+1];
System.arraycopy(contentData, 0, newContentData, 0, contentData.length);
newContentData[contentData.length] = bundle.getString("CTL_SuperclassTitle"); // NOI18N
comp.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, newContentData); // NOI18N
}
}
示例2: current
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Returns current panel of the wizard.
*
* @return current panel of the wizard.
*/
@Override
public WizardDescriptor.Panel current() {
String title = NbBundle.getMessage(MasterDetailWizard.class, "TITLE_MasterDetail"); // NOI18N
wizard.putProperty("NewFileWizard_Title", title); // NOI18N
if (steps == null) {
initSteps();
}
WizardDescriptor.Panel panel;
if (panelIndex < beforeStepsNo) {
panel = delegateIterator.current();
} else {
panel = panels[panelIndex-beforeStepsNo];
}
JComponent comp = (JComponent)panel.getComponent();
if ((panelIndex < beforeStepsNo) || (comp.getClientProperty(WIZARD_PANEL_CONTENT_DATA) == null)) {
comp.putClientProperty(WIZARD_PANEL_CONTENT_DATA, steps);
}
if (comp.getClientProperty(WIZARD_PANEL_CONTENT_SELECTED_INDEX) == null) {
comp.putClientProperty(WIZARD_PANEL_CONTENT_SELECTED_INDEX, panelIndex);
}
return panel;
}
示例3: hoverChanged
import javax.swing.JComponent; //导入方法依赖的package包/类
private void hoverChanged() {
String toolTipText;
if (hover != null) {
JComponent jc = hover instanceof JComponent ? (JComponent)hover : null;
Object cn = jc == null ? null : jc.getClientProperty("className");
String name = cn == null ? "" : cn.toString();
toolTipText = name.isEmpty() ? null : name;
} else {
toolTipText = null;
}
// ToolTipManager doesn't like changing the tooltip from mouseMoved().
// This is a workaround to hide the tip when needed and prevent NPEs.
if (toolTipText == null) ToolTipManager.sharedInstance().mousePressed(null);
glassPane.setToolTipText(toolTipText);
repaint();
}
示例4: updateEnabledState
import javax.swing.JComponent; //导入方法依赖的package包/类
private void updateEnabledState() {
boolean foldEnable = preferences.getBoolean(SimpleValueNames.CODE_FOLDING_ENABLE, true);
boolean useDefaults = preferences.getBoolean(FoldUtilitiesImpl.PREF_OVERRIDE_DEFAULTS, true);
for (JComponent c : controls) {
FoldType ft = (FoldType)c.getClientProperty("type"); // NOI18N
boolean enable = true;
if (defaultPrefs != null && useDefaults) {
enable = !isDefinedDefault(ft);
}
enable &= foldEnable;
c.setEnabled(enable);
}
}
示例5: regionsCopy
import javax.swing.JComponent; //导入方法依赖的package包/类
public static List<Position> regionsCopy(JComponent c) {
@SuppressWarnings("unchecked") List<Position> regions =
(List<Position>) c.getClientProperty(RECTANGULAR_SELECTION_REGIONS_PROPERTY);
List<Position> lRegions;
if (regions != null) {
synchronized (regions) {
lRegions = new ArrayList<Position>(regions);
}
} else {
lRegions = null;
}
return lRegions;
}
示例6: submit
import javax.swing.JComponent; //导入方法依赖的package包/类
@Override public void submit() {
if (component instanceof JComponent) {
JComponent tc = (JComponent) component;
Object clientProperty = tc.getClientProperty("marathon.celleditor.parent");
if (clientProperty != null) {
EventQueueWait.call_noexc(clientProperty, "stopEditing");
}
}
}
示例7: getName
import javax.swing.JComponent; //导入方法依赖的package包/类
private String getName(List<JComponent> printable, JComponent top) {
for (JComponent component : printable) {
Object object = component.getClientProperty(PrintManager.PRINT_NAME);
if (object instanceof String) {
return (String) object;
}
}
return getName(getData(top));
}
示例8: getStyle
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Gets the style. Creates it if necessary.
* @return the style
*/
SynthStyle getStyle(JComponent c, Region r) {
// if the component has overrides, it gets its own unique style
// instead of the shared style.
if (c.getClientProperty("Nimbus.Overrides") != null) {
Map<Region, SynthStyle> map = overridesCache.get(c);
SynthStyle s = null;
if (map == null) {
map = new HashMap<Region, SynthStyle>();
overridesCache.put(c, map);
} else {
s = map.get(r);
}
if (s == null) {
s = new NimbusStyle(prefix, c);
map.put(r, s);
}
return s;
}
// lazily create the style if necessary
if (style == null)
style = new NimbusStyle(prefix, null);
// return the style
return style;
}
示例9: initSteps
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Initializes array of steps of this wizard.
*/
private void initSteps() {
String[] thisSteps = new String[] {
NbBundle.getMessage(MasterDetailWizard.class, "TITLE_MasterPanel"), // NOI18N
NbBundle.getMessage(MasterDetailWizard.class, "TITLE_DetailPanel") // NOI18N
};
Object prop;
if (delegateIterator != null) {
JComponent comp = (JComponent)delegateIterator.current().getComponent();
prop = comp.getClientProperty(WizardDescriptor.PROP_CONTENT_DATA); // NOI18N
}
else prop = null;
String[] beforeSteps;
int stepsStartPos;
if (prop instanceof String[]) {
beforeSteps = (String[]) prop;
beforeStepsNo = beforeSteps.length;
stepsStartPos = beforeSteps.length;
if (stepsStartPos > 0 && ("...".equals(beforeSteps[stepsStartPos - 1]))) { // NOI18N
stepsStartPos--;
}
} else {
beforeStepsNo = 0;
beforeSteps = null;
stepsStartPos = 0;
}
steps = new String[stepsStartPos + thisSteps.length];
if (beforeSteps != null)
System.arraycopy(beforeSteps, 0, steps, 0, stepsStartPos);
System.arraycopy(thisSteps, 0, steps, stepsStartPos, thisSteps.length);
}
示例10: attributesFor
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Return Attributes associated with 'comp'.
* Create and attach of none exist.
* @param comp
* @return
*/
protected final Attributes attributesFor(JComponent comp) {
Object o = comp.getClientProperty(PROP_ATTRIBUTES);
if (o == null) {
Attributes a = new Attributes();
comp.putClientProperty(PROP_ATTRIBUTES, a);
return a;
} else {
return (Attributes) o;
}
}
示例11: registerDnd
import javax.swing.JComponent; //导入方法依赖的package包/类
/**
* Register toolbar content for drag and drop.
*/
private void registerDnd() {
for( Component c : toolbar.getComponents() ) {
if( !(c instanceof JComponent) )
continue;
JComponent jc = (JComponent) c;
Object o = jc.getClientProperty("file");
//is the component to register a draggable toolbar button?
if( !(o instanceof DataObject) )
continue;
dnd.register(c);
}
if( isDraggable() && null != dragger )
dnd.register(dragger);
}
示例12: isValueValid
import javax.swing.JComponent; //导入方法依赖的package包/类
final boolean isValueValid(JComponent cmp) {
Boolean valid = (Boolean) cmp.getClientProperty(PROP_VALUE_VALID);
if (valid == null) {
return true;
} else {
return valid.booleanValue();
}
}
示例13: decorateJComponent
import javax.swing.JComponent; //导入方法依赖的package包/类
private void decorateJComponent(JComponent component) {
String prop = (String)component.getClientProperty("com.rapidminer.ui.label.type");
if("header".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_28);
component.setForeground(SwingTools.RAPIDMINER_ORANGE);
} else if("bold".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_14);
component.setForeground(Color.DARK_GRAY);
} else if("normal".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_14);
component.setForeground(Color.DARK_GRAY);
} else if("large".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_16);
component.setForeground(Color.DARK_GRAY);
}
prop = (String)component.getClientProperty("com.rapidminer.ui.button.type");
if("cfa".equals(prop)) {
component.setFont(OPEN_SANS_SEMIBOLD_14);
component.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15));
} else if("normal".equals(prop)) {
component.setFont(OPEN_SANS_LIGHT_14);
component.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
component.setMinimumSize(new Dimension(175, component.getPreferredSize().height));
component.setPreferredSize(new Dimension(175, component.getPreferredSize().height));
}
prop = (String)component.getClientProperty("com.rapidmniner.ui.link_button.id");
if(prop != null && component instanceof LinkButton) {
((LinkButton)component).setText(this.generateHTML(prop));
}
Color foregroundColor = (Color)component.getClientProperty("com.rapidminer.ui.label.foreground");
if(foregroundColor != null) {
component.setForeground(foregroundColor);
}
}
示例14: getTabButtons
import javax.swing.JComponent; //导入方法依赖的package包/类
JButton[] getTabButtons(JComponent comp) {
JButton[] buttons = (JButton[]) comp.getClientProperty(TOOLBAR_BUTTONS_PROP);
if (buttons != null) {
return buttons;
}
Action[] actions = (Action[]) comp.getClientProperty(TOOLBAR_ACTIONS_PROP);
if (actions == null) {
return new JButton[0];
}
buttons = new JButton[actions.length];
for (int i=0; i < buttons.length; i++) {
buttons[i] = new JButton(actions[i]);
buttons[i].setBorderPainted(false);
buttons[i].setOpaque(false);
buttons[i].setText(null);
buttons[i].putClientProperty("hideActionText", Boolean.TRUE); //NOI18N
Object icon = actions[i].getValue(Action.SMALL_ICON);
if (!(icon instanceof Icon)) {
throw new IllegalStateException ("No icon provided for " + actions[i]); //NOI18N
}
buttons[i].setDisabledIcon(ImageUtilities.createDisabledIcon((Icon) icon));
String name = (String) actions[i].getValue(Action.NAME);
String shortDescription = (String) actions[i].getValue(Action.SHORT_DESCRIPTION);
String longDescription = (String) actions[i].getValue(Action.LONG_DESCRIPTION);
if (name == null) name = shortDescription;
if (longDescription == null) longDescription = shortDescription;
buttons[i].getAccessibleContext().setAccessibleName(name);
buttons[i].getAccessibleContext().setAccessibleDescription(longDescription);
}
return buttons;
}
示例15: getContentSelectedIndex
import javax.swing.JComponent; //导入方法依赖的package包/类
private int getContentSelectedIndex() {
if (iterator.current().equals(getChooser())) {
return 0;
} else {
JComponent component = (JComponent) iterator.current().getComponent();
Integer componentIndex = (Integer) component.getClientProperty(PROP_CONTENT_SELECTED_INDEX);
if (componentIndex != null) {
return componentIndex.intValue() + 1;
} else {
return 1;
}
}
}