private void setup() { setLayout(new BorderLayout()); JPanel bot = new JPanel(); add(jt.getTableHeader(), BorderLayout.NORTH); bot.setLayout(new BorderLayout()); bot.add(del, BorderLayout.EAST); add(bot, BorderLayout.SOUTH); JScrollPane jsp = new JScrollPane(jt); jsp.setPreferredSize(new Dimension(500, 250)); add(jsp, BorderLayout.CENTER); del.addActionListener(new DListener()); JRootPane rootPane = SwingUtilities.getRootPane(del); rootPane.setDefaultButton(del); setVisible(true); }
private void initComponents() { jcb_subtype.setSelectedItem(DEFAULT_SUBTYPE); jcb_mode.setSelectedItem(DEFAULT_MODE); this.getRootPane().setDefaultButton(jb_ok); jb_ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onOk(); } }); jb_cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { onCancel(); } }); }
contentPane.add(filenameLabel); contentPane.add(filename); JButton okButton = new JButton("Save"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { setVisible(false); contentPane.add(okButton); getRootPane().setDefaultButton(okButton);
private void constructUI() { JPanel c = (JPanel) getContentPane(); c.setLayout(new BorderLayout(3, 3)); c.add(topLabel, BorderLayout.NORTH); c.add(inputField, BorderLayout.WEST); c.add(convertButton, BorderLayout.CENTER); convertButton.setToolTipText(helpText); convertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { convert(); } }); c.add(helpButton, BorderLayout.EAST); helpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(helpButton, helpText, "Epoch Help", JOptionPane.INFORMATION_MESSAGE); } }); inputField.requestFocus(); getRootPane().setDefaultButton(convertButton); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); pack(); centerOnScreen(); setVisible(true); }
findButton = new JButton("Find"); findButton.addActionListener(new FindButton()); classname = new JCheckBox("Classnames"); this.getRootPane().setDefaultButton(findButton);
add(new JScrollPane(table)); JPanel key=new JPanel(new FlowLayout(FlowLayout.LEFT)); key.add(new JLabel("Key ")); key.add(key_field); add(key); JPanel value=new JPanel(new FlowLayout(FlowLayout.LEFT)); value.add(new JLabel("Value")); value.add(value_field); add(value); JPanel repl_count=new JPanel(new FlowLayout(FlowLayout.LEFT)); repl_count.add(new JLabel("Replication count")); repl_count.add(repl_count_field); frame.getRootPane().setDefaultButton(put_button); frame.setVisible(true); setTitle("ReplCacheDemo");
private final JTextField tf = new JTextField(25); private final JTextArea ta = new JTextArea(15, 25); private final JButton send = new JButton("Send"); private volatile PrintWriter out; private Scanner in; f.setTitle("Echo " + kind); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getRootPane().setDefaultButton(send); f.add(tf, BorderLayout.NORTH); f.add(new JScrollPane(ta), BorderLayout.CENTER); f.add(send, BorderLayout.SOUTH); f.setLocation(kind.offset, 300); f.pack();
public int show(JFrame frame) { dialog = new JDialog(frame, "Save Changes", true); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(this, BorderLayout.CENTER); dialog.setResizable(false); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.getRootPane().setDefaultButton(saveButton); dialog.setVisible(true); dialog.dispose(); return selectedValue; }
public StreamGenerator() { //Create and set up the window. generatorFrame = new JFrame("Stream Generator"); generatorFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); generatorFrame.setSize(new Dimension(120, 40)); //Create and set up the panel. generatorPanel = new JPanel(new GridLayout(4, 4)); //Add the widgets. addWidgets(); //Set the default button. generatorFrame.getRootPane().setDefaultButton(generateButton); //Add the panel to the window. generatorFrame.getContentPane().add(generatorPanel, BorderLayout.CENTER); //Display the window. generatorFrame.pack(); generatorFrame.setVisible(true); }
public MTConfigDialog(Window parent, String title) { panel = new MTConfigPanel(); dialog = new JDialog(parent); dialog.setTitle(title); dialog.setModal(true); StaticUIUtils.setWindowIcon(dialog); dialog.getContentPane().add(panel); panel.cancelButton.addActionListener(e -> dialog.dispose()); panel.okButton.addActionListener(e -> { onConfirm(); dialog.dispose(); }); StaticUIUtils.setEscapeClosable(dialog); dialog.getRootPane().setDefaultButton(panel.okButton); }
public ExternalExtensionsDialog (List<Dependency> mainDependencies) { this.mainDependencies = mainDependencies; contentPane = new JPanel(new GridBagLayout()); setContentPane(contentPane); setModal(true); getRootPane().setDefaultButton(buttonOK); uiLayout(); uiStyle(); buttonOK.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e) { onOK(); } }); buttonCancel.addActionListener(new ActionListener() { @Override public void actionPerformed (ActionEvent e) { onCancel(); } }); setTitle("Third party external extensions"); setSize(600, 300); setLocationRelativeTo(null); }
private void setup() { setLayout(new BorderLayout()); JPanel panel = new JPanel(); add(jl, BorderLayout.SOUTH); add(panel, BorderLayout.CENTER); panel.setLayout(new GridLayout(6, 2)); panel.add(new JLabel("Name")); panel.add(jtFields[0]); panel.add(new JLabel("Contact Number")); panel.add(jtFields[1]); panel.add(new JLabel("Address")); panel.add(processButton); clearButton.addActionListener(e -> { for (JTextArea i : jtAreas) { i.setText(""); processButton.addActionListener(e -> { Order order = new Order(jtFields[0].getText(), jtFields[1].getText(), jtAreas[0].getText(), jtFields[2].getText(), jtAreas[1].getText()); rootPane.setDefaultButton(processButton); setVisible(true);
this.tableView.setModelAndUpdateColumns(this.modelList); tableViewPanel.add(ToolbarDecorator.createDecorator(this.tableView) .disableAddAction() .disableDownAction() this.generateButton.addActionListener(e -> update()); }); this.closeButton.addActionListener(e -> { setEnabled(false); dispose(); }); this.buttonCopy.addActionListener(e -> { if(StringUtils.isBlank(textAreaOutput.getText())) { return; this.getRootPane().setDefaultButton(buttonInsert); this.buttonInsert.addActionListener(e -> {
private void init() { Color c = getSelectedColor(); if(c == null) chooser = new JColorChooser(); else chooser = new JColorChooser(c); getContentPane().add(BorderLayout.CENTER, chooser); Box buttons = new Box(BoxLayout.X_AXIS); buttons.add(Box.createGlue()); ok = new JButton(jEdit.getProperty("common.ok")); ok.addActionListener(this); buttons.add(ok); buttons.add(Box.createHorizontalStrut(6)); getRootPane().setDefaultButton(ok); cancel = new JButton(jEdit.getProperty("common.cancel")); cancel.addActionListener(this); buttons.add(cancel); buttons.add(Box.createGlue()); getContentPane().add(BorderLayout.SOUTH, buttons); pack(); setLocationRelativeTo(getParent()); } //}}} } //}}}
wrap = new JCheckBox("Wrap"); findButton = new JButton("Find"); findButton.addActionListener(new FindButton()); this.getRootPane().setDefaultButton(findButton);
public ErrorDialog(String errorInfo) { setContentPane(contentPane); setTitle("Error Info"); getRootPane().setDefaultButton(okButton); this.setAlwaysOnTop(true); editTP.setText(errorInfo); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); editTP.setCaretPosition(0); } }
private JButton b = new JButton(exit); this.add(b); f.getRootPane().setDefaultButton(b); this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Q, 0), EXIT); this.getActionMap().put(EXIT, exit); f.setResizable(false); f.setUndecorated(true); f.add(this); f.pack(); dev.setFullScreenWindow(f);
public JDialog createDialog(Component owner, String title) { JDialog dialog = new JDialog(JOptionPane.getFrameForComponent(owner), title); dialog.getContentPane().add(this, BorderLayout.CENTER); dialog.pack(); dialog.getRootPane().setDefaultButton(okButton); return dialog; }
public SettingsDialog (final SetupCheckBox gwtCheckBox) { contentPane = new JPanel(new GridBagLayout()); setContentPane(contentPane); setModal(true); getRootPane().setDefaultButton(buttonOK);
@NotNull protected JPanel initButtonsPanel() { progressPane = new ProgressPanel(mainWindow, false); JButton cancelButton = new JButton(NLS.str("search_dialog.cancel")); cancelButton.addActionListener(event -> dispose()); JButton openBtn = new JButton(NLS.str("search_dialog.open")); openBtn.addActionListener(event -> openSelectedItem()); getRootPane().setDefaultButton(openBtn); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10)); buttonPane.add(progressPane); buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(openBtn); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); buttonPane.add(cancelButton); return buttonPane; }