Class OKCancelDialog

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, HelpPageProvider
    Direct Known Subclasses:
    OKCancelDialog, SATableSplitCustomizerDialog

    @API(type=EXTENDABLE,
         src=PUBLIC)
    public class OKCancelDialog
    extends javax.swing.JDialog
    implements HelpPageProvider
    Dialog with OK and Cancel buttons.
    See Also:
    Serialized Form
    • Field Detail

      • RESULT_CANCEL

        public static final int RESULT_CANCEL
        Dialog was canceled.
        See Also:
        Constant Field Values
      • messages

        protected static final ro.sync.i18n.MessageBundle messages
        The messages resource bundle.
    • Constructor Detail

      • OKCancelDialog

        public OKCancelDialog​(javax.swing.JFrame parentFrame,
                              java.lang.String title,
                              boolean modal)
        Constructor.
        Parameters:
        parentFrame - The parent frame. Can be null in which case it will be auto detected.
        title - The dialog title.
        modal - true if modal.
      • OKCancelDialog

        public OKCancelDialog​(java.awt.Frame parentFrame,
                              java.lang.String title,
                              boolean modal)
        Constructor.
        Parameters:
        parentFrame - The parent frame. Can be null in which case it will be auto detected.
        title - The dialog title.
        modal - true if modal.
    • Method Detail

      • detectParentFrame

        public static java.awt.Window detectParentFrame​(java.awt.Window parentFrame)
        Try to detect the parent frame if null or not showing.
        Parameters:
        parentFrame - The parent frame.
        Returns:
        the parent frame.
        Since:
        24
      • doOK

        protected void doOK()
        OK pressed.
      • enterKeyPressed

        protected void enterKeyPressed()
        Enter key pressed. If ok button is enabled call doOk method.

        Subclasses can overwrite this method to make default action.

      • doCancel

        protected void doCancel()
        Cancel pressed.
      • getResult

        public int getResult()
        Gets the result of the the dialog. Used after show.
        Returns:
        The result value.
      • setOkButtonText

        public void setOkButtonText​(java.lang.String text)
        Sets the text on the ok button.
        Parameters:
        text - The text value.
      • setCancelButtonText

        public void setCancelButtonText​(java.lang.String text)
        Sets the text on the cancel button.
        Parameters:
        text - The text value.
      • getContentPane

        public java.awt.Container getContentPane()
        Specified by:
        getContentPane in interface javax.swing.RootPaneContainer
        Overrides:
        getContentPane in class javax.swing.JDialog
        See Also:
        JDialog.getContentPane()
      • getOkButton

        public javax.swing.JButton getOkButton()
        Returns:
        Returns the okButton.
      • getCancelButton

        public javax.swing.JButton getCancelButton()
        Returns:
        Returns the cancelButton.
      • setVisible

        public void setVisible​(boolean visible)
        Overrides:
        setVisible in class java.awt.Dialog
        See Also:
        Dialog.setVisible(boolean)
      • setDialogLocation

        protected void setDialogLocation()
        Set dialog location. By default it is relative to the owner window.
      • getHiDPIAwareDimension

        @Deprecated
        protected java.awt.Dimension getHiDPIAwareDimension​(java.awt.Dimension initialDimension)
        Deprecated.
        Kept for backwards compatibility, no longer necessary with java 9+
        Kept for backwards compatibility, no longer necessary with java 9+ Get the high DPI aware dimension.
        Parameters:
        initialDimension - The initial dimension.
        Returns:
        The computed dimension if we have a high DPI screen with no implicit support form the OS (e.g. Windows), or the initial dimension otherwise.
      • getHelpPageID

        public java.lang.String getHelpPageID()
        Get the help page ID. If an implementation returns a help page ID, the dialog will contain an extra "Help" button in the bottom left. If the returned help page ID is an URL, a web browser will be opened pointing to that URL when the user presses F1 in the dialog or when using the Help button. If the returned help page ID is an identifier, when help is invoked, the application will open the Oxygen User's Manual and locate this identifier inside it.
        Specified by:
        getHelpPageID in interface HelpPageProvider
        Returns:
        the help page id for this provider. If not needed please return NO_HELP_PAGE_ID
        Since:
        18
        See Also:
        HelpPageProvider.getHelpPageID()