List of usage examples for javax.swing JButton setRequestFocusEnabled
public void setRequestFocusEnabled(boolean requestFocusEnabled)
JComponent
should get focus. From source file:TopLevelTransferHandlerDemo.java
private JToolBar createDummyToolBar() { JToolBar tb = new JToolBar(); JButton b; b = new JButton("New"); b.setRequestFocusEnabled(false); tb.add(b);// w w w . ja v a 2 s . c o m b = new JButton("Open"); b.setRequestFocusEnabled(false); tb.add(b); b = new JButton("Save"); b.setRequestFocusEnabled(false); tb.add(b); b = new JButton("Print"); b.setRequestFocusEnabled(false); tb.add(b); b = new JButton("Preview"); b.setRequestFocusEnabled(false); tb.add(b); tb.setFloatable(false); return tb; }
From source file:phex.gui.dialogs.UpdateNotificationDialog.java
private void prepareComponent() { CloseEventHandler closeEventHandler = new CloseEventHandler(); addWindowListener(closeEventHandler); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); JPanel contentPanel = new JPanel(); //JPanel contentPanel = new FormDebugPanel(); contentPane.add(contentPanel, BorderLayout.CENTER); CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("2dlu, fill:d:grow, 2dlu", // columns "p, p, 16dlu, fill:p:grow, 16dlu," + // rows "p, 2dlu, p 4dlu"); //btn rows PanelBuilder contentPB = new PanelBuilder(layout, contentPanel); int columnCount = layout.getColumnCount(); int rowCount = layout.getRowCount(); DialogBanner banner = new DialogBanner(Localizer.getString("UpdateNotification_BannerHeader"), Localizer.getString("UpdateNotification_BannerSubHeader")); contentPB.add(banner, cc.xywh(1, 1, columnCount, 1)); contentPB.add(new JSeparator(), cc.xywh(1, 2, columnCount, 1)); JPanel notifyPanel = buildNotificationPanel(); contentPB.add(notifyPanel, cc.xy(2, 4, "center, center")); contentPB.add(new JSeparator(), cc.xywh(1, rowCount - 3, columnCount, 1)); JButton closeBtn = new JButton(Localizer.getString("Close")); closeBtn.addActionListener(closeEventHandler); JButton downloadBtn = new JButton(Localizer.getString("Download")); downloadBtn.setDefaultCapable(true); downloadBtn.setRequestFocusEnabled(true); downloadBtn.addActionListener(new DownloadBtnListener()); JPanel btnPanel = ButtonBarFactory.buildOKCancelBar(downloadBtn, closeBtn); contentPB.add(btnPanel, cc.xywh(2, rowCount - 1, columnCount - 2, 1)); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); getRootPane().setDefaultButton(downloadBtn); pack();/*from w w w.ja v a2s.com*/ setLocationRelativeTo(getParent()); }
From source file:uk.chromis.pos.forms.JRootApp.java
private void listPeople() { try {//from ww w .j a v a 2 s . c om jScrollPane1.getViewport().setView(null); JFlowPanel jPeople = new JFlowPanel(); jPeople.applyComponentOrientation(getComponentOrientation()); java.util.List people = m_dlSystem.listPeopleVisible(); for (int i = 0; i < people.size(); i++) { AppUser user = (AppUser) people.get(i); JButton btn = new JButton(new AppUserAction(user)); btn.applyComponentOrientation(getComponentOrientation()); btn.setFocusPainted(false); btn.setFocusable(false); btn.setRequestFocusEnabled(false); btn.setMaximumSize(new Dimension(130, 60)); btn.setPreferredSize(new Dimension(130, 60)); btn.setMinimumSize(new Dimension(130, 60)); btn.setHorizontalAlignment(SwingConstants.CENTER); btn.setHorizontalTextPosition(AbstractButton.CENTER); btn.setVerticalTextPosition(AbstractButton.BOTTOM); jPeople.add(btn); } jScrollPane1.getViewport().setView(jPeople); } catch (BasicException ee) { } }