List of usage examples for javax.swing JButton setUI
@BeanProperty(hidden = true, visualUpdate = true, description = "The UI object that implements the LookAndFeel.") public void setUI(ButtonUI ui)
From source file:MyButtonUI.java
public static void main(String argv[]) { JFrame f = new JFrame(); f.setSize(400, 300);//w w w. j a v a2s .co m f.getContentPane().setLayout(new FlowLayout()); JPanel p = new JPanel(); JButton bt1 = new JButton("Click Me"); bt1.setUI(new MyButtonUI()); p.add(bt1); f.getContentPane().add(p); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; f.addWindowListener(wndCloser); f.setVisible(true); }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelActionButton(String text) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_BLUE, UIConstants.INTEL_MEDIUM_DARK_BLUE)); btn.setBackground(UIConstants.INTEL_BLUE); btn.setForeground(UIConstants.INTEL_WHITE); // btn.setFont(UIConstants.H5_FONT); return btn;/*from w w w . jav a 2 s. com*/ }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelActionButton(String text, Icon icon) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_BLUE, UIConstants.INTEL_MEDIUM_DARK_BLUE)); btn.setBackground(UIConstants.INTEL_BLUE); btn.setForeground(UIConstants.INTEL_WHITE); btn.setIcon(icon);//from w ww .j ava2 s.c o m return btn; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelCancelButton(String text) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_BACKGROUND_GRAY, UIConstants.INTEL_LIGHT_GRAY)); btn.setBackground(UIConstants.INTEL_TABLE_BORDER_GRAY); btn.setForeground(UIConstants.INTEL_DARK_GRAY); // btn.setFont(UIConstants.H5_FONT); return btn;//from w w w . j a v a 2 s.c om }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelDeleteButton(String text) { JButton btn = new JButton(text); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_RED, UIConstants.INTEL_MEDIUM_DARK_RED)); btn.setBackground(UIConstants.INTEL_RED); btn.setForeground(UIConstants.INTEL_WHITE); // btn.setFont(UIConstants.H5_FONT); return btn;//from ww w . j a v a2 s.c o m }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelActionButton(AbstractAction action) { JButton btn = new JButton(action); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_BLUE, UIConstants.INTEL_MEDIUM_DARK_BLUE)); btn.setBackground(UIConstants.INTEL_BLUE); btn.setForeground(UIConstants.INTEL_WHITE); return btn;//from w w w . j a v a 2s .com }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelCancelButton(AbstractAction action) { JButton btn = new JButton(action); btn.setUI(new IntelButtonUI(UIConstants.INTEL_BACKGROUND_GRAY, UIConstants.INTEL_LIGHT_GRAY)); btn.setBackground(UIConstants.INTEL_TABLE_BORDER_GRAY); btn.setForeground(UIConstants.INTEL_DARK_GRAY); // btn.setFont(UIConstants.H5_FONT); return btn;/*ww w . j a v a2s . co m*/ }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getIntelDeleteButton(AbstractAction action) { JButton btn = new JButton(action); btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_RED, UIConstants.INTEL_MEDIUM_DARK_RED)); btn.setBackground(UIConstants.INTEL_RED); btn.setForeground(UIConstants.INTEL_WHITE); // btn.setFont(UIConstants.H5_FONT); return btn;/* w ww .j a v a 2 s . c om*/ }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JButton getDebugActionButton(String text) { JButton btn = new JButton(text) { private static final long serialVersionUID = 9164124909538571267L; @Override/* ww w .ja v a 2s . c o m*/ public String toString() { return new String(getClass().getName() + "@" + hashCode()); } }; btn.setUI(new IntelButtonUI(UIConstants.INTEL_MEDIUM_BLUE, UIConstants.INTEL_MEDIUM_DARK_BLUE)); btn.setBackground(UIConstants.INTEL_BLUE); btn.setForeground(UIConstants.INTEL_WHITE); return btn; }
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./*from w w w . j av a 2 s . com*/ * * @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); }