These code examples were ranked by Codota’s semantic indexing as the best open source examples for Component setName method.
* @param commandGroup the command group, must not be <code>null</code> * * @return the menu item */ public JMenuItem createMenuItem(CommandGroup commandGroup) { JMenu menu = new JMenu(commandGroup.getAction()); menu.setName(commandGroup.getCommandID()); // Ensure that the menu has some text, so that is guranteed to be visible for the user if (menu.getText() == null) { menu.setText(commandGroup.getCommandID()); } enableHelp(menu, commandGroup); return menu; } /** * Creates a tool bar button for the given executable command. * * @param command the executable command, must not be <code>null</code> *
private static JComponent createSplitPanes(Container container, List<? extends JComponent> components, int start, int end, int divide, int orientation) { if (start == end) return components.get(start); else if (end - start == 1) { JSplitPane splitPane = new JSplitPane(orientation, components.get(start), components.get(end)); splitPane.setDividerLocation(divide); splitPane.setContinuousLayout(true); splitPane.setOneTouchExpandable(true); splitPane.setBorder(null); instrumentNames(splitPane); return splitPane; } else { int middle = (start + end) / 2; JSplitPane splitPane = new JSplitPane(orientation, createSplitPanes(container, components, start, middle, divide, orientation), createSplitPanes(container, components, middle + 1, end, divide, orientation)); splitPane.setDividerLocation(divide * (middle + 1));
getContentPane().add(scrollPane); this.editorPane = new JEditorPane(); scrollPane.setViewportView(editorPane); finishedButton = new JButton(); finishedButton.setName("buttonDone"); finishedButton.setBounds(215, 424, 112, 36); finishedButton.setText("Finished"); finishedButton.addActionListener(this); getContentPane().add(finishedButton); } /** * Creates a CCNFileInputStream to write content to a CCN * writes the contents from a CCN to the editorPane * *<p>
menu.setEnabled(false); } } public static JMenuItem makeMenuItem(String label, String name, String actionCommand) { JMenuItem newMenuChoice = new JMenuItem(label); newMenuChoice.setName(name); newMenuChoice.addActionListener(ReportActionRouter.getInstance()); if (actionCommand != null) { newMenuChoice.setActionCommand(actionCommand); } return newMenuChoice; } public static JMenuItem makeMenuItem(String label, String name, String actionCommand, KeyStroke accel) { JMenuItem item = makeMenuItem(label, name, actionCommand); item.setAccelerator(accel); return item; }
}); } void check(Color c) { SwingUtilities.updateComponentTreeUI(label); label.paint(g); if (label.getBackground().getRGB() != c.getRGB()) { System.err.println("Color mismatch!"); System.err.println(" found: " + label.getBackground()); System.err.println(" expected: " + c); throw new RuntimeException("Test failed"); } } void test() { testOverrides(); testInheritance(); testNames(); testBaseColor(); }
HorizontalPanel classNamePanel = new HorizontalPanel(); classNamePanel.add(label); classNamePanel.add(classnameCombo); queueSize = new JTextField("0", 5); // TODO "0" is a hack to prevent NumberFormatException: For input string: "" queueSize.setName("Queue Size"); //$NON-NLS-1$ JLabel queueSizeLabel = new JLabel(JMeterUtils.getResString("backend_listener_queue_size")); // $NON-NLS-1$ queueSizeLabel.setLabelFor(queueSize); HorizontalPanel queueSizePanel = new HorizontalPanel(); queueSizePanel.add(queueSizeLabel, BorderLayout.WEST); queueSizePanel.add(queueSize); JPanel panel = new JPanel(new BorderLayout(0, 5)); panel.add(classNamePanel, BorderLayout.NORTH); panel.add(queueSizePanel, BorderLayout.CENTER); return panel; } /**
mainPanel = new JPanel(); controlPanel = new JPanel(); contentPanel = new JXHeader(); noButton = new JButton("No"); noButton.setName("no button"); yesButton = new JButton("Yes"); yesButton.setName("yes button"); getRootPane().setDefaultButton(yesButton); } /** * Binds the {@link #close() close} action to the exit event generated * either by the close icon or by the {@link #yesButton} or * the {@link #noButton}. */ private void attachListeners() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { close(); } });
* Initialize the GUI components and layout. */ private void init() { setLayout(new BorderLayout(5, 0)); /** The label for the text field. */ JLabel nameLabel = new JLabel(JMeterUtils.getResString("name")); // $NON-NLS-1$ nameLabel.setName("name"); nameLabel.setLabelFor(nameField); add(nameLabel, BorderLayout.WEST); add(nameField, BorderLayout.CENTER); } @Override public void clearGui() { setName(getStaticLabel()); } /** * Get the currently displayed name.
errorThresholdField = new JTextField("0", 5); // $NON-NLS-1$ errorThresholdField.setName(ERROR_THRESHOLD_FIELD); errorThresholdField.addKeyListener(this); thresholdPanel.add(errorThresholdField); thresholdPanel.add(new JLabel("Warning threshold:")); warningThresholdField = new JTextField("0", 5); // $NON-NLS-1$ warningThresholdField.setName(WARNING_THRESHOLD_FIELD); warningThresholdField.addKeyListener(this); thresholdPanel.add(warningThresholdField); assertionPanel.add(thresholdPanel); // file panel filePanel = new FilePanel(JMeterUtils.getResString("html_assertion_file"), ".txt"); //$NON-NLS-1$ //$NON-NLS-2$ assertionPanel.add(filePanel); mainPanel.add(assertionPanel, BorderLayout.NORTH); add(mainPanel, BorderLayout.CENTER); } /**
} // Initialise the gui field values private void initGui(){ threadInput.setText("1"); // $NON-NLS-1$ rampInput.setText("1"); // $NON-NLS-1$ loopPanel.clearGui(); if (showDelayedStart) { delayedStart.setSelected(false); } scheduler.setSelected(false); Date today = new Date(); end.setDate(today); start.setDate(today); delay.setText(""); // $NON-NLS-1$ duration.setText(""); // $NON-NLS-1$ } private void init() { // THREAD PROPERTIES