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:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getImageButton(ImageIcon icon) { JButton res = new JButton(icon); res.setMargin(new Insets(0, 0, 0, 0)); res.setBorderPainted(false); res.setContentAreaFilled(false);// ww w . ja v a 2 s. c o m return res; }
From source file:edu.gmu.cs.sim.util.media.chart.SeriesAttributes.java
void buildManipulators() { JButton removeButton = new JButton(I_CLOSE); removeButton.setPressedIcon(I_CLOSE_PRESSED); removeButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));//4,4,4,4)); removeButton.setBorderPainted(false); removeButton.setContentAreaFilled(false); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (JOptionPane.showOptionDialog(null, "Remove the Series " + getSeriesName() + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[] { "Remove", "Cancel" }, null) == 0) // remove {//from w w w.ja v a 2 s .c o m getGenerator().removeSeries(getSeriesIndex()); } } }); removeButton.setToolTipText("Remove this series"); JButton upButton = new JButton(I_UP); upButton.setPressedIcon(I_UP_PRESSED); upButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));//4,4,4,4)); upButton.setBorderPainted(false); upButton.setContentAreaFilled(false); upButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getGenerator().moveSeries(getSeriesIndex(), true); } }); upButton.setToolTipText("Draw this series higher in the series order"); JButton downButton = new JButton(I_DOWN); downButton.setPressedIcon(I_DOWN_PRESSED); downButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));//4,4,4,4)); downButton.setBorderPainted(false); downButton.setContentAreaFilled(false); downButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getGenerator().moveSeries(getSeriesIndex(), false); } }); downButton.setToolTipText("Draw this series lower in the series order"); manipulators.add(removeButton); manipulators.add(upButton); manipulators.add(downButton); }
From source file:sim.util.media.chart.SeriesAttributes.java
void buildManipulators() { JButton removeButton = new JButton(I_CLOSE); removeButton.setPressedIcon(I_CLOSE_PRESSED); removeButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));//4,4,4,4)); removeButton.setBorderPainted(false); removeButton.setContentAreaFilled(false); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (JOptionPane.showOptionDialog(null, "Remove the Series " + getSeriesName() + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[] { "Remove", "Cancel" }, null) == 0) // remove getGenerator().removeSeries(getSeriesIndex()); }//from w ww .ja v a 2s .com }); removeButton.setToolTipText("Remove this series"); JButton upButton = new JButton(I_UP); upButton.setPressedIcon(I_UP_PRESSED); upButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));//4,4,4,4)); upButton.setBorderPainted(false); upButton.setContentAreaFilled(false); upButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getGenerator().moveSeries(getSeriesIndex(), true); } }); upButton.setToolTipText("Draw this series higher in the series order"); JButton downButton = new JButton(I_DOWN); downButton.setPressedIcon(I_DOWN_PRESSED); downButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));//4,4,4,4)); downButton.setBorderPainted(false); downButton.setContentAreaFilled(false); downButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getGenerator().moveSeries(getSeriesIndex(), false); } }); downButton.setToolTipText("Draw this series lower in the series order"); manipulators.add(removeButton); manipulators.add(upButton); manipulators.add(downButton); }
From source file:es.emergya.ui.gis.popups.ListaCapas.java
private void addCapa(final GpxLayer layer) { final JPanel capaP = new JPanel(); capaP.setOpaque(false);// w w w. jav a 2s . c om layer.visible = true; mapView.addLayer(layer, false, capasActuales.size()); capasActuales.add(layer); capaP.setLayout(new BoxLayout(capaP, BoxLayout.X_AXIS)); final JCheckBox capa = new JCheckBox(layer.getAssociatedFile().getAbsolutePath()); capa.setSelected(layer.visible); capa.setBackground(Color.WHITE); capa.setToolTipText(i18n.getString("window.gpx.checkbox.show.tooltip")); capa.setActionCommand(layer.name); capa.addActionListener(this); capaP.add(capa); capaP.add(Box.createHorizontalGlue()); JButton eliminar = new JButton(LogicConstants.getIcon("button_delone")); eliminar.setToolTipText(i18n.getString("window.gpx.button.delete.tooltip")); eliminar.setBorderPainted(false); eliminar.setContentAreaFilled(false); capaP.add(eliminar); eliminar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mapView.removeLayer(layer); mapView.repaint(); capasGpx.remove(capaP); capasGpx.updateUI(); capasActuales.remove(layer); } }); capasGpx.add(capaP); capasGpx.updateUI(); }
From source file:cool.pandora.modeller.ui.jpanel.base.BagInfoForm.java
private void createFormFieldsFromMap(final BagTableFormBuilder formBuilder) { int rowCount = 0; final int index = 2; final Set<String> keys = fieldMap.keySet(); for (final BagInfoField field : fieldMap.values()) { formBuilder.row();//w w w . j a v a2 s.c o m rowCount++; final ImageIcon imageIcon = bagView.getPropertyImage("bag.delete.image"); JButton removeButton = new JButton(imageIcon); final Dimension dimension = removeButton.getPreferredSize(); dimension.width = imageIcon.getIconWidth(); removeButton.setMaximumSize(dimension); removeButton.setOpaque(false); removeButton.setBorderPainted(false); removeButton.setContentAreaFilled(false); removeButton.addActionListener(new RemoveFieldHandler()); logger.debug("OrganizationInfoForm add: " + field); if (field.getValue() != null && field.getValue().length() > 60) { field.setComponentType(BagInfoField.TEXTAREA_COMPONENT); } if (field.isRequired()) { removeButton = new JButton(); removeButton.setOpaque(false); removeButton.setBorderPainted(false); removeButton.setContentAreaFilled(false); } switch (field.getComponentType()) { case BagInfoField.TEXTAREA_COMPONENT: final JComponent[] tlist = formBuilder.addTextArea(field.isRequired(), field.getLabel(), removeButton); final JComponent textarea = tlist[index]; textarea.setEnabled(field.isEnabled()); textarea.addFocusListener(this); ((NoTabTextArea) textarea).setText(field.getValue()); textarea.setBorder(new EmptyBorder(1, 1, 1, 1)); ((NoTabTextArea) textarea).setLineWrap(true); if (rowCount == 1) { focusField = textarea; } break; case BagInfoField.TEXTFIELD_COMPONENT: final JComponent[] flist = formBuilder.add(field.isRequired(), field.getLabel(), removeButton); final JComponent comp = flist[index]; comp.setEnabled(field.isEnabled()); comp.addFocusListener(this); ((JTextField) comp).setText(field.getValue()); if (rowCount == 1) { focusField = comp; } break; case BagInfoField.LIST_COMPONENT: final List<String> elements = field.getElements(); final JComponent[] llist = formBuilder.addList(field.isRequired(), field.getLabel(), elements, field.getValue(), removeButton); final JComponent lcomp = llist[index]; lcomp.setEnabled(field.isEnabled()); lcomp.addFocusListener(this); if (field.getValue() != null) { ((JComboBox<?>) lcomp).setSelectedItem(field.getValue().trim()); } if (rowCount == 1) { focusField = lcomp; } break; default: } } if (focusField != null) { focusField.requestFocus(); } }
From source file:com.vgi.mafscaling.LogPlay.java
private JButton addPlayerButton(int column, ImageIcon icon) { JButton button = new JButton(icon); button.putClientProperty("Nimbus.Overrides", zeroInsets); button.setMargin(insets0);//from www.j a va 2s . c o m button.setBorderPainted(false); button.setContentAreaFilled(false); button.addActionListener(this); GridBagConstraints gbc_button = new GridBagConstraints(); gbc_button.insets = insets0; gbc_button.anchor = GridBagConstraints.WEST; gbc_button.gridx = column; gbc_button.gridy = 1; playerPanel.add(button, gbc_button); return button; }
From source file:com.anrisoftware.prefdialog.fields.filechooser.FileChooserField.java
private void setupButton() { JButton button = getOpenFileChooser(); button.setContentAreaFilled(false);// w w w.j a va 2 s.co m button.setBorderPainted(true); button.setMargin(new Insets(0, 4, 0, 4)); }
From source file:src.gui.LifelinePanel.java
public void buildBottonToolBar() { buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(Color.WHITE); //JLabel test = new JLabel("<html><a href=\"http://www.google.com\">delete</a></html>"); JPanel leftpanel = new JPanel(new BorderLayout()); leftpanel.setBackground(Color.WHITE); JButton button = new JButton(editLifeLine); button.setToolTipText("Edit lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false); leftpanel.add(button, BorderLayout.WEST); button.setRolloverEnabled(true);/* ww w . ja va2 s .co m*/ button = new JButton(deleteLifeLine); button.setToolTipText("Delete lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false); leftpanel.add(button, BorderLayout.EAST); button.setRolloverEnabled(true); //JLabel editlabel = new JLabel("<html><b><u>edit</u></b> </html>"); //leftpanel.add(editlabel, BorderLayout.WEST); //JLabel deletelabel = new JLabel("<html><b><u>delete</u></b></html>"); //leftpanel.add(deletelabel, BorderLayout.EAST); buttonPanel.add(leftpanel, BorderLayout.EAST); this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:it.iit.genomics.cru.igb.bundles.mi.business.MIWorker.java
/** * Adds a component to a JTabbedPane with a little close tab" button on the * right side of the tab.// ww w. j a v a 2 s.c o m * * @param tabbedPane * the JTabbedPane * @param c * any JComponent * @param title * the title for the tab */ public static void addClosableTab(final JTabbedPane tabbedPane, final JComponent c, final String title) { // Add the tab to the pane without any label tabbedPane.addTab(null, c); int pos = tabbedPane.indexOfComponent(c); // Create a FlowLayout that will space things 5px apart FlowLayout f = new FlowLayout(FlowLayout.CENTER, 5, 0); // Make a small JPanel with the layout and make it non-opaque JPanel pnlTab = new JPanel(f); pnlTab.setOpaque(false); // Add a JLabel with title and the left-side tab icon JLabel lblTitle = new JLabel(title); // Create a JButton for the close tab button JButton btnClose = new JButton("x"); // btnClose.setOpaque(false); int size = 17; btnClose.setPreferredSize(new Dimension(size, size)); btnClose.setToolTipText("close this tab"); // Make the button looks the same for all Laf's btnClose.setUI(new BasicButtonUI()); // Make it transparent btnClose.setContentAreaFilled(false); // No need to be focusable btnClose.setFocusable(false); btnClose.setBorder(BorderFactory.createEtchedBorder()); btnClose.setBorderPainted(false); // Making nice rollover effect // we use the same listener for all buttons btnClose.setRolloverEnabled(true); // Close the proper tab by clicking the button // Configure icon and rollover icon for button btnClose.setRolloverEnabled(true); // Set border null so the button doesnt make the tab too big btnClose.setBorder(null); // Make sure the button cant get focus, otherwise it looks funny btnClose.setFocusable(false); // Put the panel together pnlTab.add(lblTitle); pnlTab.add(btnClose); // Add a thin border to keep the image below the top edge of the tab // when the tab is selected pnlTab.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); // Now assign the component for the tab tabbedPane.setTabComponentAt(pos, pnlTab); // Add the listener that removes the tab ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (JOptionPane.showConfirmDialog(new JFrame(), "Are you sure you want to remove this tab? All results will be lost!", "Remove tab", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { tabbedPane.remove(c); } } }; btnClose.addActionListener(listener); // Optionally bring the new tab to the front tabbedPane.setSelectedComponent(c); }
From source file:es.emergya.ui.base.plugins.PluggableJTabbedPane.java
private void addFloatingButtons() { JButton salir = new JButton(); salir.addActionListener(new ExitHandler()); Icon icon = LogicConstants.getIcon("header_button_exit"); salir.setIcon(icon);//from w w w .java 2 s . c o m if (icon != null) if (min_height < icon.getIconHeight()) min_height = icon.getIconHeight(); // Aadimos el botn de Salir salir.setBounds(this.getWidth() - icon.getIconWidth() - 2, 2, icon.getIconWidth(), icon.getIconHeight()); salir.setBorderPainted(false); PluggableJTabbedPane.this.salir = salir.getBounds(); // Logo de la empresa JLabel logo = new JLabel(); icon = LogicConstants.getIcon("header_logo_cliente"); if (min_height < icon.getIconHeight()) min_height = icon.getIconHeight(); logo.setIcon(icon); logo.setBounds(salir.getBounds().x - icon.getIconWidth() - 2, 2, icon.getIconWidth(), icon.getIconHeight()); JLabel companyLogo = new JLabel(); icon = LogicConstants.getIcon("header_logo"); if (icon != null) if (min_height < icon.getIconHeight()) min_height = icon.getIconHeight(); companyLogo.setIcon(icon); companyLogo.setBounds(logo.getBounds().x - icon.getIconWidth(), 2, icon.getIconWidth(), icon.getIconHeight()); botones_flotantes = new ArrayList<JComponent>(); addFloatingButton(companyLogo); addFloatingButton(logo); addFloatingButton(salir); repaint(); }