mainPanel.getRootPane().setDefaultButton(ok); SwingUtilities.invokeLater(new Runnable() {
@Override public void actionPerformed(ActionEvent actionEvent) { try { importFromClipboard(); } catch (Exception e) { LOGGER.error("Can't import column layout from clipboard", e); showMessageDialog(columnLayoutsPanel.getRootPane(), "Can't import column layout from clipboard: " + e.getMessage(), "Paste error", ERROR_MESSAGE); } } }
public void actionPerformed(ActionEvent evt) { commitChanges = true; final JDialog dialog = (JDialog) mainPanel.getRootPane().getParent(); dialog.dispose(); } });
public void actionPerformed(ActionEvent evt) { final JDialog dialog = (JDialog) mainPanel.getRootPane().getParent(); dialog.dispose(); } });
@Override public void ancestorAdded(AncestorEvent event) { JRootPane pane = watchPanel.getRootPane(); if (pane != null) { watchPanel.setVisible(UIUtil.isDialogRootPane(pane)); } }
@Override public void actionPerformed(ActionEvent actionEvent) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Select file"); if (chooser.showSaveDialog(panel.getRootPane()) == JFileChooser.APPROVE_OPTION) { final File selectedFile = chooser.getSelectedFile(); try { exportToFile(selectedFile, columnLayoutListModel.getList()); } catch (Exception e) { LOGGER.error("Can't export column layouts to file " + selectedFile, e); showMessageDialog(columnLayoutsPanel.getRootPane(), "Can't export column layout to file: " + e.getMessage(), "Export error", ERROR_MESSAGE); } } } }
public void removeComponentWithErrors(JComponent component) { if (componentsWithErrors.remove(component)) { panel.getRootPane().getGlassPane().repaint(); } }
@Override public void run(JPanel panel) { feedback.run(panel); final JButton b = panel.getRootPane().getDefaultButton(); if (null == b) return; b.setEnabled(false); final Timer t = new Timer(SuspensionPenalty.MIN_KEY_RETRY_DELAY, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b.setEnabled(true); } }); t.setRepeats(false); t.start(); } }
public void addComponentWithErrors(JComponent component) { if (componentsWithErrors.add(component)) { panel.getRootPane().getGlassPane().repaint(); } }
@Override public void run(JPanel panel) { feedback.run(panel); final JButton b = panel.getRootPane().getDefaultButton(); if (null == b) return; b.setEnabled(false); final Timer t = new Timer(MIN_KEY_RETRY_DELAY, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b.setEnabled(true); } }); t.setRepeats(false); t.start(); } }
@Override public void run(JPanel panel) { final JButton b = panel.getRootPane().getDefaultButton(); super.run(panel); if (null == b) return; b.setEnabled(false); final Timer t = new Timer(duration, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { b.setEnabled(true); } }); t.setRepeats(false); t.start(); } }
@Override public void actionPerformed(ActionEvent actionEvent) { try { List<ColumnLayout> list = new ArrayList<>(); final Object[] selectedValues = LogTableFormatConfigView.this.columnLayoutsList.getSelectedValues(); if (selectedValues.length == 0) { list.addAll(columnLayoutListModel.getList()); } else { for (Object selectedValue : selectedValues) { list.add((ColumnLayout) selectedValue); } } exportToClipBoard(list); } catch (ConfigurationException e) { LOGGER.error("Can't export column layouts. ", e); showMessageDialog(columnLayoutsPanel.getRootPane(), "Can't export column layout to clipboard: " + e.getMessage(), "Export error", ERROR_MESSAGE); } } }
private void importColumnLayouts(List<ColumnLayout> columnLayouts) { if (columnLayouts.isEmpty()) { showMessageDialog(panel.getRootPane(), "No column layout in clipboard have been found"); return; } JPanel messagePanel = new JPanel(new BorderLayout()); final MutableListModel<ColumnLayout> listModel = new MutableListModel<>(); columnLayouts.forEach(listModel::add); final JList jList = new JList(listModel); jList.setCellRenderer(new ColumnLayoutRenderer()); jList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); if (listModel.getSize() > 0) { jList.getSelectionModel().setSelectionInterval(0, listModel.getSize() - 1); } messagePanel.add(new JScrollPane(jList)); final int resp = showConfirmDialog(LogTableFormatConfigView.this.panel.getRootPane(), messagePanel, "Select column layouts to import", OK_CANCEL_OPTION); if (resp == CANCEL_OPTION) { return; } final int[] selectedIndices = jList.getSelectedIndices(); for (int selectedIndex : selectedIndices) { final ColumnLayout elementAt = listModel.getElementAt(selectedIndex); columnLayoutListModel.add(elementAt); } }
private void importFromClipboard() throws IOException, UnsupportedFlavorException, ConfigurationException { XMLConfiguration xmlConfiguration; try { String data = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); StringReader stringReader = new StringReader(data); xmlConfiguration = new XMLConfiguration(); xmlConfiguration.load(stringReader); final List<ColumnLayout> columnLayouts = loadColumnLayouts(xmlConfiguration); importColumnLayouts(columnLayouts); otrosApplication.getStatusObserver().updateStatus("Column layouts have been imported"); } catch (Exception e) { LOGGER.error("Can't import table layout from clipboard", e); showMessageDialog(panel.getRootPane(), "Can't import from clipboard"); } }
@Override public void actionPerformed(ActionEvent actionEvent) { final LogParsableListener logParsableListener = new LogParsableListener(otrosApplication.getAllPluginables().getLogImportersContainer()); final JOtrosVfsBrowserDialog dialog = getjOtrosVfsBrowserDialog(otrosApplication,logParsableListener); dialog.setMultiSelectionEnabled(false); dialog.setSelectionMode(SelectionMode.FILES_ONLY); final JOtrosVfsBrowserDialog.ReturnValue returnValue = dialog.showOpenDialog(panel.getRootPane(), "Select file with column layout to import"); if (returnValue == JOtrosVfsBrowserDialog.ReturnValue.Approve) { final FileObject selectedFile = dialog.getSelectedFile(); try { importFromFile(selectedFile); Utils.closeQuietly(dialog.getSelectedFile()); } catch (ConfigurationException e) { LOGGER.error("Can't import column layout from file", e); showMessageDialog(columnLayoutsPanel.getRootPane(), "Can't import column layout from clipboard: " + e.getMessage(), "Import error", ERROR_MESSAGE); } catch (IOException e) { LOGGER.error("Can't import column layout from file", e); showMessageDialog(columnLayoutsPanel.getRootPane(), "Can't import column layout from clipboard: " + e.getMessage(), "Import error", ERROR_MESSAGE); } } } }
close.addActionListener(actionHandler); buttons.add(close); content.getRootPane().setDefaultButton(close);
public ReferenceDataItem showDialog(JPanel parent) { addDialogButtons(); Dialog parentDialog = (Dialog)parent.getRootPane().getParent(); dialog = new JDialog( parentDialog, BundleHolder.bundle.getMessage("newReferenceDataItemPanelTitle", referenceData.getDisplayName()), // NOI18N true); dialog.setContentPane(this); dialog.pack(); dialog.setLocationRelativeTo(dialog); nameTextField.requestFocusInWindow(); dialog.show(); dialog.dispose(); dialog = null; okButton = cancelButton = null; return newItem; }
new String[]{domainDisplayName}); this.dialog = new JDialog((Dialog) parent.getRootPane().getParent(), dialogTitle, true); this.valueCheckBox.getModel().setSelected(true); this.valueTextField.setEnabled(false);
visualTipGlassPane.getRootPane().repaint();
/** * Installs the menu bar */ protected void installMenuBar() { ActionContextPathList menuBarContext = new DefaultActionContextPathList( this.menuBarContextMap); JMenuBar jmenuBar = getWindowDescriptor().getActionFactory() .createMenuBar(menuBarContext); this.windowPanel.getRootPane().setJMenuBar(jmenuBar); }