?
Solved

changing an option pane

Posted on 2004-10-03
4
Medium Priority
?
267 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Six Sigma Control Plans
Introduction to Processes

764 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