List of usage examples for javax.swing JButton setBorderPainted
@BeanProperty(visualUpdate = true, description = "Whether the border should be painted.") public void setBorderPainted(boolean b)
borderPainted
property. From source file:op.care.dfn.PnlDFN.java
private List<Component> addFilters() { List<Component> list = new ArrayList<Component>(); jdcDate = new JDateChooser(new Date()); jdcDate.setFont(new Font("Arial", Font.PLAIN, 14)); jdcDate.setBackground(Color.WHITE); list.add(jdcDate);//ww w . ja v a2s . c o m JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(Color.WHITE); buttonPanel.setLayout(new HorizontalLayout(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0)); final JButton homeButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png"))); homeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDate.setDate(jdcDate.getMinSelectableDate()); } }); homeButton.setPressedIcon( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png"))); homeButton.setBorder(null); homeButton.setBorderPainted(false); homeButton.setOpaque(false); homeButton.setContentAreaFilled(false); homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final JButton backButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png"))); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDate.getDate()); DateMidnight min = new DateMidnight(jdcDate.getMinSelectableDate()); if (current.equals(min)) { return; } jdcDate.setDate(SYSCalendar.addDate(jdcDate.getDate(), -1)); } }); backButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png"))); backButton.setBorder(null); backButton.setBorderPainted(false); backButton.setOpaque(false); backButton.setContentAreaFilled(false); backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final JButton fwdButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png"))); fwdButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { DateMidnight current = new DateMidnight(jdcDate.getDate()); if (current.equals(new DateMidnight())) { return; } jdcDate.setDate(SYSCalendar.addDate(jdcDate.getDate(), 1)); } }); fwdButton .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png"))); fwdButton.setBorder(null); fwdButton.setBorderPainted(false); fwdButton.setOpaque(false); fwdButton.setContentAreaFilled(false); fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final JButton endButton = new JButton( new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png"))); endButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { jdcDate.setDate(new Date()); } }); endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png"))); endButton.setBorder(null); endButton.setBorderPainted(false); endButton.setOpaque(false); endButton.setContentAreaFilled(false); endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); buttonPanel.add(homeButton); buttonPanel.add(backButton); buttonPanel.add(fwdButton); buttonPanel.add(endButton); list.add(buttonPanel); jdcDate.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (initPhase) { return; } if (evt.getPropertyName().equals("date")) { reloadDisplay(); } } }); return list; }
From source file:org.apache.cayenne.modeler.editor.AbstractCallbackMethodsTab.java
private void addButtonAtHeader(JTable table, JButton button, ActionListener buttonListener, ImageIcon buttonIcon) {//www .j a v a 2 s .c om PanelBuilder builder = new PanelBuilder(new FormLayout("left:10dlu, 2dlu", "center:10dlu")); CellConstraints cc = new CellConstraints(); button.setIcon(buttonIcon); button.setOpaque(false); button.setBorderPainted(false); button.setContentAreaFilled(false); button.addActionListener(buttonListener); builder.add(button, cc.xy(1, 1)); JPanel buttonPanel = builder.getPanel(); buttonPanel.setOpaque(false); JTableHeader header = table.getTableHeader(); header.setLayout(new BorderLayout()); header.setReorderingAllowed(false); header.setPreferredSize(new Dimension(150, 20)); header.add(buttonPanel, BorderLayout.EAST); }
From source file:org.apache.jmeter.util.JMeterUtils.java
/** * Create a button with the netscape style * * @param name/* w w w . ja va2 s .c o m*/ * Description of Parameter * @param listener * Description of Parameter * @return Description of the Returned Value * @deprecated (3.0) not used */ @Deprecated public static JButton createButton(String name, ActionListener listener) { JButton button = new JButton(getImage(name + ".on.gif")); // $NON-NLS-1$ button.setDisabledIcon(getImage(name + ".off.gif")); // $NON-NLS-1$ button.setRolloverIcon(getImage(name + ".over.gif")); // $NON-NLS-1$ button.setPressedIcon(getImage(name + ".down.gif")); // $NON-NLS-1$ button.setActionCommand(name); button.addActionListener(listener); button.setRolloverEnabled(true); button.setFocusPainted(false); button.setBorderPainted(false); button.setOpaque(false); button.setPreferredSize(new Dimension(24, 24)); return button; }
From source file:org.apache.jmeter.util.JMeterUtils.java
/** * Create a button with the netscape style * * @param name// w ww . j a va2 s. co m * Description of Parameter * @param listener * Description of Parameter * @return Description of the Returned Value * @deprecated (3.0) not used */ @Deprecated public static JButton createSimpleButton(String name, ActionListener listener) { JButton button = new JButton(getImage(name + ".gif")); // $NON-NLS-1$ button.setActionCommand(name); button.addActionListener(listener); button.setFocusPainted(false); button.setBorderPainted(false); button.setOpaque(false); button.setPreferredSize(new Dimension(25, 25)); return button; }
From source file:org.drugis.addis.gui.WelcomeDialog.java
private void removeBackground(JButton button) { button.setOpaque(false); button.setContentAreaFilled(false); button.setBorderPainted(false); }
From source file:org.eobjects.datacleaner.panels.OpenAnalysisJobPanel.java
public OpenAnalysisJobPanel(final FileObject file, final AnalyzerBeansConfiguration configuration, final OpenAnalysisJobActionListener openAnalysisJobActionListener) { super(WidgetUtils.BG_COLOR_LESS_BRIGHT, WidgetUtils.BG_COLOR_LESS_BRIGHT); _file = file;/*from w w w . ja v a 2 s. c o m*/ _openAnalysisJobActionListener = openAnalysisJobActionListener; setLayout(new BorderLayout()); setBorder(WidgetUtils.BORDER_LIST_ITEM); final AnalysisJobMetadata metadata = getMetadata(configuration); final String jobName = metadata.getJobName(); final String jobDescription = metadata.getJobDescription(); final String datastoreName = metadata.getDatastoreName(); final boolean isDemoJob = isDemoJob(metadata); final DCPanel labelListPanel = new DCPanel(); labelListPanel.setLayout(new VerticalLayout(4)); labelListPanel.setBorder(new EmptyBorder(4, 4, 4, 0)); final String title; final String filename = file.getName().getBaseName(); if (Strings.isNullOrEmpty(jobName)) { final String extension = FileFilters.ANALYSIS_XML.getExtension(); if (filename.toLowerCase().endsWith(extension)) { title = filename.substring(0, filename.length() - extension.length()); } else { title = filename; } } else { title = jobName; } final JButton titleButton = new JButton(title); titleButton.setFont(WidgetUtils.FONT_HEADER1); titleButton.setForeground(WidgetUtils.BG_COLOR_BLUE_MEDIUM); titleButton.setHorizontalAlignment(SwingConstants.LEFT); titleButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, WidgetUtils.BG_COLOR_MEDIUM)); titleButton.setToolTipText("Open job"); titleButton.setOpaque(false); titleButton.setMargin(new Insets(0, 0, 0, 0)); titleButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); titleButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isDemoDatastoreConfigured(datastoreName, configuration)) { _openAnalysisJobActionListener.openFile(_file); } } }); final JButton executeButton = new JButton(executeIcon); executeButton.setOpaque(false); executeButton.setToolTipText("Execute job directly"); executeButton.setMargin(new Insets(0, 0, 0, 0)); executeButton.setBorderPainted(false); executeButton.setHorizontalAlignment(SwingConstants.RIGHT); executeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isDemoDatastoreConfigured(datastoreName, configuration)) { final ImageIcon executeIconLarge = ImageManager.get().getImageIcon(IconUtils.ACTION_EXECUTE); final String question = "Are you sure you want to execute the job\n'" + title + "'?"; final int choice = JOptionPane.showConfirmDialog(null, question, "Execute job?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, executeIconLarge); if (choice == JOptionPane.YES_OPTION) { final Injector injector = _openAnalysisJobActionListener.openAnalysisJob(_file); if (injector != null) { final ResultWindow resultWindow = injector.getInstance(ResultWindow.class); resultWindow.open(); resultWindow.startAnalysis(); } } } } }); final DCPanel titlePanel = new DCPanel(); titlePanel.setLayout(new BorderLayout()); titlePanel.add(DCPanel.around(titleButton), BorderLayout.CENTER); titlePanel.add(executeButton, BorderLayout.EAST); labelListPanel.add(titlePanel); if (!Strings.isNullOrEmpty(jobDescription)) { String desc = StringUtils.replaceWhitespaces(jobDescription, " "); desc = StringUtils.replaceAll(desc, " ", " "); final JLabel label = new JLabel(desc); label.setFont(WidgetUtils.FONT_SMALL); labelListPanel.add(label); } final Icon icon; { if (!StringUtils.isNullOrEmpty(datastoreName)) { final JLabel label = new JLabel(" " + datastoreName); label.setFont(WidgetUtils.FONT_SMALL); labelListPanel.add(label); final Datastore datastore = configuration.getDatastoreCatalog().getDatastore(datastoreName); if (isDemoJob) { icon = demoBadgeIcon; } else { icon = IconUtils.getDatastoreSpecificAnalysisJobIcon(datastore); } } else { icon = ImageManager.get().getImageIcon(IconUtils.MODEL_JOB, IconUtils.ICON_SIZE_LARGE); } } final JLabel iconLabel = new JLabel(icon); iconLabel.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight())); add(iconLabel, BorderLayout.WEST); add(labelListPanel, BorderLayout.CENTER); }
From source file:org.nuclos.client.customcomp.resplan.ResPlanPanel.java
public ResPlanPanel(ResPlanController cntrl, CollectableResPlanModel model, DateTimeModel timeModel) { final SpringLocaleDelegate localeDelegate = SpringLocaleDelegate.getInstance(); this.controller = cntrl; this.timeModel = timeModel; this.resPlanModel = model; setLayout(new BorderLayout()); JToolBar tb = UIUtils.createNonFloatableToolBar(); tb.setFloatable(false);// w ww .j a v a 2s . c o m tb.add(new AbstractAction(localeDelegate.getText("nuclos.resplan.action.refresh"), Icons.getInstance().getIconRefresh16()) { @Override public void actionPerformed(ActionEvent e) { controller.refresh(); } }); tb.add(exportAction); tb.addSeparator(); this.timeHorizon = new Interval<Date>(model.getDefaultViewFrom(), model.getDefaultViewUntil()); final LabeledComponentSupport support = new LabeledComponentSupport(); startDateChooser = new DateChooser(support, timeHorizon.getStart()); startDateChooser.setMinimumSize(startDateChooser.getPreferredSize()); startDateChooser.setMaximumSize(startDateChooser.getPreferredSize()); endDateChooser = new DateChooser(support, timeHorizon.getEnd()); endDateChooser.setMinimumSize(endDateChooser.getPreferredSize()); endDateChooser.setMaximumSize(endDateChooser.getPreferredSize()); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.from"))); tb.add(startDateChooser); tb.add(Box.createHorizontalStrut(5)); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.until"))); tb.add(endDateChooser); timeGranularityModel = new ListComboBoxModel<ResPlanController.TimeGranularity>( controller.getTimeGranularityOptions()); tb.addSeparator(); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.granularity"))); timeGranularityComboBox = new JComboBox(timeGranularityModel); tb.add(timeGranularityComboBox); timeGranularityComboBox .setMaximumSize(Orientation.VERTICAL.updateExtent(timeGranularityComboBox.getPreferredSize(), 20)); tb.addSeparator(); tb.add(new JLabel(localeDelegate.getText("nuclos.resplan.toolbar.resourceFilter"))); searchFilterComboBox = new JComboBox(); searchFilterComboBox.setRenderer(new SearchFilterListCellRenderer()); refreshSearchFilter(); tb.add(searchFilterComboBox); searchFilterComboBox .setMaximumSize(Orientation.VERTICAL.updateExtent(searchFilterComboBox.getPreferredSize(), 20)); tb.add(Box.createGlue()); infoButton = new JButton(infoAction); infoButton.setVisible(false); tb.add(infoButton); tb.add(Box.createHorizontalStrut(3)); initJResPlan(); ActionListener dateChooserListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { timeHorzionChanged(); } }; startDateChooser.addActionListener(dateChooserListener); endDateChooser.addActionListener(dateChooserListener); timeGranularityComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Runnable runnable = createScrollToCurrentAreaRunnable(); ResPlanController.TimeGranularity granularity = timeGranularityModel.getSelectedItem(); resPlan.setTimeModel(granularity.getTimeModel()); resPlan.getTimelineHeader().setCategoryModel(granularity.getHeaderCategories()); SwingUtilities.invokeLater(runnable); } } }); searchFilterComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { EntitySearchFilter filter = (EntitySearchFilter) searchFilterComboBox.getSelectedItem(); if (filter instanceof NewCustomSearchFilter) { runCustomSearch(); return; } setSearchCondition(filter.getSearchCondition()); } } }); scrollPane = new JScrollPane(resPlan); JButton corner = new JButton(switchOrientationAction); corner.setBorderPainted(false); scrollPane.setCorner(JScrollPane.LOWER_RIGHT_CORNER, corner); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); add(tb, BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); resPlan.setTimeHorizon(this.timeHorizon); resPlan.invalidate(); setFocusable(true); setFocusCycleRoot(true); getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("DELETE"), "delete"); //getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("control F"), "find"); getActionMap().put("delete", removeAction); //getActionMap().put("find", findAction); KeyBindingProvider.bindActionToComponent(KeyBindingProvider.ACTIVATE_SEARCH_PANEL_2, findAction, this); }
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);//w w w . j ava 2 s . c o 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.orbisgis.core.ui.plugins.views.geocatalog.Catalog.java
private JPanel getTagPanel() { JPanel ret = new JPanel(); ret.setBorder(BorderFactory// ww w . ja va 2 s . co m .createTitledBorder(I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.tags"))); ret.setLayout(new BorderLayout()); lstTags = new JList(); tagListModel = new DefaultListModel(); refreshTagModel(); lstTags.setModel(tagListModel); lstTags.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { doFilter(); btnDelTag.setEnabled(lstTags.getSelectedIndex() != -1); } }); lstTags.setVisibleRowCount(FILTER_VISIBLE_ROW_COUNT - 1); JScrollPane scroll = new JScrollPane(lstTags); ret.add(scroll, BorderLayout.CENTER); JPanel pnlButtons = new JPanel(); JButton btnAdd = getTagManagementButton(OrbisGISIcon.ADD, AC_BTN_ADD_TAG); btnAdd.setBorderPainted(false); btnAdd.setContentAreaFilled(false); btnDelTag = getTagManagementButton(OrbisGISIcon.DEL, AC_BTN_DEL_TAG); btnDelTag.setEnabled(false); btnDelTag.setBorderPainted(false); btnDelTag.setContentAreaFilled(false); pnlButtons.add(btnAdd); pnlButtons.add(btnDelTag); ret.add(pnlButtons, BorderLayout.SOUTH); return ret; }
From source file:org.revager.tools.GUITools.java
/** * Creates a new image button.//from w ww . j ava 2s .c om * * @param icon * the normal icon * @param rolloverIcon * the rollover icon * @param action * the action * * @return the newly created image button */ public static JButton newImageButton(ImageIcon icon, ImageIcon rolloverIcon, Action action) { JButton button = new JButton(action); button.setToolTipText(button.getText()); button.setText(null); button.setContentAreaFilled(false); button.setBorder(new EmptyBorder(0, 0, 0, 0)); button.setMargin(new Insets(0, 0, 0, 0)); button.setBorderPainted(false); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); button.setFocusPainted(false); button.setFocusable(false); button.setIcon(icon); button.setRolloverIcon(rolloverIcon); button.setRolloverSelectedIcon(rolloverIcon); button.setSelectedIcon(rolloverIcon); return button; }