javax.swing.JDialog.setJMenuBar()方法的使用及代码示例

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

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

JDialog.setJMenuBar介绍

暂无

代码示例

代码示例来源:origin: freeplane/freeplane

@Override
protected void setFreeplaneMenuBar(final FreeplaneMenuBar menuBar) {
  dialog.setJMenuBar(menuBar);
}

代码示例来源:origin: stackoverflow.com

import java.awt.Color;
import javax.swing.*;
import javax.swing.border.*;

public class CustomPopupMenuBorder
{
  public static void main(String[] args)
  {
    UIManager.put("PopupMenu.border", BorderFactory.createLineBorder(Color.black, 1));      
    JDialog myJDialog = new JDialog();
    myJDialog.setSize(450,300);
    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("It's a me");
    JMenuItem item = new JMenuItem("JMenuItem 1");
    JMenuItem item2 = new JMenuItem("JMenuItem 2");
    menu.add(item);
    JSeparator sep = new JSeparator();    
    menu.add(sep);
    menu.add(item2);
    bar.add(menu);
    myJDialog.setJMenuBar(bar);
    myJDialog.setVisible(true);
  }
}

代码示例来源:origin: zolyfarkas/spf4j

private void fromTextMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fromTextMenuItemActionPerformed
 final JDialog frame = new JDialog(this, "Enter json stack samples", true);
 frame.setName("fromTextDialog");
 frame.setJMenuBar(createContextMenuBar());
 TextEntryPanel panel = new TextEntryPanel((samples) -> {
   JInternalFrame f = new StackDumpJInternalFrame(samples, "text entry", true);
   frame.setVisible(false);
   f.setVisible(true);
   desktopPane.add(f, javax.swing.JLayeredPane.DEFAULT_LAYER);
 }, (ex) -> {
  JOptionPane.showMessageDialog(frame, "Invalid input " + ex);
  frame.setVisible(false);
  frame.dispose();
 });
 frame.getContentPane().add(panel);
 frame.pack();
 frame.setVisible(true);
}//GEN-LAST:event_fromTextMenuItemActionPerformed

代码示例来源:origin: org.xworker/xworker_core

public static void createJMenuBar(ActionContext actionContext){
  JDialog parent = (JDialog) actionContext.get("JDialog");
  
  Thing thing = World.getInstance().getThing("xworker.javax.swing.JMenuBar");
  JMenuBar item = (JMenuBar) thing.doAction("create", actionContext);
  if(item != null){
    parent.setJMenuBar(item);
  }
}

代码示例来源:origin: senbox-org/snap-desktop

public BatchGraphDialog(final AppContext theAppContext, final String title, final String helpID,
            final boolean closeOnDone) {
  super(theAppContext.getApplicationWindow(), title, ID_YES | ID_APPLY_CLOSE_HELP, helpID);
  this.appContext = theAppContext;
  this.baseTitle = title;
  this.closeOnDone = closeOnDone;
  openProcessedProducts = true;
  setContent(createUI());
  if (getJDialog().getJMenuBar() == null) {
    final GraphsMenu operatorMenu = new GraphsMenu(getJDialog(), this);
    getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
  }
  super.getJDialog().setMinimumSize(new Dimension(400, 300));
}

代码示例来源:origin: bcdev/beam

public CollocationDialog(AppContext appContext) {
  super(appContext, "Collocation", ID_APPLY_CLOSE, HELP_ID);
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(CollocateOp.Spi.class.getName());
  parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor());
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         HELP_ID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
  form = new CollocationForm(parameterSupport.getPropertySet(), getTargetProductSelector(), appContext);
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public int show() {
  ioParametersPanel.initSourceProductSelectors();
  if (form == null) {
    initForm();
    if (getJDialog().getJMenuBar() == null) {
      final OperatorMenu operatorMenu = createDefaultMenuBar();
      getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
    }
  }
  setContent(form);
  return super.show();
}

代码示例来源:origin: bcdev/beam

@Override
public int show() {
  ioParametersPanel.initSourceProductSelectors();
  if (form == null) {
    initForm();
    if (getJDialog().getJMenuBar() == null) {
      final OperatorMenu operatorMenu = createDefaultMenuBar();
      getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
    }
  }
  setContent(form);
  return super.show();
}

代码示例来源:origin: senbox-org/snap-desktop

public CollocationDialog(AppContext appContext) {
  super(appContext, "Collocation", ID_APPLY_CLOSE, HELP_ID);
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(CollocateOp.Spi.class.getName());
  parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor());
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         HELP_ID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
  form = new CollocationForm(parameterSupport.getPropertySet(), getTargetProductSelector(), appContext);
}

代码示例来源:origin: senbox-org/s2tbx

@Override
public int show() {
  this.ioParametersPanel.initSourceProductSelectors();
  if (this.form == null) {
    initForm();
    if (getJDialog().getJMenuBar() == null) {
      OperatorMenu operatorMenu = createDefaultMenuBar();
      getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
    }
  }
  setContent(this.form);
  return super.show();
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public int show() {
  if (form == null) {
    initForm();
    if (getJDialog().getJMenuBar() == null) {
      final OperatorMenu operatorMenu = createDefaultMenuBar();
      getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
    }
  }
  ioParametersPanel.initSourceProductSelectors();
  setContent(form);
  return super.show();
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public int show() {
  ioParametersPanel.initSourceProductSelectors();
  if (form == null) {
    initForm();
    if (getJDialog().getJMenuBar() == null) {
      final OperatorMenu operatorMenu = createDefaultMenuBar();
      getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
    }
  }
  setContent(form);
  return super.show();
}

代码示例来源:origin: bcdev/beam

public SimpleExampleDialog(String alias, AppContext appContext, String title, String helpId) {
  super(appContext, title, helpId);
  this.alias = alias;
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(alias);
  parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor());
  form = new SimpleForm(appContext, operatorSpi, parameterSupport.getPropertySet(),
             getTargetProductSelector());
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         helpId);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

代码示例来源:origin: senbox-org/snap-desktop

ReprojectionDialog(boolean orthorectify, final String title, final String helpID, AppContext appContext) {
  super(appContext, title, ID_APPLY_CLOSE, helpID);
  form = new ReprojectionForm(getTargetProductSelector(), orthorectify, appContext);
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(OPERATOR_NAME);
  ParameterUpdater parameterUpdater = new ReprojectionParameterUpdater();
  OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
                                       null,
                                       null,
                                       parameterUpdater);
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         helpID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

代码示例来源:origin: bcdev/beam

ReprojectionDialog(boolean orthorectify, final String title, final String helpID, AppContext appContext) {
  super(appContext, title, ID_APPLY_CLOSE, helpID);
  form = new ReprojectionForm(getTargetProductSelector(), orthorectify, appContext);
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(OPERATOR_NAME);
  ParameterUpdater parameterUpdater = new ReprojectionParameterUpdater();
  OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
                                       null,
                                       null,
                                       parameterUpdater);
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         helpID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

代码示例来源:origin: bcdev/beam

RadiometryDialog(String alias, AppContext appContext, String title, String helpId) {
  super(appContext, title, ID_APPLY_CLOSE, helpId,
     TargetProductSelectorModel.createEnvisatTargetProductSelectorModel());
  this.alias = alias;
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(alias);
  parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor());
  form = new RadiometryForm(appContext, operatorSpi, parameterSupport.getPropertySet(),
               getTargetProductSelector());
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         helpId);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

代码示例来源:origin: senbox-org/snap-desktop

MosaicDialog(final String title, final String helpID, AppContext appContext) {
  super(appContext, title, ID_APPLY_CLOSE, helpID);
  final TargetProductSelector selector = getTargetProductSelector();
  selector.getModel().setSaveToFileSelected(true);
  selector.getModel().setProductName("mosaic");
  selector.getSaveToFileCheckBox().setEnabled(false);
  form = new MosaicForm(selector, appContext);
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi("Mosaic");
  MosaicFormModel formModel = form.getFormModel();
  OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
                                       formModel.getPropertySet(),
                                       formModel.getParameterMap(),
                                       null);
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         helpID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

代码示例来源:origin: bcdev/beam

MosaicDialog(final String title, final String helpID, AppContext appContext) {
  super(appContext, title, ID_APPLY_CLOSE, helpID);
  final TargetProductSelector selector = getTargetProductSelector();
  selector.getModel().setSaveToFileSelected(true);
  selector.getModel().setProductName("mosaic");
  selector.getSaveToFileCheckBox().setEnabled(false);
  form = new MosaicForm(selector, appContext);
  final OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi("Mosaic");
  MosaicFormModel formModel = form.getFormModel();
  OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
                                       formModel.getPropertySet(),
                                       formModel.getParameterMap(),
                                       null);
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         helpID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

代码示例来源:origin: bcdev/beam

protected BinningDialog(AppContext appContext, String title, String helpID) {
  super(appContext, title, ID_APPLY_CLOSE_HELP, helpID, new TargetProductSelectorModel(), true);
  formModel = new BinningFormModel();
  form = new BinningForm(appContext, formModel, getTargetProductSelector());
  OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(OPERATOR_NAME);
  ParameterUpdater parameterUpdater = new BinningParameterUpdater();
  OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
                                       formModel.getPropertySet(),
                                       formModel.getParameterMap(),
                                       parameterUpdater);
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
                         operatorSpi.getOperatorDescriptor(),
                         parameterSupport,
                         appContext,
                         helpID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

代码示例来源:origin: senbox-org/snap-desktop

protected BinningDialog(AppContext appContext, String title, String helpID) {
  super(appContext, title, ID_APPLY_CLOSE_HELP, helpID, new TargetProductSelectorModel(), true);
  formModel = new BinningFormModel();
  form = new BinningForm(appContext, formModel, getTargetProductSelector());
  OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(OPERATOR_NAME);
  ParameterUpdater parameterUpdater = new BinningParameterUpdater();
  OperatorParameterSupport parameterSupport = new OperatorParameterSupport(operatorSpi.getOperatorDescriptor(),
      formModel.getPropertySet(),
      formModel.getParameterMap(),
      parameterUpdater);
  OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
      operatorSpi.getOperatorDescriptor(),
      parameterSupport,
      appContext,
      helpID);
  getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}

相关文章

JDialog类方法