Solved

changing an option pane

Posted on 2004-10-03
4
263 Views
Last Modified: 2010-04-17
Hi experts,
I would like to adjust the folling code:

private void print()
{
  int exit = JOptionPane.showConfirmDialog
  ( null,"Are you sure you want to print ?","Timeport . . .",JOptionPane.YES_NO_OPTION);

    f(exit==JOptionPane.YES_OPTION)
       {printPage(); }
}

I need it to include either 3 check boxes or those round ones (I believe they are called radio buttons) so that the user may choose which pages to print(please I need you to tell me also how to know if a check box has been checked)

I would also like to change the buttons from (yes and no) to (Print and Cancel)

thank you
0
Comment
Question by:Samooramad
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:itbeme
ID: 12212733
How much do you know about java?
JOptionPane is flexible in only certain ways.  It is designed mostly for informational and confirmation prompts.  You'll probably want to use a JFrame.

Here's an example of a drop down list under the warningbutton that uses JOptionPane.
http://www.cs.cf.ac.uk/Dave/HCI/HCI_Handout_CALLER/node97.html
0
 

Author Comment

by:Samooramad
ID: 12216549
not much obviously...
ok can you do that with a frame.. I need a quick solution
0
 
LVL 3

Accepted Solution

by:
itbeme earned 500 total points
ID: 12223759
The example I referenced you will allow you to use a drop down list for your three items
If you want help with that let me know.


One thing I thought of - I believe with a Frame there is no easy way to keep the window on top, ( user clicks on window behind and it comes to front and your print box disappears) Not sure my java getting a little rusty

If you put this code in your class file after all brackets you can launch a jframe by calling
JFrame callitsomething = new Myjframe();



class Myjframe extends JFrame{
      
      Myjframe() {
            super("Print");
             setSize(150,150);
             setVisible(true);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JLabel melab = new JLabel("acksdfadsf");
            JPanel panel = new JPanel();
            JButton melab3 = new JButton("acksdfadsf");
            panel.add(melab);
            panel.add(melab3);
            this.setContentPane(panel);
            
      }
}

This tutorial should get you through rest
http://java.sun.com/docs/books/tutorial/uiswing/components/button.html
0
 

Author Comment

by:Samooramad
ID: 12224882
I really would prefer check boxes or something similar. ok, thanks for the example. will try it and see if it works out

thanks
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Scripting vs. Programming languages 25 165
Image decoding from Camera 3 85
Help to convert powershell script into a gui 9 169
Definitions and default visual studio colors 5 65
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question