javax.swing.JComponent#putClientProperty ( )源码实例Demo

下面列出了javax.swing.JComponent#putClientProperty ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: constellation   文件: ExportToJdbcAction.java
@Override
public void actionPerformed(final ActionEvent e) {
    final Graph graph = context.getGraph();
    final WizardDescriptor.Panel<WizardDescriptor>[] panels = new WizardDescriptor.Panel[]{new ConnectionPanelController(graph), new TablesPanelController(), new MappingPanelController(graph, true)};
    final String[] steps = new String[panels.length];
    int i = 0;
    for (final WizardDescriptor.Panel<WizardDescriptor> panel : panels) {
        final JComponent jc = (JComponent) panel.getComponent();
        steps[i] = jc.getName();
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
        i++;
    }
    final WizardDescriptorData wd = new WizardDescriptorData(panels);
    wd.setTitleFormat(new MessageFormat("{0}"));
    wd.setTitle(Bundle.MSG_ExportToJdbc());
    final Object result = DialogDisplayer.getDefault().notify(wd);
    if (result == DialogDescriptor.OK_OPTION) {
        final ExportToJdbcPlugin exporter = new ExportToJdbcPlugin(wd.data);
        PluginExecution.withPlugin(exporter).executeLater(graph);
    }
}
 
源代码2 项目: netbeans   文件: IDENativeMavenWizardIterator.java
@Override
@Messages("LBL_CreateProjectStep2=Name and Location")
public void initialize(WizardDescriptor wiz) {
    this.wiz = wiz;
    if (titlename != null) {
        wiz.putProperty ("NewProjectWizard_Title", titlename); // NOI18N        
    }
    index = 0;
    ValidationGroup vg = ValidationGroup.create(new WizardDescriptorAdapter(wiz));
    panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
    List<String> steps = new ArrayList<String>();
    
    panels.add(new BasicWizardPanel(vg, null, true, false, null)); //only download archetype (for additional props) when unknown archetype is used.
    steps.add(LBL_CreateProjectStep2());
    for (int i = 0; i < panels.size(); i++) {
        JComponent c = (JComponent) panels.get(i).getComponent();
        c.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
        c.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps.toArray(new String[0]));
  }
    
}
 
源代码3 项目: netbeans   文件: BaseWizardIterator.java
private void updateSteps() {
    // Make sure list of steps is accurate.
    String[] steps = new String[panels.length];
    String[] basicOnes = createSteps();
    System.arraycopy(basicOnes, 0, steps, 0, basicOnes.length);
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (i >= basicOnes.length || steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName();
        }
        if (c instanceof JComponent) {
            // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty("WizardPanel_contentSelectedIndex", Integer.valueOf(i)); //NOI18N
            // Step name (actually the whole list for reference).
            jc.putClientProperty("WizardPanel_contentData", steps); //NOI18N
        }
    }
}
 
源代码4 项目: netbeans   文件: NewFileWizardIterator.java
@Override
public void initialize(WizardDescriptor wizard) {
    this.wizard = wizard;
    phpProject = getPhpProject();
    checkPhpProject();
    setTargetFolder();
    wizardPanels = getPanels();

    // Make sure list of steps is accurate.
    String[] beforeSteps = (String[]) wizard.getProperty(WizardDescriptor.PROP_CONTENT_DATA);
    int beforeStepLength = beforeSteps.length - 1;
    String[] steps = createSteps(beforeSteps);
    for (int i = 0; i < wizardPanels.length; i++) {
        Component c = wizardPanels[i].getComponent();
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent) c;
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i + beforeStepLength - 1)); // NOI18N
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); // NOI18N
        }
    }
}
 
源代码5 项目: netbeans   文件: NewFileWizardIterator.java
@Override
public void initialize(WizardDescriptor wizard) {
    this.descriptor = wizard;
    setTargetFolder();
    panels = getPanels();

    // make sure list of steps is accurate.
    String[] beforeSteps = (String[]) wizard.getProperty(WizardDescriptor.PROP_CONTENT_DATA);
    int beforeStepLength = beforeSteps.length - 1;
    String[] steps = createSteps(beforeSteps);
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent) c;
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i + beforeStepLength - 1));
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
}
 
源代码6 项目: netbeans   文件: CordovaSampleIterator.java
@Override
public void initialize(WizardDescriptor wizard) {
    descriptor = wizard;
    myPanels = createPanels(wizard);

    String[] steps = createSteps();
    for (int i = 0; i < myPanels.length; i++) {
        Component c = myPanels[i].getComponent();
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i));
            // Step name (actually the whole list for reference).
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
}
 
源代码7 项目: pumpernickel   文件: PaddingInfo.java
/**
 * Should be called shortly after <code>prep()</code>.
 */
private static void restore(Component c) {
	if (c instanceof JComponent) {
		JComponent jc = (JComponent) c;
		Boolean b = (Boolean) jc.getClientProperty(USED_TO_BE_OPAQUE);
		if (b != null && b.booleanValue()) {
			jc.setOpaque(true);
		}
		jc.putClientProperty(USED_TO_BE_OPAQUE, null);

		Dimension d = (Dimension) jc.getClientProperty(SIZE);
		if (d != null) {
			jc.setSize(d);
			jc.putClientProperty(SIZE, null);
		}
	}
	if (c instanceof JSlider) {
		JSlider s = (JSlider) c;
		ChangeListener[] listeners = (ChangeListener[]) s
				.getClientProperty(CHANGE_LISTENERS);
		Integer i = (Integer) s.getClientProperty(SLIDER_VALUE);
		if (i != null)
			s.setValue(i.intValue());
		if (listeners != null) {
			for (int a = 0; a < listeners.length; a++) {
				s.addChangeListener(listeners[a]);
			}
		}
		s.putClientProperty(SLIDER_VALUE, null);
		s.putClientProperty(CHANGE_LISTENERS, null);
	}
	if (c instanceof Container) {
		Container c2 = (Container) c;
		for (int a = 0; a < c2.getComponentCount(); a++) {
			restore(c2.getComponent(a));
		}
	}
}
 
源代码8 项目: MikuMikuStudio   文件: NewBloomFilterAction.java
/**
 * Initialize panels representing individual wizard's steps and sets
 * various properties for them influencing wizard appearance.
 */
private WizardDescriptor.Panel[] getPanels() {
    if (panels == null) {
        panels = new WizardDescriptor.Panel[]{
            new BloomWizardPanel1()
        };
        String[] steps = new String[panels.length];
        for (int i = 0; i < panels.length; i++) {
            Component c = panels[i].getComponent();
            // Default step name to component name of panel. Mainly useful
            // for getting the name of the target chooser to appear in the
            // list of steps.
            steps[i] = c.getName();
            if (c instanceof JComponent) { // assume Swing components
                JComponent jc = (JComponent) c;
                // Sets step number of a component
                // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*:
                jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
                // Sets steps names for a panel
                jc.putClientProperty("WizardPanel_contentData", steps);
                // Turn on subtitle creation on each step
                jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
                // Show steps on the left side with the image on the background
                jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
                // Turn on numbering of all steps
                jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
            }
        }
    }
    return panels;
}
 
源代码9 项目: netbeans   文件: WLInstantiatingIterator.java
private void initComponent(Component c, int step) {
    if (c instanceof JComponent) {
        JComponent jc = (JComponent) c;
        // Step #.
        jc.putClientProperty(
            WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, step);

        // Step name (actually the whole list for reference).
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
    }
}
 
源代码10 项目: NBANDROID-V2   文件: CreateAvdWizardIterator.java
private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() {
    if (panels == null) {
        panels = new ArrayList<>();
        panels.add(new CreateAvdWizardPanel1(wizard));
        panels.add(new CreateAvdWizardPanel2(wizard));
        panels.add(new CreateAvdWizardPanel3(wizard));
        String[] steps = createSteps();
        for (int i = 0; i < panels.size(); i++) {
            Component c = panels.get(i).getComponent();
            if (steps[i] == null) {
                // Default step name to component name of panel. Mainly
                // useful for getting the name of the target chooser to
                // appear in the list of steps.
                steps[i] = c.getName();
            }
            if (c instanceof JComponent) { // assume Swing components
                JComponent jc = (JComponent) c;
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
                jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
            }
        }
    }
    return panels;
}
 
源代码11 项目: netbeans   文件: ListenerIterator.java
public void initialize (WizardDescriptor wiz) {
    this.wiz = (TemplateWizard) wiz;
    index = 0;
    panels = createPanels (this.wiz);
    
    // Creating steps.
    Object prop = wiz.getProperty (WizardDescriptor.PROP_CONTENT_DATA); // NOI18N
    String[] beforeSteps = null;
    if (prop != null && prop instanceof String[]) {
        beforeSteps = (String[])prop;
    }
    String[] steps = Utilities.createSteps (beforeSteps, panels);
    
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent ();
        if (steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName ();
        }
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i));
            // Step name (actually the whole list for reference).
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
}
 
源代码12 项目: netbeans   文件: TemplateClientIterator.java
@Override
public void initialize(TemplateWizard wiz) {
    index = 0;
    Project project = Templates.getProject( wiz );
    panels = createPanels(project, wiz);
    
    // Creating steps.
    Object prop = wiz.getProperty(WizardDescriptor.PROP_CONTENT_DATA); // NOI18N
    String[] beforeSteps = null;
    if (prop != null && prop instanceof String[]) {
        beforeSteps = (String[])prop;
    }
    String[] steps = createSteps(beforeSteps, panels);
    
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName();
        }
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, new Integer(i));
            // Step name (actually the whole list for reference).
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
}
 
源代码13 项目: seaglass   文件: SeaGlassMenuUI.java
/**
 * @inheritDoc
 */
@Override
public void uninstallUI(JComponent c) {
    super.uninstallUI(c);
    // Remove values from the parent's Client Properties.
    JComponent p = MenuItemLayoutHelper.getMenuItemParent((JMenuItem) c);
    if (p != null) {
        p.putClientProperty(SeaGlassMenuItemLayoutHelper.MAX_ACC_OR_ARROW_WIDTH, null);
    }
}
 
源代码14 项目: netbeans   文件: PayaraDDWizardIterator.java
/**
 * Initialize panels representing individual wizard's steps and sets
 * various properties for them influencing wizard appearance.
 */
private WizardDescriptor.Panel[] getPanels() {
    if (panels == null) {
        panels = new WizardDescriptor.Panel[] {
            new PayaraDDWizardPanel()
        };
        String[] steps = createSteps();
        for (int i = 0; i < panels.length; i++) {
            Component c = panels[i].getComponent();
            if (steps[i] == null) {
                // Default step name to component name of panel. Mainly
                // useful for getting the name of the target chooser to
                // appear in the list of steps.
                steps[i] = c.getName();
            }
            if (c instanceof JComponent) { // assume Swing components
                JComponent jc = (JComponent) c;
                // Sets step number of a component
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i)); // NOI18N
                // Sets steps names for a panel
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); // NOI18N
                // Turn on subtitle creation on each step
                jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.TRUE); // NOI18N
                // Show steps on the left side with the image on the background
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, Boolean.TRUE); // NOI18N
                // Turn on numbering of all steps
                jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, Boolean.TRUE); // NOI18N
            }
        }
    }
    return panels;
}
 
public static void increaseTextBrightness(JComponent c) {
    Color color = c.getForeground();
    c.putClientProperty("mouseover_brightness", color);
    float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
    
    hsb[2] = Math.min(1.0f, hsb[2] * 2.0f);
    c.setForeground(Color.getHSBColor(hsb[0], hsb[1], hsb[2]));
}
 
源代码16 项目: pumpernickel   文件: QComboBoxUI.java
@Override
public void mouseExited(MouseEvent e) {
	JComponent jc = (JComponent) e.getComponent();
	jc.putClientProperty(PROPERTY_IS_MOUSE_ROLLOVER, Boolean.FALSE);
}
 
@Override
public void initialize(WizardDescriptor wiz) {
    this.wiz = wiz;
    wiz.putProperty("NewProjectWizard_Title", NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_WizardTitle")); //NOI18N
    index = 0;
    // set other defaults
    this.wiz.putProperty(WIZ_USE_SB_MVN_PLUGIN, true);
    this.wiz.putProperty(WIZ_REMOVE_MVN_WRAPPER, true);
    // create the wizard panels
    panels = new WizardDescriptor.Panel[]{
        new InitializrProjectWizardPanel1(),
        new InitializrProjectWizardPanel2(),
        new InitializrProjectWizardPanel3()
    };
    // Make sure list of steps is accurate.
    String[] steps = new String[]{
        NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_BasePropsStep"),
        NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_DependenciesStep"),
        NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_CreateProjectStep")
    };
    // create wizard steps gui components
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName();
        }
        if (c instanceof JComponent) {
            // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
            // Step name (actually the whole list for reference).
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
    // schedule async retrieval of initializr metadata in panel visual 1
    Utilities.attachInitJob(panels[0].getComponent(), (AsyncGUIJob) panels[0].getComponent());
}
 
源代码18 项目: netbeans   文件: AddInstanceIterator.java
private void setContentSelectedIndex(JComponent component) {
    if (component.getClientProperty(PROP_CONTENT_SELECTED_INDEX) == null) {
        component.putClientProperty(PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(0));
    }
}
 
源代码19 项目: pumpernickel   文件: FileList.java
protected synchronized void updateFileListComponents() {
	throbber.setVisible(!finishedSearch);
	removeAll();
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = getColumnCount() - 1;
	c.gridy = 0;
	c.weightx = 0;
	c.weighty = 0;
	c.insets = new Insets(5, 5, 5, 5);
	c.anchor = GridBagConstraints.EAST;
	add(throbber, c);

	c.gridx = 0;
	c.weightx = 1;
	c.anchor = GridBagConstraints.WEST;
	c.fill = GridBagConstraints.BOTH;
	if (constrainedList.getSize() == 0) {
		if (finishedSearch) {
			add(emptyLabel, c);
		} else {
			add(searchingLabel, c);
		}
	}

	for (int a = 0; a < constrainedList.getSize(); a++) {
		File file = constrainedList.getElementAt(a);
		JComponent jc = componentCache.get(file);
		if (jc == null) {
			jc = createComponent(file);
			jc.putClientProperty(KEY_FILE, file);
			componentCache.put(file, jc);
		}

		add(jc, c);
		c.gridx = (c.gridx + 1) % getColumnCount();
		if (c.gridx == 0)
			c.gridy++;
	}
	c.gridy++;
	c.weighty = 1;
	add(fluff, c);

	revalidate();
	repaint();
}
 
源代码20 项目: netbeans   文件: GridUtils.java
/**
 * Creates a padding component.
 *
 * @param horizontalPadding determines whether we are interested in horizontal padding.
 * @param verticalPadding determines whether we are interested in vertical padding.
 * @param paddingSize determines padding component size in pixels.
 * @return new padding component.
 */
private static Component createPaddingComponent(boolean horizontalPadding, boolean verticalPadding, int paddingSize) {
    Dimension dim = new Dimension(horizontalPadding ? paddingSize : 0, verticalPadding ? paddingSize : 0);
    JComponent padding = (JComponent)Box.createRigidArea(dim);
    padding.putClientProperty(PADDING_COMPONENT, Boolean.TRUE);
    return padding;
}