javax.swing.JDialog#setContentPane ( )源码实例Demo

下面列出了javax.swing.JDialog#setContentPane ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: WebBeansActionHelper.java
static void showInjectablesDialog( MetadataModel<WebBeansModel> metamodel,
        WebBeansModel model, Object[] subject, 
        InjectablesModel uiModel , String name , 
        org.netbeans.modules.web.beans.api.model.Result result ) 
{
    subject[2] = InspectActionId.INJECTABLES_CONTEXT;
    StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(
            InjectablesModel.class, WAIT_NODE));           // NOI18N
    JDialog dialog = ResizablePopup.getDialog();
    String title = NbBundle.getMessage(WebBeansActionHelper.class,
            "TITLE_Injectables" , name );//NOI18N
    dialog.setTitle( title );
    dialog.setContentPane( new BindingsPanel(subject, metamodel, model,
            uiModel, result ));
    dialog.setVisible( true );
}
 
源代码2 项目: netbeans   文件: WebBeansActionHelper.java
static void showObserversDialog( List<ExecutableElement> methods , 
        MetadataModel<WebBeansModel> metaModel , WebBeansModel model,
        Object[] subject, ObserversModel uiModel ,
        String name ) 
{
    subject[2] = InspectActionId.OBSERVERS_CONTEXT;
    StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(
            InjectablesModel.class, WAIT_NODE));
    JDialog dialog = ResizablePopup.getDialog();
    String title = NbBundle.getMessage(WebBeansActionHelper.class,
            "TITLE_Observers" , name );//NOI18N
    dialog.setTitle( title );
    dialog.setContentPane( new ObserversPanel(subject, metaModel, 
            model ,uiModel ));
    dialog.setVisible( true );
    
}
 
源代码3 项目: nextreports-designer   文件: DownloadBulkWizard.java
public DownloadBulkWizard(String entityType, String destinationPath) {
	String message = I18NSupport.getString("download");
	dialog = new JDialog(Globals.getMainFrame(), message, true);

	PublishLoginWizardPanel loginPanel = new PublishLoginWizardPanel(null) {			
		public WizardPanel getNextPanel() {
			return new DownloadListWizardPanel();
		}			
	};
	
	Wizard wizard = new Wizard(loginPanel);
	wizard.getContext().setAttribute(PublishWizard.MAIN_FRAME, dialog);
	wizard.getContext().setAttribute(DESTINATION, destinationPath);
	wizard.getContext().setAttribute(WizardConstants.ENTITY, entityType);
	wizard.addWizardListener(this);
	
	dialog.setContentPane(wizard);
	dialog.setSize(400, 340);
	dialog.setLocationRelativeTo(null);
	dialog.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			super.windowClosing(e);
		}
	});
	dialog.setVisible(true);
}
 
源代码4 项目: jmg   文件: LoadingWindow.java
public static void showLoadingWindow()
{
	try {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	} catch (Exception e) {
	} 
	JOptionPane pane = new JOptionPane("Загрузка. Пожалуйста, подождите...", JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}, null);
	
	LOADING_PANE = new JDialog();
	LOADING_PANE.setModal(false);

	LOADING_PANE.setContentPane(pane);

	LOADING_PANE.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

	LOADING_PANE.setLocation(100, 200);
	LOADING_PANE.pack();
	LOADING_PANE.setVisible(true);
}
 
源代码5 项目: jplag   文件: ATUJPLAG.java
private void showStartDialog() {
	dialog = new JDialog();

	JPanel panel = new JPanel();
	panel.setPreferredSize(new Dimension(300, 140));
	panel.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.blue, 2));
	dialog.setContentPane(panel);

	JLabel label = new JLabel();
	label.setIcon(new ImageIcon(getClass().getResource("/atujplag/data/biglogo.gif"))); //$NON-NLS-1$
	panel.add(label);
	dialog.setUndecorated(true);
	dialog.getContentPane().setBackground(Color.WHITE);

	dialog.pack();
	dialog.setLocationRelativeTo(null);
	dialog.setVisible(true);
}
 
/**
 * Constructor.
 *
 * Must be called in the Event Dispatching Thread.
 *
 * @param owner owner of dialog
 * @param dialogTitle title for new dialog
 * @param message message displayed in dialog
 * @param blockOwner
 */
public SwingWorkerWithProgressIndicatorDialog(Frame owner,
        ProgressPanel progressPanel,
        String dialogTitle) {
    super(progressPanel);

    assert (SwingUtilities.isEventDispatchThread());

    // prepare the dialog
    dialog = new JDialog(owner, dialogTitle);
    dialog.setModal(true);
    dialog.setResizable(false);
    dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    progressPanel.setMessage(getProgressMessage());
    progressPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    dialog.setContentPane(progressPanel);
    dialog.pack();
    dialog.setLocationRelativeTo(owner);
}
 
源代码7 项目: netbeans   文件: WebBeansActionHelper.java
static void showEventsDialog( MetadataModel<WebBeansModel> metaModel , 
        WebBeansModel model,Object[] subject, 
        EventsModel uiModel , String name ) 
{
    subject[2] = InspectActionId.METHOD_CONTEXT;
    StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(
            InjectablesModel.class, WAIT_NODE));
    JDialog dialog = ResizablePopup.getDialog();
    String title = NbBundle.getMessage(WebBeansActionHelper.class,
            "TITLE_Events" , name );//NOI18N
    dialog.setTitle( title );
    dialog.setContentPane( new EventsPanel(subject, metaModel, 
            model ,uiModel ));
    dialog.setVisible( true );
}
 
源代码8 项目: osp   文件: EjsControlFrame.java
public void inspectXML() {
  // display a TreePanel in a modal dialog
  XMLControl xml = new XMLControlElement(getOSPApp());
  XMLTreePanel treePanel = new XMLTreePanel(xml);
  JDialog dialog = new JDialog((java.awt.Frame) null, true);
  dialog.setContentPane(treePanel);
  dialog.setSize(new Dimension(600, 300));
  dialog.setVisible(true);
}
 
源代码9 项目: osp   文件: DiagnosticsForSystem.java
public static void aboutSystem(Frame owner) {
    JDialog dialog = new JDialog(owner,"System Properties");  //$NON-NLS-1$
    DiagnosticsForSystem viewer = new DiagnosticsForSystem();
    dialog.setContentPane(viewer);
    dialog.setSize(500, 300);
    dialog.setVisible(true);	  
}
 
源代码10 项目: snap-desktop   文件: AboutAction.java
@Override
public void actionPerformed(ActionEvent e) {
    JDialog dialog = new JDialog(WindowManager.getDefault().getMainWindow(), Bundle.CTL_AboutAction_Title(), true);
    dialog.setContentPane(new AboutPanel());
    dialog.pack();
    dialog.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);
}
 
源代码11 项目: osp   文件: OSPInspector.java
/**
 * Shows the inspector.
 *
 * @return Object the object being inspected.
 */
public Object show() {
  xml.saveObject(obj); // needed in case object has been recently modified
  JDialog dialog = new JDialog((java.awt.Frame) null, true);
  dialog.setContentPane(new XMLTreePanel(xml));
  dialog.setSize(new Dimension(600, 300));
  dialog.setTitle(shortObjectName+" "+ControlsRes.getString("OSPInspector.Title")); //$NON-NLS-1$ //$NON-NLS-2$
  dialog.setVisible(true);
  obj = xml.loadObject(null);
  return obj;
}
 
源代码12 项目: rapidminer-studio   文件: DeprecationWarning.java
/**
 * Restores the previous content pane of the dialog
 *
 * @param dialog
 * 		the same dialog that was used for {@link #addToDialog(JDialog)}
 */
public void removeFromDialog(JDialog dialog) {
	Container contentPane = originalContentPane;
	if (equals(dialog.getContentPane()) && contentPane != null) {
		dialog.setContentPane(contentPane);
		originalContentPane = null;
	}
}
 
源代码13 项目: WorldGrower   文件: DialogUtils.java
/**
 * Centers the dialog over the given parent component. Also, creates a
 * semi-transparent panel behind the dialog to mask the parent content.
 * The title of the dialog is displayed in a custom fashion over the dialog
 * panel, and a rectangular shadow is placed behind the dialog.
 */
public static void createDialogBackPanel(JDialog dialog, Component parent) {
	dialog.setBackground(new Color(255, 255, 255, 64));
	
	DialogBackPanel newContentPane = new DialogBackPanel(dialog.getContentPane(), dialog.getTitle());
	dialog.setContentPane(newContentPane);
	dialog.setSize(parent.getSize());
	dialog.setLocation(parent.getLocationOnScreen());
}
 
源代码14 项目: BART   文件: CompareChangesDialog.java
public void showResults(String results) {
    JDialog dialog = new JDialog(this, true);
    dialog.setSize(500, 300);
    dialog.setLocationRelativeTo(this);
    JTextArea textArea = new JTextArea(results);
    textArea.setEditable(false);
    textArea.setFont(new Font("monospaced", Font.PLAIN, 14));
    dialog.setContentPane(new JScrollPane(textArea));
    dialog.setVisible(true);
}
 
源代码15 项目: javamelody   文件: Utilities.java
/**
 * Affiche un texte scrollable non éditable dans une popup.
 * @param component Parent
 * @param title Titre de la popup
 * @param text Texte
 */
public static void showTextInPopup(Component component, String title, String text) {
	final JTextArea textArea = new JTextArea();
	textArea.setText(text);
	textArea.setEditable(false);
	textArea.setCaretPosition(0);
	// background nécessaire avec la plupart des look and feels dont Nimbus,
	// sinon il reste blanc malgré editable false
	textArea.setBackground(Color.decode("#E6E6E6"));
	final JScrollPane scrollPane = new JScrollPane(textArea);

	final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 5));
	final MButton clipBoardButton = new MButton(
			I18NAdapter.getString("Copier_dans_presse-papiers"));
	clipBoardButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			textArea.selectAll();
			textArea.copy();
			textArea.setCaretPosition(0);
		}
	});
	buttonPanel.setOpaque(false);
	buttonPanel.add(clipBoardButton);

	final Window window = SwingUtilities.getWindowAncestor(component);
	final JDialog dialog = new JDialog((JFrame) window, title, true);
	final JPanel contentPane = new JPanel(new BorderLayout());
	contentPane.add(scrollPane, BorderLayout.CENTER);
	contentPane.add(buttonPanel, BorderLayout.SOUTH);
	dialog.setContentPane(contentPane);
	dialog.pack();
	dialog.setLocationRelativeTo(window);
	dialog.setVisible(true);
}
 
源代码16 项目: libreveris   文件: LicenseCompanion.java
@Override
protected void doInstall ()
        throws Exception
{
    // When running without UI, we assume license is accepted
    if (!Installer.hasUI()) {
        return;
    }

    // User choice (must be an output, yet final)
    final boolean[] isOk = new boolean[1];

    final String yes = "Yes";
    final String no = "No";
    final String browse = "View License";
    final JOptionPane optionPane = new JOptionPane(
            "Do you agree to license " + LICENSE_NAME + "?",
            JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_CANCEL_OPTION,
            null,
            new Object[]{yes, no, browse},
            yes);
    final String frameTitle = "End User License Agreement";
    final JDialog dialog = new JDialog(
            Installer.getFrame(),
            frameTitle,
            true);
    dialog.setContentPane(optionPane);

    // Prevent dialog closing
    dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

    optionPane.addPropertyChangeListener(
            new PropertyChangeListener()
    {
        @Override
        public void propertyChange (PropertyChangeEvent e)
        {
            String prop = e.getPropertyName();

            if (dialog.isVisible()
                && (e.getSource() == optionPane)
                && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
                Object option = optionPane.getValue();
                logger.debug("option: {}", option);

                if (option == yes) {
                    isOk[0] = true;
                    dialog.setVisible(false);
                    dialog.dispose();
                } else if (option == no) {
                    isOk[0] = false;
                    dialog.setVisible(false);
                    dialog.dispose();
                } else if (option == browse) {
                    logger.info(
                            "Launching browser on {}",
                            LICENSE_URL);
                    showLicense();
                    optionPane.setValue(
                            JOptionPane.UNINITIALIZED_VALUE);
                } else {
                }
            }
        }
    });

    dialog.pack();
    dialog.setLocationRelativeTo(Installer.getFrame());
    dialog.setVisible(true);

    logger.debug("OK: {}", isOk[0]);

    if (!isOk[0]) {
        throw new LicenseDeclinedException();
    }
}
 
源代码17 项目: triplea   文件: UserActionPanel.java
@Override
public void actionPerformed(final ActionEvent event) {
  final JDialog userChoiceDialog = new JDialog(parent, "Actions and Operations", true);

  final JPanel userChoicePanel = new JPanel();
  userChoicePanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
  userChoicePanel.setLayout(new GridBagLayout());

  int row = 0;
  final JScrollPane choiceScroll =
      new JScrollPane(getUserActionButtonPanel(userChoiceDialog));
  choiceScroll.setBorder(BorderFactory.createEtchedBorder());
  userChoicePanel.add(
      choiceScroll,
      new GridBagConstraints(
          0,
          row++,
          2,
          1,
          1,
          1,
          GridBagConstraints.CENTER,
          GridBagConstraints.BOTH,
          new Insets(0, 0, 0, 0),
          0,
          0));

  final JButton noActionButton =
      new JButton(SwingAction.of("No Actions", e -> userChoiceDialog.setVisible(false)));
  SwingUtilities.invokeLater(noActionButton::requestFocusInWindow);
  userChoicePanel.add(
      noActionButton,
      new GridBagConstraints(
          0,
          row,
          2,
          1,
          0.0,
          0.0,
          GridBagConstraints.EAST,
          GridBagConstraints.NONE,
          new Insets(12, 0, 0, 0),
          0,
          0));

  userChoiceDialog.setContentPane(userChoicePanel);
  userChoiceDialog.pack();
  userChoiceDialog.setLocationRelativeTo(parent);
  userChoiceDialog.setVisible(true);
  userChoiceDialog.dispose();
}
 
源代码18 项目: ontopia   文件: VizController.java
private TopicMapIF importTopicMap(TopicMapReaderIF reader, String name) {
  final JOptionPane pane = new JOptionPane(new Object[] { Messages
      .getString("Viz.LoadingTopicMap") + name },
      JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
      new String[] {}, null);

  Frame frame = JOptionPane.getFrameForComponent(vpanel);
  final JDialog dialog = new JDialog(frame, Messages
      .getString("Viz.Information"), true);

  dialog.setContentPane(pane);
  dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
  dialog.addWindowListener(new WindowAdapter() {
    @Override
    public void windowClosing(WindowEvent we) {
      JOptionPane
          .showMessageDialog(pane,
              Messages.getString("Viz.CannotCancelOperation"), 
              Messages.getString("Viz.Information"),
              JOptionPane.INFORMATION_MESSAGE);
    }
  });

  dialog.pack();
  dialog.setLocationRelativeTo(frame);

  TopicMapIF tm;
  final TopicMapReaderIF r = reader;

  final SwingWorker worker = new SwingWorker() {
    @Override
    public Object construct() {
      TopicMapIF result = null;
      try {
        result = r.read();
      } catch (IOException e) {
        dialog.setVisible(false);
        ErrorDialog.showError(vpanel, e.getMessage());
      }
      return result;
    }

    @Override
    public void finished() {
      dialog.setVisible(false);
    }
  };

  worker.start();
  dialog.setVisible(true);
  tm = (TopicMapIF) worker.getValue();
  return tm;
}
 
源代码19 项目: snap-desktop   文件: AbstractModalDialog.java
@Override
public final int show() {
    JDialog dialog = getJDialog();
    if (!dialog.isShowing()) {
        this.componentsAllwaysEnabled = new ArrayList<JComponent>();

        ActionListener cancelActionListener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent event) {
                close();
            }
        };
        registerEscapeKey(cancelActionListener);

        ComponentsEnabled componentsEnabled = new ComponentsEnabled() {
            @Override
            public void setComponentsEnabled(boolean enabled) {
                setEnabledComponentsWhileLoading(enabled);
            }
        };
        this.loadingIndicatorPanel = new LoadingIndicatorPanel(componentsEnabled);
        dialog.getLayeredPane().add(this.loadingIndicatorPanel, JLayeredPane.MODAL_LAYER);

        int gapBetweenColumns = getDefaultGapBetweenColumns();
        int gapBetweenRows = getDefaultGapBetweenRows();

        JPanel contentPanel = buildContentPanel(gapBetweenColumns, gapBetweenRows);
        JPanel buttonsPanel = buildButtonsPanel(cancelActionListener);

        JPanel dialogContentPanel = new JPanel(new BorderLayout(0, getDefaultGapBetweenContentAndButtonPanels()));
        dialogContentPanel.add(contentPanel, BorderLayout.CENTER);
        dialogContentPanel.add(buttonsPanel, BorderLayout.SOUTH);
        Border dialogBorder = buildDialogBorder(getDefaultContentPanelMargins());
        dialogContentPanel.setBorder(dialogBorder);

        dialog.setContentPane(dialogContentPanel);

        dialog.setResizable(true);
        dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        dialog.setUndecorated(false);
        dialog.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent aEvent) {
                close();
            }
        });
        dialog.pack();
        dialog.setLocationRelativeTo(dialog.getParent());

        onAboutToShow();

        dialog.setVisible(true);
    }
    return 0;
}
 
源代码20 项目: libreveris   文件: ScoreActions.java
/**
 * Prompts the user for interactive confirmation or modification of
 * score/page parameters
 *
 * @param sheet the current sheet, or null
 * @return true if parameters are applied, false otherwise
 */
private static boolean applyUserSettings (final Sheet sheet)
{
    try {
        final WrappedBoolean apply = new WrappedBoolean(false);
        final ScoreParameters scoreParams = new ScoreParameters(sheet);
        final JOptionPane optionPane = new JOptionPane(
                scoreParams.getComponent(),
                JOptionPane.QUESTION_MESSAGE,
                JOptionPane.OK_CANCEL_OPTION);
        final String frameTitle = (sheet != null)
                ? (sheet.getScore()
                .getRadix()
                   + " parameters")
                : "General parameters";
        final JDialog dialog = new JDialog(
                Main.getGui().getFrame(),
                frameTitle,
                true); // Modal flag
        dialog.setContentPane(optionPane);
        dialog.setName("scoreParams");

        optionPane.addPropertyChangeListener(
                new PropertyChangeListener()
        {
            @Override
            public void propertyChange (PropertyChangeEvent e)
            {
                String prop = e.getPropertyName();

                if (dialog.isVisible()
                    && (e.getSource() == optionPane)
                    && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
                    Object obj = optionPane.getValue();
                    int value = ((Integer) obj).intValue();
                    apply.set(value == JOptionPane.OK_OPTION);

                    // Exit only if user gives up or enters correct data
                    if (!apply.isSet()
                        || scoreParams.commit(sheet)) {
                        dialog.setVisible(false);
                        dialog.dispose();
                    } else {
                        // Incorrect data, so don't exit yet
                        try {
                            // TODO: Is there a more civilized way?
                            optionPane.setValue(
                                    JOptionPane.UNINITIALIZED_VALUE);
                        } catch (Exception ignored) {
                        }
                    }
                }
            }
        });

        dialog.pack();
        MainGui.getInstance()
                .show(dialog);

        return apply.value;
    } catch (Exception ex) {
        logger.warn("Error in ScoreParameters", ex);

        return false;
    }
}