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

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

源代码1 项目: netbeans   文件: ResourceWizardPanel.java
/** Gets component to display. Implements superclass abstract method. 
 * @return this instance */
protected Component createComponent() {
    JPanel panel = new JPanel(new CardLayout());

    // Accessibility
    panel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ResourceWizardPanel.class).getString("ACS_ResourceWizardPanel"));                 
    
    panel.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(1));

    String msgKey = testWizard ? "TXT_SelectTestResource"       //NOI18N
                               : "TXT_SelectResource";          //NOI18N
    panel.setName(NbBundle.getMessage(ResourceWizardPanel.class, msgKey));
    panel.setPreferredSize(I18nWizardDescriptor.PREFERRED_DIMENSION);
    
    panel.add(getUI(), CARD_GUI);

    return panel;
}
 
源代码2 项目: netbeans   文件: AdditionalWizardPanel.java
/** Gets component to display. Implements superclass abstract method. 
 * @return <code>AdditionalPanel</code> instance */
protected Component createComponent() {
    JPanel panel = new JPanel();
    
    //Accessibility
    panel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(AdditionalWizardPanel.class).getString("ACS_AdditionalWizardPanel"));                    
    
    panel.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(2));
    panel.setName(NbBundle.getBundle(getClass()).getString("TXT_ModifyAdditional"));
    panel.setPreferredSize(I18nWizardDescriptor.PREFERRED_DIMENSION);

    panel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    panel.add(getUI(), constraints);
    
    return panel;
}
 
源代码3 项目: netbeans   文件: TestStringWizardPanel.java
/** Gets component to display. Implements superclass abstract method. 
 * @return this instance */
protected Component createComponent() {
    JPanel panel = new JPanel(new CardLayout());
    panel.getAccessibleContext().setAccessibleDescription(
            NbBundle.getMessage(
                    TestStringWizardPanel.class,
                    "ACS_TestStringWizardPanel"));              //NOI18N
    
    panel.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX,
                            Integer.valueOf(2));
    panel.setName(
            NbBundle.getMessage(TestStringWizardPanel.class,
                                "TXT_FoundMissingResource"));   //NOI18N
    panel.setPreferredSize(I18nWizardDescriptor.PREFERRED_DIMENSION);                    
    return panel;
}
 
源代码4 项目: intellij   文件: BlazeSelectWorkspaceControl.java
public BlazeSelectWorkspaceControl(BlazeNewProjectBuilder builder, Disposable parentDisposable) {
  this.builder = builder;
  this.userSettings = builder.getUserSettings();
  availableWorkspaceTypes =
      BlazeWizardOptionProvider.getInstance()
          .getSelectWorkspaceOptions(this.builder, parentDisposable);
  Preconditions.checkState(
      !availableWorkspaceTypes.isEmpty(), "No project workspace types available to be selected.");

  cardLayout = new CardLayout();
  cardPanel = new JPanel(cardLayout);
  cardPanel.putClientProperty("BorderFactoryClass", PlainSmallWithoutIndent.class.getName());
  cardPanel.setOpaque(false);
  availableWorkspaceTypes.forEach(
      type -> cardPanel.add(type.getUiComponent(), type.getOptionName()));
  workspaceTypeList = new WorkspaceTypeList(availableWorkspaceTypes);
  workspaceTypeList.addListSelectionListener(e -> updateSelection());
  component = initPanel();

  selectInitialItem();
}
 
源代码5 项目: intellij   文件: BlazeSelectWorkspaceControl.java
private JPanel getSideBar() {
  // initially generated by IntelliJ IDEA GUI Designer
  JPanel sidebar = new JPanel(new GridLayoutManager(1, 1, JBUI.emptyInsets(), -1, -1));
  sidebar.putClientProperty("BorderFactoryClass", PlainSmallWithoutIndent.class.getName());
  JBScrollPane scrollPane = new JBScrollPane();
  scrollPane.setViewportView(workspaceTypeList);
  sidebar.add(
      scrollPane,
      new GridConstraints(
          0,
          0,
          1,
          1,
          GridConstraints.ANCHOR_CENTER,
          GridConstraints.FILL_BOTH,
          GridConstraints.SIZEPOLICY_FIXED,
          GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
          null,
          null,
          null,
          0,
          false));
  return sidebar;
}
 
源代码6 项目: netbeans   文件: HardStringWizardPanel.java
/** Gets component to display. Implements superclass abstract method. 
 * @return this instance */
protected Component createComponent() {
    JPanel panel = new JPanel(new CardLayout());
    
    panel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(HardStringWizardPanel.class).getString("ACS_HardStringWizardPanel"));//NOI18N
    
    panel.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(3));
    panel.setName(NbBundle.getBundle(HardStringWizardPanel.class).getString("TXT_ModifyStrings"));//NOI18N
    panel.setPreferredSize(I18nWizardDescriptor.PREFERRED_DIMENSION);        

    return panel;
}
 
源代码7 项目: netbeans   文件: DiffTopComponent.java
DiffTopComponent (MultiDiffPanelController controller) {
    setLayout(new BorderLayout());
    this.controller = controller;
    JPanel panel = controller.getPanel();
    panel.putClientProperty(TopComponent.class, this);
    add(panel, BorderLayout.CENTER);
    getAccessibleContext().setAccessibleName(NbBundle.getMessage(DiffTopComponent.class, "ACSN_Diff_Top_Component")); // NOI18N
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(DiffTopComponent.class, "ACSD_Diff_Top_Component")); // NOI18N
}
 
源代码8 项目: pumpernickel   文件: Inspector.java
/**
 * Create a new Inspector that populates a specific panel.
 * 
 * @param panel
 *            the panel to populate.
 */
public Inspector(JPanel panel) {
	Objects.requireNonNull(panel);
	this.panel = panel;
	panel.putClientProperty(PROPERTY_INSPECTOR, this);
	layout = new InspectorLayoutManager(this);
	panel.setLayout(layout);
	clear();
}
 
源代码9 项目: pumpernickel   文件: Inspector.java
/**
 * Append a row containing these elements to this inspector.
 * 
 * @param identifier
 *            the control on the left. This should usually contain text. A
 *            <code>JLabel</code> or a <code>JCheckBox</code> is
 *            recommended.
 * @param controls
 *            a series of controls to group together from left to right. The
 *            cluster of components will be anchored on the left.
 */
public InspectorRowPanel addRow(JComponent identifier,
		JComponent... controls) {
	if (controls.length == 1) {
		return addRow(identifier, controls[0], false);
	}
	prepare(Position.LEAD, identifier);
	JPanel controlPanel = new JPanel(new GridBagLayout());
	controlPanel.setOpaque(false);
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 1;
	c.anchor = GridBagConstraints.BASELINE;
	for (int a = 0; a < controls.length; a++) {
		Position pos;

		if (a == 0 && a == controls.length - 1) {
			pos = Position.MAIN_WITH_LEAD_NO_STRETCH;
		} else if (a == 0) {
			pos = Position.MAIN_WITH_LEAD_FIRST_IN_SERIES;
		} else if (a == controls.length - 1) {
			pos = Position.MAIN_WITH_LEAD_LAST_IN_SERIES;
		} else {
			pos = Position.MAIN_WITH_LEAD_MIDDLE_IN_SERIES;
		}
		prepare(pos, controls[a]);

		c.insets = getInsets(pos, controls[a]);
		controlPanel.add(controls[a], c);
		c.gridx++;
	}
	controlPanel.putClientProperty(PROPERTY_WRAPPED, Boolean.TRUE);
	return addRow(new InspectorRow(identifier, controlPanel, false, 0));
}
 
源代码10 项目: pumpernickel   文件: Inspector.java
/**
 * Appends a new row containing 3 objects to this inspector.
 * 
 * The identifier is right-aligned. The leftControl is right-aligned, and
 * the rightControl is right-aligned against the far right margin of the
 * inspector.
 * 
 * @param identifier
 *            the control on the left. This should usually contain text. A
 *            <code>JLabel</code> or a <code>JCheckBox</code> is
 *            recommended.
 * @param leftControl
 *            any other control.
 * @param stretchToFill
 *            whether the <code>leftControl</code> should stretch to fit the
 *            remaining width.
 * @param rightControl
 *            the element to add on the right.
 */
public InspectorRowPanel addRow(JComponent identifier,
		JComponent leftControl, boolean stretchToFill,
		JComponent rightControl) {
	prepare(Position.LEAD, identifier);
	Position pos = stretchToFill ? Position.MAIN_WITH_LEAD_STRETCH_TO_FILL
			: Position.MAIN_WITH_LEAD_NO_STRETCH;
	prepare(pos, leftControl);
	prepare(Position.TRAIL, rightControl);

	JPanel controlPanel = new JPanel(new GridBagLayout());
	controlPanel.setOpaque(false);
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	c.weighty = 1;
	c.anchor = GridBagConstraints.BASELINE_LEADING;
	c.fill = stretchToFill ? GridBagConstraints.BOTH
			: GridBagConstraints.NONE;
	c.insets = getInsets(pos, leftControl);
	controlPanel.add(leftControl, c);
	c.gridx++;
	c.weightx = 0;
	c.fill = GridBagConstraints.NONE;
	c.anchor = GridBagConstraints.BASELINE_TRAILING;
	c.insets = getInsets(Position.TRAIL, rightControl);
	controlPanel.add(rightControl, c);
	controlPanel.putClientProperty(PROPERTY_WRAPPED, Boolean.TRUE);
	return addRow(new InspectorRow(identifier, controlPanel, false, 0));
}
 
源代码11 项目: pumpernickel   文件: ControlGridLayout.java
public JPanel createGrid(JComponent... components) {
	JPanel panel = new JPanel();
	panel.setUI(new TopBaselinePanelUI());
	panel.putClientProperty(Inspector.PROPERTY_WRAPPED, Boolean.TRUE);
	addContainer(panel);
	panel.setOpaque(false);
	panel.setLayout(this);
	for (JComponent c : components) {
		c.setOpaque(false);
		panel.add(c);
	}
	return panel;
}
 
源代码12 项目: pumpernickel   文件: QPanelUI.java
private Outline getOutline(JPanel c, boolean ideal) {
	String key = ideal ? PROPERTY_CACHED_SCRATCH_OUTLINE
			: PROPERTY_CACHED_REAL_OUTLINE;
	Outline outline = (Outline) c.getClientProperty(key);
	int effectiveWidth = ideal ? 1000 : c.getWidth();
	int effectiveHeight = ideal ? 1000 : c.getHeight();

	if (outline == null
			|| !outline.isValid(effectiveWidth, effectiveHeight)) {
		outline = new Outline(effectiveWidth, effectiveHeight);
		c.putClientProperty(key, outline);
	}

	return outline;
}
 
源代码13 项目: netbeans   文件: FeaturesView.java
private JPanel createContainer(ProfilerFeature feature) {
    JPanel container = new JPanel(new BorderLayout(0, 0));
    container.putClientProperty(ProfilerFeature.class, feature);
    
    JPanel results = feature.getResultsUI();
    JPanel xresults = new JPanel(new BorderLayout()) {
        public void paint(Graphics g) {
            super.paint(g);
            if (hintLabel != null) {
                Dimension dim = hintLabel.getSize();
                int x = (getWidth() - dim.width) / 2;
                int y = (getHeight() - dim.height) / 2;
                
                g.setColor(hintColor);
                g.fillRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
                g.setColor(Color.LIGHT_GRAY);
                g.drawRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
                
                g.translate(x, y);
                hintLabel.paint(g);
                g.translate(-x, -y);
            }
        }
    };
    xresults.add(results, BorderLayout.CENTER);
    container.add(xresults, BorderLayout.CENTER);
    
    JPanel settings = feature.getSettingsUI();
    if (settings != null) {
        JPanel pan = new JPanel(new BorderLayout(0, 0)) {
            public void setVisible(boolean visible) {
                super.setVisible(visible);
                for (Component c : getComponents()) c.setVisible(visible);
            }
        };
        pan.setOpaque(true);
        pan.setBackground(UIUtils.getProfilerResultsBackground());
        pan.add(settings, BorderLayout.CENTER);
        JSeparator sep = UIUtils.createHorizontalLine(pan.getBackground());
        pan.add(sep, BorderLayout.SOUTH);
        pan.setVisible(settings.isVisible());
        container.add(pan, BorderLayout.NORTH);
    }
    
    return container;
}
 
源代码14 项目: visualvm   文件: FeaturesView.java
private JPanel createContainer(ProfilerFeature feature) {
    JPanel container = new JPanel(new BorderLayout(0, 0));
    container.putClientProperty(ProfilerFeature.class, feature);
    
    JPanel results = feature.getResultsUI();
    JPanel xresults = new JPanel(new BorderLayout()) {
        public void paint(Graphics g) {
            super.paint(g);
            if (hintLabel != null) {
                Dimension dim = hintLabel.getSize();
                int x = (getWidth() - dim.width) / 2;
                int y = (getHeight() - dim.height) / 2;
                
                g.setColor(hintColor);
                g.fillRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
                g.setColor(Color.LIGHT_GRAY);
                g.drawRect(x - XMAR, y - YMAR, dim.width + XMAR * 2, dim.height + YMAR * 2);
                
                g.translate(x, y);
                hintLabel.paint(g);
                g.translate(-x, -y);
            }
        }
    };
    xresults.add(results, BorderLayout.CENTER);
    container.add(xresults, BorderLayout.CENTER);
    
    JPanel settings = feature.getSettingsUI();
    if (settings != null) {
        JPanel pan = new JPanel(new BorderLayout(0, 0)) {
            public void setVisible(boolean visible) {
                super.setVisible(visible);
                for (Component c : getComponents()) c.setVisible(visible);
            }
        };
        pan.setOpaque(true);
        pan.setBackground(UIUtils.getProfilerResultsBackground());
        pan.add(settings, BorderLayout.CENTER);
        JSeparator sep = UIUtils.createHorizontalLine(pan.getBackground());
        pan.add(sep, BorderLayout.SOUTH);
        pan.setVisible(settings.isVisible());
        container.add(pan, BorderLayout.NORTH);
    }
    
    return container;
}
 
源代码15 项目: iBioSim   文件: SBOLInputDialog.java
@Override
protected JPanel createTablePanel(AbstractListTableModel<?> tableModel, String title) 
{
	/* Set up Design Table */
	final JTable table = new JTable(tableModel);
	table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
		@Override
		public void valueChanged(ListSelectionEvent event) {
			setSelectAllowed(table.getSelectedRow() >= 0);
		}
	});

	setWidthAsPercentages(table, tableModel.getWidths());

	TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
	table.setRowSorter(sorter);

	JScrollPane tableScroller = new JScrollPane(table);
	tableScroller.setPreferredSize(new Dimension(450, 200));
	tableScroller.setAlignmentX(LEFT_ALIGNMENT);

	JLabel tableLabel = new JLabel(title);
	tableLabel.setLabelFor(table);

	JPanel tablePane = new JPanel();
	tablePane.setLayout(new BoxLayout(tablePane, BoxLayout.PAGE_AXIS));
	tablePane.add(tableLabel);
	tablePane.add(Box.createRigidArea(new Dimension(0, 5)));
	tablePane.add(tableScroller);

	tablePane.putClientProperty("table", table);
	tablePane.putClientProperty("scroller", tableScroller);
	tablePane.putClientProperty("label", tableLabel);

	//If the user decide to double click on a design, open the design in SBOLDesigner.
	table.addMouseListener(new MouseAdapter() {
		public void mouseClicked(MouseEvent e) {
			if (e.getClickCount() == 2 && table.getSelectedRow() >= 0 && !showModDefs.isSelected())
			{
				SBOLDocument chosenDesign = getSelection(); 
				gui.openSBOLDesigner(filePath, fileName, chosenDesign.getRootComponentDefinitions(), chosenDesign.getDefaultURIprefix());
				setVisible(false);
			}
		}
	});
	
	return tablePane;
}