List of usage examples for javax.swing JButton setName
public void setName(String name)
From source file:org.openmicroscopy.shoola.agents.treeviewer.browser.BrowserUI.java
/** Helper method to create the menu bar. */ private void createMenuBars() { rightMenuBar = new JToolBar(); rightMenuBar.setBorder(null);/*from w w w.j a v a 2 s .co m*/ rightMenuBar.setRollover(true); rightMenuBar.setFloatable(false); JButton button; leftMenuBar = new JToolBar(); leftMenuBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); leftMenuBar.setRollover(true); leftMenuBar.setFloatable(false); BrowserManageAction a; int type = model.getBrowserType(); switch (type) { case Browser.PROJECTS_EXPLORER: case Browser.SCREENS_EXPLORER: a = (BrowserManageAction) controller.getAction(BrowserControl.NEW_CONTAINER); button = new JButton(a); button.setName("new container button"); button.setBorderPainted(false); button.addMouseListener(a); rightMenuBar.add(button); break; case Browser.ADMIN_EXPLORER: a = (BrowserManageAction) controller.getAction(BrowserControl.NEW_ADMIN); button = new JButton(a); button.setName("new group or user button"); button.setBorderPainted(false); button.addMouseListener(a); rightMenuBar.add(button); break; case Browser.TAGS_EXPLORER: a = (BrowserManageAction) controller.getAction(BrowserControl.NEW_TAG); button = new JButton(a); button.setName("new tag button"); button.setBorderPainted(false); button.addMouseListener(a); rightMenuBar.add(button); } button = new JButton(controller.getAction(BrowserControl.CUT)); button.setName("cut button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.COPY)); button.setName("copy button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.PASTE)); button.setName("paste button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.DELETE)); button.setName("delete button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.REFRESH)); button.setName("refresh button"); button.setBorderPainted(false); rightMenuBar.add(button); if (type == Browser.ADMIN_EXPLORER) { button = new JButton(controller.getAction(BrowserControl.RESET_PASSWORD)); button.setBorderPainted(false); rightMenuBar.add(button); } else { button = new JButton(controller.getAction(BrowserControl.IMPORT)); button.setBorderPainted(false); //rightMenuBar.add(button); } rightMenuBar.add(Box.createHorizontalStrut(6)); rightMenuBar.add(new JSeparator()); rightMenuBar.add(Box.createHorizontalStrut(6)); ButtonGroup group = new ButtonGroup(); JToggleButton b = new JToggleButton(); group.add(b); b.setBorderPainted(true); b.setSelected(true); b.setAction(controller.getAction(BrowserControl.SORT)); rightMenuBar.add(b); b = new JToggleButton(controller.getAction(BrowserControl.SORT_DATE)); b.setBorderPainted(true); group.add(b); rightMenuBar.add(b); partialButton = new JToggleButton(controller.getAction(BrowserControl.PARTIAL_NAME)); partialButton.setBorderPainted(true); rightMenuBar.add(partialButton); rightMenuBar.add(new JSeparator(JSeparator.VERTICAL)); button = new JButton(controller.getAction(BrowserControl.COLLAPSE)); button.setBorderPainted(false); rightMenuBar.add(button); }
From source file:org.rdv.ui.channel.LocalChannelDialog.java
private JPanel buildFooterPanel() { JPanel footerPanel = new JPanel(); if (isChannelAddOperation()) { channelActionButton.setName("addChannelButton"); channelActionButton.setText(PROPERTY_REPO.getValue(ADD_CHANNEL_BUTTON_KEY)); } else { // channel exists channelActionButton.setName("saveChannelButton"); channelActionButton.setText(PROPERTY_REPO.getValue(SAVE_CHANNEL_BUTTON_KEY)); }// w ww .ja v a 2 s . c o m channelActionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isChannelAddOperation()) { addChannel(); } else { updateChannel(); } } }); footerPanel.add(channelActionButton); JButton cancelButton = new JButton(); cancelButton.setName("cancelButton"); cancelButton.setText(PROPERTY_REPO.getValue(CANCEL_BUTTON_KEY)); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cancel(); } }); footerPanel.add(cancelButton); helpButton.setText(PROPERTY_REPO.getValue(HELP_BUTTON_KEY)); helpButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Browser.open(getOwner(), new URI(PROPERTY_REPO.getValue(ADD_CHANNEL_DOC_KEY))); } catch (URISyntaxException e1) { LOGGER.error("", e1); e1.printStackTrace(); } } }); footerPanel.add(helpButton); return footerPanel; }
From source file:org.rdv.ui.channel.LocalChannelDialog.java
private JPanel buildVariablesPanel() { JPanel variablesPanel = new JPanel(); variablesPanel.setLayout(new BorderLayout()); JScrollPane variablesScrollPane = new JScrollPane(variablesTable.getComponent()); variablesPanel.add(variablesScrollPane, BorderLayout.CENTER); Box variablesButtonsPanel = Box.createVerticalBox(); variablesButtonsPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); JButton addVariableButton = new JButton(); addVariableButton.setName("addVariableButton"); addVariableButton.setText(PROPERTY_REPO.getValue(ADD_VARIABLE_BUTTON_KEY)); addVariableButton.addActionListener(new ActionListener() { @Override/*from ww w. j a v a2s .c o m*/ public void actionPerformed(ActionEvent e) { addVariable(); } }); variablesButtonsPanel.add(addVariableButton); variablesButtonsPanel.add(Box.createVerticalStrut(5)); removeVariableButton.setName("removeVariableButton"); removeVariableButton.setText(PROPERTY_REPO.getValue(REMOVE_VARIABLE_BUTTON_KEY)); removeVariableButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeVariable(); } }); variablesButtonsPanel.add(removeVariableButton); variablesPanel.add(variablesButtonsPanel, BorderLayout.EAST); return variablesPanel; }