JDialog Problem: How to make a simple "About" dialog box?

Hi, anyone can try me out the problem, how to make a simple "About" dialog box? I try to click on the MenuBar item, then request it display a JDialog, how? Following is my example code, what wrong code inside?
** Main.java**
============================
publc class Main extends JFrame{
public Main() {
          super();
          setJMenuBar();
          initialize();
public void setJMenuBar()
     JMenuBar menubar = new JMenuBar();
        setJMenuBar(menubar);
        JMenu menu1 = new JMenu("File");      
        JMenuItem item = new JMenuItem("About");      
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              // About about = new About(this);
           // about.show();
        menu1.add(item);
     menubar.add(menu1);
public static void main(String args[]){
     Main main = new Main();
}** About.java**
=============================
import java.awt.*;
import javax.swing.*;
public class About extends JDialog{
     JPanel jp_top, jp_center, jp_bottom;
     public About(JFrame owner){
          super(owner);
          setDefaultCloseOperation( DISPOSE_ON_CLOSE );
          Image img = Toolkit.getDefaultToolkit().getImage(DateChooser.class.getResource("Duke.gif"));          
          setIconImage( img );
          setSize(500,800);
          Container contentPane = getContentPane();
         contentPane.setLayout(new BorderLayout());           
         contentPane.add(getTop(), BorderLayout.NORTH);
          contentPane.add(getCenter(), BorderLayout.CENTER);
          contentPane.add(getBottom(), BorderLayout.SOUTH);
          setResizable(false);
           pack();            
           setVisible(true);
     public JPanel getTop(){
          jp_top = new JPanel();
          return jp_top;
     public JPanel getCenter(){
          jp_center = new JPanel();
          return jp_center;
     public JPanel getBottom(){
          jp_bottom = new JPanel();
          jp_bottom.setLayout(new BoxLayout(jp_bottom, BoxLayout.X_AXIS));
          JButton jb = new JButton("OK");
          jp_bottom.add(jb);
          return jp_bottom;
}

Code looks reasonable except
a) the code in the actionPerformed is commment out
b) the owner of the dialog should be the frame
If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
see http://homepage1.nifty.com/algafield/sscce.html,
that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Similar Messages

  • How to make a complaint about in store Apple customer service on iphone4S ?

    Hi all,
    I'd like to know about how to make a complaint about a very unpleasant service experience and I'd also like to share this story with you to see whether you guys have any comments (good/bad all welcomed!).
    I booked a genius bar service to see the technical consultant at 1:00 pm yesterday. I came at around 1:15 pm and I was told by the order person (i.e. the person who holds a list of bookings on an ipad and instructs customers to queue) that I had to book another service time (i.e. next week).Our conversation was not pleasant and is (roughly) the following one.
    Order person: You missed your appointment so book another one and come next week.
    Me: I had my work and that is why I am late.
    Order person: Sorry you need to book another one.
    Me: No other alternative? I took a bus and came all the way here.
    Order person: Or you can try Bondi.
    Me: ............No other alternative?
    Order person: Or you can wait for half an hour to one hour. You have seen how many people there are here.
    Me: All right. I understand so can I ask you some technical questions?
    Order person: You need to make a booking and talk to a genius service person.
    Me: I just want to know given the issue I have if I can make a replacement.
    Order person: What is your problem?
    Me: I bought this iphone here in Sydney and gave it to someone who lives overseas as a gift. When he made a call he frequently could not hear anything from the other end. I bought two iphones, one black and one white. (I showed him my reciept.) The white one works but the black one doesn't.
    Order person: Did you restore it?
    Me: Yes and I brought it here. (I showed him the iphone.)
    Order person: You do not have a micro-SIM card in the phone?
    Me: No because I do not use an iphone.
    Order person: If you do not have a SIM card then how can we assess it?
    Me: So you need a SIM card?
    Order person: Yes.
    Me: I came here three times and different people told me different things. The first two times both the came-up people said just take your phone and we can offer you a replacement. So I think this is how it should be.
    Order person: Well, I'm sorry!!! Now you know you need to have your micro-SIM card.
    Me: Can I see your manager? I want to know exactly what I need to do.
    Order person: I am the manager at the moment.
    Me: So that is all I need to bring? Iphone and its SIM card.
    Order person: Yes.
    Me: OK.
    Order person and his colleague had an unpleasant laugh after I turned.
    There are a few things I want to make a complaint on and I'd like to see you guys' opinions on this.
    The order person's attitude was not very acceptable. I understand he is an expert in this area but I believe there are non-expert customers like me who takes time to understand. Some of his words and his laugh made me very uncomfortable.
    Even I have come three times I am still confused about what I need to bring to see the genius service person. I can bring an iphone but I do not have an Australian micro-SIM card (since this iphone is a gift to other people who lives overseas).
    Thanks for reading all this! Any comments or suggestions are more than welcomed, both good and bad!
    Please let me know if you know a proper place where I can make a complaint!
    Thanks!!!

    Thanks for your response and yes, I haven't thought about the warranty being not international.
    Having said this, using all the modern technology of identifying and tracking my device to e.g. figur out the warranty status, I find it not satisfactory. People like in my case relocate from time to time and Apple as an international company with employees world-wide should know better I think and I expect a more customer oriented problem solving attitude and -if you want to make a difference - it sure is possible.
    Yes, I know the cue information from Manhattan, but in Hamburg you get other educational information on them.
    For me there is a gap between the glamourous coolness, hand-shaking and introducing oneself on one hand and the unsatisfactory problem solution from the customer's perspective. As such I am already annoyed/frustrated when my device is not working as it is supposed to. Getting just process-required and not flexible responses does not help.
    And no, I don't feel well, if I have an appointment scheduled for 10 minutes, invest already hours to make it happen and stay for much longer.
    What annoys me is that I get the impression despite the fact that as an 'already educated customer' I do a lot myself in figuring out what to do best and be considerate and I am still confronted with an attitude as if I don't 'function good enough' as customer and should know this and that and better. This *****.

  • How to make a simple Quiz?

    Could anyone help me with some hints and maybe sample code (or tutorial :)) how to make a simple quiz, with multiple
    answers choices, and a score function.
    //D

    You could for example do it like this:
    import java.io.*;
    class Quiz
    public static void main (String [] args)
    BufferedReader in = new BufferedReader (new InputStreamReader(System.in));
    System.out.println("SUPERQUIZ");
    System.out.println("How many legs does a horse have?");
    System.out.println();
    System.out.println("1");
    System.out.println("2");
    System.out.println("3");
    System.out.println("4");
    int answer = Integer.parseInt(in.readLine());
    if (answer == 4)
    System.out.println("The answer is correct");
    else
    System.out.println("The answer is incorrect");
    This is just a basic program, hope you understand it (hopefully it works).
    �sbj�rn

  • How I can diable in firefox dialog box "download error could not be saved, because the source file could not be read. " when file not downloaded

    How I can diable in firefox dialog box "download error could not be saved, because the source file could not be read. " standart download manager when file not downloaded

    It is possible that anti-virus software is corrupting downloaded files or is interfering otherwise.
    Try to disable the real-time (live) scanning of files in your anti-virus software temporarily to see if that makes downloading work.
    See:
    *http://kb.mozillazine.org/Unable_to_save_or_download_files
    You can try to set the browser.download.manager.scanWhenDone pref on the <b>about:config</b> page to false.
    *http://kb.mozillazine.org/about:config

  • About dialog box

    I'm in the process of entering About information and am
    wondering if there's any way to do the following:
    1. Can the About dialog box be made larger?
    2. Can the print in the dialog box be made large to
    accommodate visually impaired individuals without changing screen
    resolution?
    3. Can the preformatted text be changed? For instance, could
    I change
    Author to
    Contact us?
    Also, I've noticed that the line after
    Generated by: Adobe RoboHelp 6.0 doesn't display in some
    resolutions and only partially displays in others. Do you know what
    may be causing that problem?
    Thanks very much for your help.

    Hello friedlanders -
    I don't use RH6 but in RH5 the "About" window is the file
    named:
    whskin_banner.htm
    Open it in a plain text editor and you will see a lot of
    info.
    Make desired changes and save the file to a separate
    directory (the default file in the project root will get over
    written when you generate). After you gen your project just copy
    your modified file into the root directory of your generated
    project, Overwrite=Yes.
    Regards,
    GEWB

  • How to open a 'Save As' Dialog box in JSP?

    Hi all, i need to export a CSV file. A button is provided to the user to choose the directory to save the file. My problem is how to open a 'Save As' dialog box in JSP?
    Thanks in advance

    Hi,
    Below is my full code to download fiel but still the Save Dialog box still not show..
    <%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"
    %><%@ taglib prefix="asset" uri="futuretense_cs/asset.tld"
    %><%@ taglib prefix="assetset" uri="futuretense_cs/assetset.tld"
    %><%@ taglib prefix="commercecontext" uri="futuretense_cs/commercecontext.tld"
    %><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld"
    %><%@ taglib prefix="listobject" uri="futuretense_cs/listobject.tld"
    %><%@ taglib prefix="render" uri="futuretense_cs/render.tld"
    %><%@ taglib prefix="siteplan" uri="futuretense_cs/siteplan.tld"
    %><%@ taglib prefix="searchstate" uri="futuretense_cs/searchstate.tld"
    %><%@ taglib prefix="locale" uri="futuretense_cs/locale1.tld"
    %><%@ taglib prefix="dateformat" uri="futuretense_cs/dateformat.tld"
    %><%@ taglib prefix="blobservice" uri="futuretense_cs/blobservice.tld"
    %><%@ taglib prefix="satellite" uri="futuretense_cs/satellite.tld"     
    %><%@ taglib prefix="date" uri="futuretense_cs/date.tld"
    %><%@ page import="COM.FutureTense.Interfaces.*,
    COM.FutureTense.Util.ftMessage,
    COM.FutureTense.Util.ftErrors"
    %><%@ page import="COM.FutureTense.Interfaces.*,
    COM.FutureTense.Util.ftMessage,
    COM.FutureTense.Util.ftErrors"
    %>
    <%@ page language="java" contentType="text/html;charset=UTF-8" %>
    <%@ page import="java.io.File" %>
    <%@ page import="java.io.OutputStream" %>
    <%@ page import="java.io.FileInputStream" %>
    <cs:ftcs><%-- france/test_template
    INPUT
    OUTPUT
    --%>
    <%-- Record dependencies for the Template --%>
    <ics:if condition='<%=ics.GetVar("tid")!=null%>'><ics:then><render:logdep cid='<%=ics.GetVar("tid")%>' c="Template"/></ics:then></ics:if>
    <%
    String fileToFind = request.getParameter("file");
    if(fileToFind == null) return;
    File fname = new File(fileToFind);
    System.out.println("Save As: "+fname.getName() );
    if(!fname.exists()) return;
    FileInputStream istr = null;
    response.setContentType("application/octet-stream;charset=ISO-8859-1");
    response.setHeader("Content-Disposition", "attachment; filename=\"" + fname.getName() + "\";");
    try {
    istr = new FileInputStream(fname);
    int curByte=-1;
    while( (curByte=istr.read()) !=-1){
    out.write(curByte);
    out.flush();
    } catch(Exception ex){
    ex.printStackTrace(System.out);
    } finally{
    try {
    if(istr!=null) istr.close();
    } catch(Exception ex){
    System.out.println("Major Error Releasing Streams: "+ex.toString());
    try {
    response.flushBuffer();
    } catch(Exception ex){
    System.out.println("Error flushing the Response: "+ex.toString());
    %>
    </cs:ftcs>
    Can anybody help me with this???
    Thank you in advance.

  • 'About' Dialog Boxes

    Hello Java group!
    I have a great design for an 'About' dialog box, include a JPG image I put together. What is the best process for building an 'About' Dialog Box? Should I use JBuilder widget's factory, or should I hand crank it? Any one have any sample code? What are About Dialog Box's normal set up as ( modal or modalless?).
    Thanks for your help,
    JavaRob

    Does anyone have any code examples to make an awesome
    About box.
    I'd like to include a JPG I created...Image im = ...;
    JLabel l = new JLabel(im);
    Dialog d = ...
    d.getContentPane().setLayout(new BorderLayout());
    d.add(im, BorderLayout.CENTER);
    d.setBounds(...);
    d.setVisible()
    But actually if ur just making an about window you might want to just use JOptionPane; it's probably better for this situation. Anyway, just design your about page, put your graphic on it, and display it.
    What is the standard control method (modal or
    modalless)?IMO it's modal, but both get used quite a bit

  • How can I automatically close a dialog box using Javascript after I click the OK button to submit it?

    How can I automatically close a dialog box using Javascript after I click the OK button to submit it? I don't want to have to X out of the dialog box after I am done.
    Thanks
    Linda

    JS can not interact with open dialogs in any way, unless it's a dialog
    created in JS using the Dialog object.
    On Thu, Jul 24, 2014 at 11:13 PM, lindaeliseruble <[email protected]>

  • How to access the Document Options dialog box to select display properties?

    How to access the Document Options dialog box to select display properties (e.g. smartcut ) for a selected document to
    be viewed in the Workspace.
    regards

    Preferences --> General --> Reset all warnings.
    Mylenium

  • HT3211 new, how do i turn off the dialog box at bottom left that is giving commands for macbook air?

    new, how do i turn off the dialog box at bottom left that is giving commands for macbook air?

    try "command+F5"

  • How to make a simple C program universal from the command line???

    Hi all,
    I've developed widgets that use a simple C program. I had no clue how to make it universal. Apple documentation is all about big projects to be developed inside Xcode and so on, but I don't understand even the introductory remarks...
    As far as I've read, I have to make a binary for PPC and a binary for i386, and then merge it with lipo. Fine. I get my PPC binary from:
    gcc-4.0 prog.c -o prog_ppc -lm -arch ppc -arch ppc64
    Now, it seems that I have to use:
    gcc-4.0 prog.c -o prog_i386 -lm -arch i386
    The latter command didn't work until I added -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/ at the end. With this, it creates a binary file, but with the following message:
    /usr/bin/ld: warning fat file: /usr/lib/system/libmathCommon.A.dylib does not contain an architecture that matches the specified -arch flag: i386 (file ignored)
    and I guess this is quite an issue if I don't have the common math functions, no?...
    Can somebody help me? I googled a lot on this, and found nothing helpful.
    Cédric

    Thanks, it helped me. I googled a bit to build up my Makefile, and this is what I got.
    CC= gcc-4.0
    CFLAGS= -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386
    LDFLAGS= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -lm
    TARGETS= skycalc.fixed.c
    all: $(TARGETS)
    $(CC) $(TARGETS) $(CFLAGS) $(LDFLAGS) -o skycalc_universal
    Thanks again.

  • How to make a simple control value comparison a user event?

    Hey everyone,
    I am trying (with no luck) to figure out how to make an event out of a simple control comparison without having to put the controls inside a while loop to be polled or in the event structure.
    For example; how do I make an event when 'numerical control 1' equals 'numerical control 2'?
    I know that I could have these inside a while loop with the event structure and then wire the comparison to a boolean, then reference the boolean's value change event.  But rather, I would like to create an event for the comparison without the boolean and outside the while loop such that the loop doesn't have to run through the comparison each time, and doesn't have to poll the controls and bool.
    Thanks for the help

    Attached is a simple user event structure that I was thinking about.  Using this you can decouple the control from the comparison, it just works on valye comparisons.  Since it uses the event structure there is no polling and is very CPU friendly.  I have allowedfor the comparison to be linked to the "Value 1:value change event" and the compare button true event.  I hope this is what you were looking at.  Also since it is a user event which is dynamically registered you can register/unregister it at will durring execution making it a flexable event handler.  It might be alittle buggy because I have spent about 3 minutes developing it (particularry when passing values into the event structure there might be a state issue from the data flow so local variables are a better choice)
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA
    Attachments:
    CompareEventvi.vi ‏49 KB

  • How to make a simple Pc Speaker sound output?

    Hello,
    how can a make a simple PC Speaker sound output like the standard beep for errormessages?
    Can anybody help me?
    Thanks,
    Alex

    Use this:Toolkit.getDefaultToolkit().beep(); or this: System.out.print("\0007");
    System.out.flush();

  • How to make a Simple NIO Scalable Server?

    I want to learn NIO for a project, but first want to start out simple. I want to figure out how to send a string across from clients to a server using NIO. I tried looking up stuff, but got caught in the terminology and such. How can I make a simple scalable server (agh tripple S) to send strings across? (like a chat server or something). All I know is I need to use a Selector and some Threaded loops to do stuff.
    I found http://gee.cs.oswego.edu/dl/cpjslides/nio.pdf and tweaked the code to make (what I thought was) a simple server, but I do not know how to make client code or even whether or not my Server code works.
    This is what I have so far:
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.nio.channels.spi.*;
    import java.net.*;
    import java.util.*;
    import static java.lang.System.*;
    public class NIOTest {
    public static void main(String args[]) throws Throwable
    try {
    new Thread(new NIOTestServer()).start();
    } catch(Exception e) {
    e.printStackTrace();       
    class NIOTestServer implements Runnable
    final Selector selector;
    final ServerSocketChannel serverSocket;
    int chatPort=9990;
    public NIOTestServer() throws Exception
    selector=Selector.open();
    serverSocket = ServerSocketChannel.open();
    serverSocket.socket().bind(
    new InetSocketAddress(chatPort));
    serverSocket.configureBlocking(false);
    SelectionKey sk =
    serverSocket.register(selector,
    SelectionKey.OP_ACCEPT);
    sk.attach(new Acceptor());
    public void run()
    try
    while(!Thread.interrupted())
    selector.select(); //Blocks until atleast one I/O event has occured
    Iterator<SelectionKey> it=selector.selectedKeys().iterator();
    while(it.hasNext())
    dispatch(it.next());
    catch(Throwable lol)
    lol.printStackTrace();
    void dispatch(SelectionKey k)
    Runnable r = (Runnable)(k.attachment());
    if (r != null)
    r.run();
    class Acceptor implements Runnable
    { // inner class to accept the event
    public void run()
    try
    SocketChannel c = serverSocket.accept();
    if (c != null)
    new Handler(selector, c);
    catch(IOException ex) {ex.printStackTrace();}
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    import java.nio.channels.spi.*;
    import java.net.*;
    import java.util.*;
    import static java.lang.System.*;
    final class Handler implements Runnable {
    final SocketChannel socket;
    final SelectionKey sk;
    ByteBuffer input = ByteBuffer.allocate(1024);
    ByteBuffer output = ByteBuffer.allocate(1024);
    static final byte READING = 0, SENDING = 1;
    byte state = READING;
    Handler(Selector sel, SocketChannel c) throws IOException
    socket = c; c.configureBlocking(false); //makes it non blocking
    // Optionally try first read now
    sk = socket.register(sel, 0);
    sk.attach(this);
    sk.interestOps(SelectionKey.OP_READ);
    sel.wakeup();
    boolean inputIsComplete()
    return input.hasRemaining();
    boolean outputIsComplete()
    return output.hasRemaining();
    void process()
    CharBuffer buf=input.asCharBuffer();
    buf.flip();
    out.println(buf);
    public void run()
    try {
    if (state == READING) read();
    else if (state == SENDING) send();
    catch (IOException ex) { ex.printStackTrace(); }
    void read() throws IOException
    socket.read(input);
    if (inputIsComplete())
    process();
    state = SENDING;
    // Normally also do first write now
    sk.interestOps(SelectionKey.OP_WRITE);
    void send() throws IOException
    socket.write(output);
    if (outputIsComplete()) sk.cancel();
    }again this is a rough incomplete code test.

    See http://forum.java.sun.com/thread.jspa?forumID=536&threadID=5277053. You can use Telnet as a test client. When you come to write your own client, use java.net, not java.nio.

  • How to make a simple poll

    hi,all
    I would like to make a simple poll in a page of an application,it only concludes two choices: yes and no.when i press the submit button I can see the percentage displayed as pie chart.how to do this ?any suggestions?

    Hi,
    Step 1: Create Table structure and trigger for Sequence. I have not give code to create Sequence. That you can create with DEMO_POLL_SEQ name
    CREATE TABLE "DEMO_POLL"
    (     "ID_PK" NUMBER,
         "RESULT" NUMBER,
         CONSTRAINT "DEMO_POLL_PK" PRIMARY KEY ("ID_PK") ENABLE
    CREATE OR REPLACE TRIGGER "BI_DEMO_POLL"
    before insert on "DEMO_POLL"
    for each row
    begin
    if :NEW."ID_PK" is null then
    select "DEMO_POLL_SEQ".nextval into :NEW."ID_PK" from dual;
    end if;
    end;
    ALTER TRIGGER "BI_DEMO_POLL" ENABLE;
    Step 2:
    Create a new region on apex type Form with table and select "Result" column and make its type Radiogroup and create static lov
    make sure after you create a region go to branch and put clear cache to the same page. so it clears the page item value.
    Step 3:
    Create another region with chart and paste following SQL query
    SELECT NULL LINK,
    REPLACE(REPLACE(RESULT,1,'YES'),0,'NO') LABEL,
    COUNT(RESULT) VALUE
    FROM DEMO_POLL
    GROUP BY RESULT
    ORDER BY RESULT
    Hope this would workout for you.
    And yes you can add me as in your friend list.
    Thanks,
    Jaydip Bosamiya,
    +91 - 76000 23053
    [http://jbosamiya.blogspot.com|http://jbosamiya.blogspot.com]

Maybe you are looking for