javax.swing.JPanel.getRootPane()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(221)

本文整理了Java中javax.swing.JPanel.getRootPane()方法的一些代码示例,展示了JPanel.getRootPane()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.getRootPane()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:getRootPane

JPanel.getRootPane介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

mainPanel.getRootPane().setDefaultButton(ok);
SwingUtilities.invokeLater(new Runnable() {

代码示例来源:origin: otros-systems/otroslogviewer

@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);
  }
 }
}

代码示例来源:origin: org.cytoscape/vizmap-gui-impl

public void actionPerformed(ActionEvent evt) {
    commitChanges = true;
    final JDialog dialog = (JDialog) mainPanel.getRootPane().getParent();
    dialog.dispose();
  }
});

代码示例来源:origin: org.cytoscape/vizmap-gui-impl

public void actionPerformed(ActionEvent evt) {
    final JDialog dialog = (JDialog) mainPanel.getRootPane().getParent();
    dialog.dispose();
  }
});

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

@Override
public void ancestorAdded(AncestorEvent event) {
 JRootPane pane = watchPanel.getRootPane();
 if (pane != null) {
  watchPanel.setVisible(UIUtil.isDialogRootPane(pane));
 }
}

代码示例来源:origin: otros-systems/otroslogviewer

@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);
   }
  }
 }
}

代码示例来源:origin: SonarSource/sonarlint-intellij

public void removeComponentWithErrors(JComponent component) {
 if (componentsWithErrors.remove(component)) {
  panel.getRootPane().getGlassPane().repaint();
 }
}

代码示例来源:origin: net.java.truecommons/truecommons-key-swing

@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();
  }
}

代码示例来源:origin: SonarSource/sonarlint-intellij

public void addComponentWithErrors(JComponent component) {
 if (componentsWithErrors.add(component)) {
  panel.getRootPane().getGlassPane().repaint();
 }
}

代码示例来源:origin: net.java.truevfs/truevfs-key-swing

@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();
  }
}

代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip

@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();
  }
}

代码示例来源:origin: otros-systems/otroslogviewer

@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);
  }
 }
}

代码示例来源:origin: otros-systems/otroslogviewer

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);
 }
}

代码示例来源:origin: otros-systems/otroslogviewer

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");
 }
}

代码示例来源:origin: otros-systems/otroslogviewer

@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);
   }
  }
 }
}

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

close.addActionListener(actionHandler);
buttons.add(close);
content.getRootPane().setDefaultButton(close);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors

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;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors

new String[]{domainDisplayName});
this.dialog =
    new JDialog((Dialog) parent.getRootPane().getParent(), dialogTitle, true);
this.valueCheckBox.getModel().setSelected(true);
this.valueTextField.setEnabled(false);

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

visualTipGlassPane.getRootPane().repaint();

代码示例来源:origin: net.sf.doolin/doolin-gui

/**
 * Installs the menu bar
 */
protected void installMenuBar() {
  ActionContextPathList menuBarContext = new DefaultActionContextPathList(
      this.menuBarContextMap);
  JMenuBar jmenuBar = getWindowDescriptor().getActionFactory()
      .createMenuBar(menuBarContext);
  this.windowPanel.getRootPane().setJMenuBar(jmenuBar);
}

相关文章

JPanel类方法