YES_TO_ALL in Swing.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    YES_TO_ALL in Swing.

    Is there any message box template which allows me to have "Yes to all"?

    Debasis Jana
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by dmjpro
    Is there any message box template which allows me to have "Yes to all"?

    Debasis Jana
    I re-read the JOptionPane API documentation for you and no, there isn't such
    an option; there isn't a "No to all" option either. But nothing forbids you to build
    your own dialog given the JDialog class ...

    kind regards,

    Jos

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by JosAH
      I re-read the JOptionPane API documentation for you and no, there isn't such
      an option; there isn't a "No to all" option either. But nothing forbids you to build
      your own dialog given the JDialog class ...

      kind regards,

      Jos
      Actually I read but i didn't find that's why i came to this site.
      And what i decided that i have to develop my own dialog box.

      Debasis Jana

      Comment

      • BigDaddyLH
        Recognized Expert Top Contributor
        • Dec 2007
        • 1216

        #4
        Hold yer horses:

        [CODE=Java]import javax.swing.*;

        public class OptionExample {
        public static void main(String[] args) {
        JDialog.setDefa ultLookAndFeelD ecorated(true);

        JComponent parentComponent = null;
        String message = "this is the message string.";
        String title = "title string";
        int optionType = JOptionPane.DEF AULT_OPTION;
        int messageType = JOptionPane.QUE STION_MESSAGE;
        Icon icon = null;
        String[] options = {"yes", "no", "yes to all", "no to all", "cancel"};
        String initialValue = options[options.length-1];


        int result = JOptionPane.sho wOptionDialog(
        parentComponent ,
        message,
        title,
        optionType,
        messageType,
        icon,
        options,
        initialValue
        );
        }
        }[/CODE]

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Nah, I don't like that because (important to me) is that the JOptionPane doesn't
          run through the same localization hoops with user supplied options.

          kind regards,

          Jos

          Comment

          • BigDaddyLH
            Recognized Expert Top Contributor
            • Dec 2007
            • 1216

            #6
            Originally posted by JosAH
            Nah, I don't like that because (important to me) is that the JOptionPane doesn't
            run through the same localization hoops with user supplied options.

            kind regards,

            Jos
            Yup, but if the only other option is "roll yer own", I reckon this cowboy knows what to do.

            Comment

            • dmjpro
              Top Contributor
              • Jan 2007
              • 2476

              #7
              Originally posted by BigDaddyLH
              Yup, but if the only other option is "roll yer own", I reckon this cowboy knows what to do.

              I already did that by extending the JDialog.

              Debasis Jana

              Comment

              • BigDaddyLH
                Recognized Expert Top Contributor
                • Dec 2007
                • 1216

                #8
                Originally posted by dmjpro
                I already did that by extending the JDialog.

                Debasis Jana
                As you like. I prefer showOptionDialo g.

                Comment

                • dmjpro
                  Top Contributor
                  • Jan 2007
                  • 2476

                  #9
                  Originally posted by BigDaddyLH
                  As you like. I prefer showOptionDialo g.
                  But what Josh told against you i couldn't understand, will you make me understand?
                  What's the problem with that?

                  Debasis Jana

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by dmjpro
                    But what Josh told against you i couldn't understand, will you make me understand?
                    What's the problem with that?

                    Debasis Jana
                    The default 'yes' and 'no' butons in that JOptionPane automagically localize; the
                    buttons you add yourself don't do that.

                    kind regards,

                    Jos

                    Comment

                    • BigDaddyLH
                      Recognized Expert Top Contributor
                      • Dec 2007
                      • 1216

                      #11
                      Originally posted by JosAH
                      The default 'yes' and 'no' butons in that JOptionPane automagically localize; the
                      buttons you add yourself don't do that.

                      kind regards,

                      Jos
                      Demo:

                      [CODE=Java]import java.util.Local e;
                      import javax.swing.JOp tionPane;

                      public class BonjourMonde {
                      public static void main(String[] args) {
                      Locale.setDefau lt(Locale.FRANC E);
                      JOptionPane.sho wConfirmDialog( null, "this is a test");
                      }
                      }[/CODE]

                      Comment

                      • JosAH
                        Recognized Expert MVP
                        • Mar 2007
                        • 11453

                        #12
                        Originally posted by BigDaddyLH
                        Demo:

                        [CODE=Java]import java.util.Local e;
                        import javax.swing.JOp tionPane;

                        public class BonjourMonde {
                        public static void main(String[] args) {
                        Locale.setDefau lt(Locale.FRANC E);
                        JOptionPane.sho wConfirmDialog( null, "this is a test");
                        }
                        }[/CODE]
                        Just like I said: the 'standard' buttons are localized (and the title is) but nothing
                        else is.

                        kind regards,

                        Jos

                        Comment

                        Working...