Solved

changing an option pane

Posted on 2004-10-03
4
265 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

739 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