本文整理了Java中javax.swing.JDialog.addComponentListener()
方法的一些代码示例,展示了JDialog.addComponentListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.addComponentListener()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:addComponentListener
暂无
代码示例来源:origin: stackoverflow.com
JDialog dialog = new JDialog(...);
...
dialog.addComponentListener(new ComponentAdapter()
{
public void componentShown(ComponentEvent e)
{
System.out.println("Time to do something");
}
});
dialog.setVisible( true );
代码示例来源:origin: datacleaner/DataCleaner
protected void createDialog(final Component chooser, final Component parent, final ComponentListener listener) {
_dialog = WidgetFactory.createModalDialog(chooser, parent, _openType.getTitle(), true);
if (listener != null) {
_dialog.addComponentListener(listener);
}
_dialog.setVisible(true);
_dialog.dispose();
_dialog = null;
}
代码示例来源:origin: bcdev/beam
/**
* Overridden in order to recognize dialog size changes.
*
* @param parent the parent
* @return the dialog
* @throws HeadlessException
*/
@Override
protected JDialog createDialog(Component parent) throws HeadlessException {
final JDialog dialog = super.createDialog(parent);
dialog.addComponentListener(resizeHandler);
if (dialogBounds != null) {
dialog.setBounds(dialogBounds);
}
return dialog;
}
代码示例来源:origin: com.goldmansachs.obevo/obevo-core
JOptionPane.OK_CANCEL_OPTION);
JDialog userDialog = juop.createDialog(promptMessage);
userDialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent e) {
代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui
private void initGUI() {
JLabel label = new JLabel(this.message, SwingConstants.CENTER);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
WaitDialog.this.dialog.hide();
WaitDialog.this.cancelable.cancel();
}
});
JPanel buttonPanel = new JPanel();
buttonPanel.add(cancelButton);
this.dialog = new XBayaDialog(this.xbayaGUI, this.title, label, buttonPanel);
this.dialog.getDialog().setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.dialog.getDialog().setCursor(SwingUtil.WAIT_CURSOR);
this.dialog.getDialog().addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent e) {
shown();
}
});
}
代码示例来源:origin: UISpec4J/UISpec4J
public void show() {
try {
UISpecDisplay.instance().assertAcceptsWindow(new Window(dialog));
}
catch (Error t) {
if (SwingUtilities.isEventDispatchThread()) {
dialog.setVisible(false);
return;
}
else {
throw t;
}
}
if (!listenerRegistered) {
dialog.addComponentListener(new ComponentAdapter() {
public void componentShown(ComponentEvent e) {
try {
UISpecDisplay.instance().showDialog(dialog);
}
catch (Throwable t) {
throw new RuntimeException(t);
}
}
});
listenerRegistered = true;
}
}
代码示例来源:origin: protegeproject/protege
public void handleExplain(Frame owner, OWLAxiom axiom) {
final ExplanationDialog explanation = new ExplanationDialog(this, axiom);
openedExplanations.add(explanation);
JOptionPane op = new JOptionPane(explanation, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
JDialog dlg = op.createDialog(owner, getExplanationDialogTitle(axiom));
dlg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dlg.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
dispose(explanation);
}
});
dlg.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
dispose(explanation);
}
});
dlg.setModal(false);
dlg.setResizable(true);
dlg.pack();
dlg.setVisible(true);
}
代码示例来源:origin: freeplane/freeplane
public static Color showCommonJColorChooserDialog(final Component component, final String title,
final Color initialColor, final Color defaultColor) {
final JColorChooser pane = ColorTracker.getCommonJColorChooser();
pane.setColor(initialColor);
final ColorTracker ok = new ColorTracker(pane);
final JDialog dialog = JColorChooser.createDialog(component, title, true, pane, ok, null);
final Container container = (Container) dialog.getContentPane().getComponent(1);
if(defaultColor != null){
final JButton defaultBtn = new JButton(TextUtils.getText("reset_to_default"));
defaultBtn.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
dialog.dispose();
ok.setColor(defaultColor);
}
});
container.add(defaultBtn);
}
dialog.addWindowListener(new Closer());
dialog.addComponentListener(new DisposeOnClose());
dialog.pack();
UITools.setDialogLocationRelativeTo(dialog, component);
dialog.setVisible(true);
return ok.getColor();
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl
public void handleExplain(Frame owner, OWLAxiom axiom) {
Collection<ExplanationService> teachers = getTeachers(axiom);
final ExplanationDialog explanation = new ExplanationDialog(owner, this, axiom);
JOptionPane op = new JOptionPane(explanation, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
JDialog dlg = op.createDialog(owner, getExplanationDialogTitle(axiom));
dlg.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
explanation.dispose();
}
});
dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dlg.setModal(false);
dlg.setResizable(true);
dlg.pack();
dlg.setVisible(true);
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
public void handleExplain(Frame owner, OWLAxiom axiom) {
final ExplanationDialog explanation = new ExplanationDialog(this, axiom);
openedExplanations.add(explanation);
JOptionPane op = new JOptionPane(explanation, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
JDialog dlg = op.createDialog(owner, getExplanationDialogTitle(axiom));
dlg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dlg.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
dispose(explanation);
}
});
dlg.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
dispose(explanation);
}
});
dlg.setModal(false);
dlg.setResizable(true);
dlg.pack();
dlg.setVisible(true);
}
代码示例来源:origin: freeplane/freeplane
public void show(final Component component, final INodeSelector externalSelector) {
node = null;
dialog = UITools.createCancelDialog(component, TextUtils.getText("node_selector"), TextUtils.getText("node_selector_message"));
UITools.setDialogLocationRelativeTo(dialog, component);
dialog.getRootPane().addAncestorListener(new GlassPaneManager(SwingUtilities.getRootPane(component), this));
dialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
externalSelector.nodeSelected(node);
}
});
dialog.setVisible(true);
}
}
代码示例来源:origin: org.apache.xmlgraphics/batik-awt-util
/**
* Displays the panel in a modal dialog box.
* @param cmp the dialog's parent component
* @param title the dialog's title
*
* @return null if the dialog was cancelled. Otherwise, the value entered
* by the user.
*/
public static AffineTransform showDialog(Component cmp,
String title){
final JAffineTransformChooser pane
= new JAffineTransformChooser();
AffineTransformTracker tracker = new AffineTransformTracker(pane);
JDialog dialog = new Dialog(cmp, title, true, pane, tracker, null);
dialog.addWindowListener(new Closer());
dialog.addComponentListener(new DisposeOnClose());
dialog.setVisible(true); // blocks until user brings dialog down...
return tracker.getAffineTransform();
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
/**
* Displays the panel in a modal dialog box.
* @param cmp the dialog's parent component
* @param title the dialog's title
*
* @return null if the dialog was cancelled. Otherwise, the value entered
* by the user.
*/
public static AffineTransform showDialog(Component cmp,
String title){
final JAffineTransformChooser pane
= new JAffineTransformChooser();
AffineTransformTracker tracker = new AffineTransformTracker(pane);
JDialog dialog = new Dialog(cmp, title, true, pane, tracker, null);
dialog.addWindowListener(new Closer());
dialog.addComponentListener(new DisposeOnClose());
dialog.setVisible(true); // blocks until user brings dialog down...
return tracker.getAffineTransform();
}
代码示例来源:origin: senbox-org/snap-desktop
/**
* Overridden in order to recognize dialog size changes.
*
* @param parent the parent
* @return the dialog
*
* @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true.
*/
@Override
protected JDialog createDialog(Component parent) throws HeadlessException {
final JDialog dialog = super.createDialog(parent);
Rectangle dialogBounds = loadDialogBounds();
if (dialogBounds != null) {
dialog.setBounds(dialogBounds);
}
dialog.addComponentListener(resizeHandler);
dialog.addWindowListener(windowCloseHandler);
initViewType();
return dialog;
}
代码示例来源:origin: apache/batik
/**
* Displays the panel in a modal dialog box.
* @param cmp the dialog's parent component
* @param title the dialog's title
*
* @return null if the dialog was cancelled. Otherwise, the value entered
* by the user.
*/
public static AffineTransform showDialog(Component cmp,
String title){
final JAffineTransformChooser pane
= new JAffineTransformChooser();
AffineTransformTracker tracker = new AffineTransformTracker(pane);
JDialog dialog = new Dialog(cmp, title, true, pane, tracker, null);
dialog.addWindowListener(new Closer());
dialog.addComponentListener(new DisposeOnClose());
dialog.setVisible(true); // blocks until user brings dialog down...
return tracker.getAffineTransform();
}
代码示例来源:origin: edu.stanford.protege/explanation-workbench
public void explain(OWLOntology ontology) {
OWLModelManager owlModelManager = editorKit.getOWLModelManager();
OWLDataFactory df = owlModelManager.getOWLDataFactory();
OWLSubClassOfAxiom entailment = df.getOWLSubClassOfAxiom(df.getOWLThing(), df.getOWLNothing());
final WorkbenchPanel panel = new WorkbenchPanel(editorKit, entailment);
JOptionPane op = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
JDialog dlg =op.createDialog("Inconsistent ontology explanation");
dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dlg.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(ComponentEvent e) {
panel.dispose();
}
});
dlg.setModal(false);
dlg.setResizable(true);
dlg.setVisible(true);
}
代码示例来源:origin: senbox-org/snap-desktop
private void initialize(ToolAdapterOperatorDescriptor descriptor) {
//this.operatorDescriptor = new ToolAdapterOperatorDescriptor(descriptor);
this.operatorDescriptor = descriptor;
//add paraeters of template parameters
artificiallyAddedParams = new ArrayList<>();
Arrays.stream(this.operatorDescriptor.getToolParameterDescriptors().toArray()).filter(p -> ((ToolParameterDescriptor)p).isTemplateParameter()).
forEach(p -> artificiallyAddedParams.addAll(((TemplateParameterDescriptor)p).getParameterDescriptors()));
this.operatorDescriptor.getToolParameterDescriptors().addAll(artificiallyAddedParams);
this.parameterSupport = new OperatorParameterSupport(this.operatorDescriptor);
Arrays.stream(this.operatorDescriptor.getToolParameterDescriptors().toArray()).
filter(p -> ToolAdapterConstants.FOLDER_PARAM_MASK.equals(((ToolParameterDescriptor)p).getParameterType())).
forEach(p -> parameterSupport.getPropertySet().getProperty(((ToolParameterDescriptor)p).getName()).getDescriptor().setAttribute("directory", true));
form = new ToolExecutionForm(appContext, this.operatorDescriptor, parameterSupport.getPropertySet(),
getTargetProductSelector());
OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
this.operatorDescriptor,
parameterSupport,
appContext,
descriptor.getHelpID() != null ? descriptor.getHelpID() : helpID);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
EscapeAction.register(getJDialog());
this.getJDialog().addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent e) {form.refreshDimension();}
});
this.getJDialog().addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {form.refreshDimension();}
});
this.getJDialog().setMinimumSize(new Dimension(250, 250));
}
代码示例来源:origin: freeplane/freeplane
public static void setNewAcceleratorOnNextClick(KeyStroke accelerator) {
if (AccelerateableAction.isNewAcceleratorOnNextClickEnabled()) {
return;
}
acceleratorForNextClickedAction = accelerator;
String title = TextUtils.getText("SetAccelerator.dialogTitle");
String text = TextUtils.getText(SET_ACCELERATOR_ON_NEXT_CLICK_ACTION);
if(accelerator != null)
text = TextUtils.format("SetAccelerator.keystrokeDetected", toString(accelerator)) + "\n" + text;
final Component frame = Controller.getCurrentController().getViewController().getMenuComponent();
setAcceleratorOnNextClickActionDialog = UITools.createCancelDialog(frame, title, text);
setAcceleratorOnNextClickActionDialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(final ComponentEvent e) {
setAcceleratorOnNextClickActionDialog = null;
acceleratorForNextClickedAction = null;
}
});
setAcceleratorOnNextClickActionDialog.setVisible(true);
}
代码示例来源:origin: abc9070410/JComicDownloader
/**
* Shows a modal font-chooser dialog and blocks until the
* dialog is hidden. If the user presses the "OK" button, then
* this method hides/disposes the dialog and returns the selected color.
* If the user presses the "Cancel" button or closes the dialog without
* pressing "OK", then this method hides/disposes the dialog and returns
* <code>null</code>.
*
* @param component the parent <code>Component</code> for the dialog
* @param title the String containing the dialog's title
* @return the selected font or <code>null</code> if the user opted out
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true.
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public Font showDialog( Component component, String title ) {
FontTracker ok = new FontTracker( this );
JDialog dialog = createDialog( component, title, true, ok, null );
dialog.setSize( 300, 400 );
dialog.addWindowListener( new FontChooserDialog.Closer() );
dialog.addComponentListener( new FontChooserDialog.DisposeOnClose() );
dialog.setVisible( true ); // blocks until user brings dialog down...
dialog.setSize( 300, 400 );
return ok.getFont();
}
代码示例来源:origin: igniterealtime/Spark
dialog.addComponentListener( new ComponentAdapter()
内容来源于网络,如有侵权,请联系作者删除!