Using Swing Dialogs to display substantial info

Hi,
I've just started out working with swing and was looking for some advice on dialogs. Basically, I have a main window that acts as a search facility, displaying a set of results within a JList. My question is, that once I have made a selection from my JList and clicked display, would using a dialog to show information such as personal details along with a textfield containing be a good/bad/possible idea? If so, is there a way to pass the information from the main window to the dialog (i've found the tutorial about doing this from the dialog to the main window)?
Any help would be greatly appreciated,
Thanks!

nickd_101 wrote:
Hi,
I've just started out working with swing and was looking for some advice on dialogs. Basically, I have a main window that acts as a search facility, displaying a set of results within a JList. My question is, that once I have made a selection from my JList and clicked display, would using a dialog to show information such as personal details along with a textfield containing be a good/bad/possible idea? Only you can answer that. I try to keep dialog pop ups to a minimum.
If so, is there a way to pass the information from the main window to the dialog (i've found the tutorial about doing this from the dialog to the main window)?It's wrong to think of passing data from window to window. Let me explain with a story. Suppose an alien came to earth and went to a symphony concert. The alien loves the music and goes back to his planet to describe what he saw so that his comrades can make one of those things: "when the leader's baton went up, the violin bows went up, and when the baton went down, the bows went down. There must be some remote control in the baton sending signals to the bows!"
Do you see his mistake? He completely missed the musical score that both the conductor and the musicians followed. In the same way, a window is not the data -- it presents the data. If I have a window with a (J)Table in it, it displays the data held in a TableModel datastructure. If another part of my program alters that table model, the window repaints and shows the new data.
Therefore, design the data first, that the dialog displays, and design the data first, that the main window displays. passing information just means having communiction between the backing data structures, and common patterns like the Observer Pattern can help here.

Similar Messages

  • Is it possible to display unrelated info without using a subreport?

    Hi,
    I'm trying to create a report that displays 2 different sets of information without using a subreport. 
    The first section of info (the part I'm having trouble with) is simple displaying the info in the db.  It is just the differnt security settings of the system.
    The second section of info is each users info and their personal security settings.  This part is not a problem and displays correctly.
    How can I get the first section to be displayed at the top of the report without it affecting the second section which uses the group header and details portion of the report?  When I try and put it in the Page header it throws off the second section and causes the information in the details to be repeated multiple times.
    Is it possible to do this without a subreport?  I'm using Crystal Reports 2008.
    Thanks Mike
    Edited by: Mike Swift on Aug 21, 2008 5:35 PM

    Mike
    Have you tried selecting the "Select Distinct Records" box in report options.
    Maybe this has nothing to do with your problem but I thought I would throw that out.
    Good luck

  • Just purchased a new iMac and transferred all info from my old iMac. Now when using iPhoto slideshow is displays the pictures in reverse order.

    Just purchased a new iMac and after transferring all info from my old iMac.  Now when using iPhoto slideshow it  displays the pictures in reverse order.

    There's a bug in iPhoto 9.5.1 and Mavericks that affects slideshows played directly from an album.  The slideshow will not play correctly if the photos have been sorted manually.  Any other type of sort, date, rating, keyword or title, will play correctly.
    If you need that manual sort of pictures for your slideshow create the slideshow in iPhoto's slideshow mode.
    OT

  • Display of inclined component using swings

    I have a requirement to display components using swings.
    Now I am using Gridbaglayout manager to display a rectangle component.
    If the component is circle or slightly inclined rectangle where I have given inclined angle (say x degree) and orientation(+/-), how will I display the components?
    For this case, I need a way where I can splitup the tilted object into parts and drag some other components(say JTextField) on to it.
    Using AffineTransform class where the dragging of components over the tilted is not possible.
    Is there any other way to make both tilting and drag of components on to it?

    Multi-post: http://forum.java.sun.com/thread.jspa?threadID=5140630

  • Safari crashes when using the dialog box to import/save files, in facebook under windows 7

    I've encountered the following errors in some PCs, running Safari 5.1.7 in MS-Windows 7 Pro:
    Safari crashes when using the dialog box to import/save files. One doesn't have to actually upload or download any file, the mere invocation of the relevant dialog box brings down all open Safari windows after a couple of seconds.
    Errors displayed in the Event Log are:
    Όνομα ελαττωματικής εφαρμογής Safari.exe, έκδοση 5.34.57.2, χρονική σήμανση 0x4f982b5e
    Όνομα ελαττωματικής λειτουργικής μονάδας CoreGraphics.dll, έκδοση 1.87.0.0, χρονική σήμανση 0x4f9739a0
    Κωδικός εξαίρεσης: 0x40000015
    Μετατόπιση σφάλματος: 0x0013a762
    Αναγνωριστικό ελαττωματικής διεργασίας: 0x17f4
    Χρόνος έναρξης ελαττωματικής εφαρμογής: 0x01cded6b09576023
    Διαδρομή ελαττωματικής εφαρμογής: C:\Program Files\Safari\Safari.exe
    Διαδρομή ελλατωματικής λειτουργικής μονάδας:C:\Program Files\Safari\Apple Application Support\CoreGraphics.dll
    Αναγνωριστικό αναφοράς:ebe64ac9-595e-11e2-a977-0016356671d1
    System
    Provider
    [ Name]
    Application Error
    EventID
    1000
    [ Qualifiers]
    0
    Level
    2
    Task
    100
    Keywords
    0x80000000000000
    TimeCreated
    [ SystemTime]
    2013-01-08T06:45:00.000000000Z
    EventRecordID
    95609
    Channel
    Application
    Computer
    computername
    Security
    EventData
    Safari.exe
    5.34.57.2
    4f982b5e
    CoreGraphics.dll
    1.87.0.0
    4f9739a0
    40000015
    0013a762
    17f4
    01cded6b09576023
    C:\Program Files\Safari\Safari.exe
    C:\Program Files\Safari\Apple Application Support\CoreGraphics.dll
    ebe64ac9-595e-11e2-a977-0016356671d1
    and
    Ελαττωματικός κάδος (bucket) 2970527469, τύπος 1
    Όνομα συμβάντος: APPCRASH
    Απόκριση: Δεν υπάρχει
    Αναγνωριστικό Cab: 0
    Υπογραφή προβλήματος:
    P1: Safari.exe
    P2: 5.34.57.2
    P3: 4f982b5e
    P4: CoreGraphics.dll
    P5: 1.87.0.0
    P6: 4f9739a0
    P7: 40000015
    P8: 0013a762
    P9:
    P10:
    Συνημμένα αρχεία:
    C:\Users\username\AppData\Local\Temp\WER51A.tmp.WERInternalMetadata.xml
    Αυτά τα αρχεία μπορεί να είναι διαθέσιμα εδώ:
    C:\Users\username\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_Saf ari.exe_e273f639ef3d86d52c9d8e15dd2b42dce3e78061_1f86213d
    Σύμβολο ανάλυσης:
    Επανέλεγχος για λύση: 0
    Αναγνωριστικό αναφοράς: ebe64ac9-595e-11e2-a977-0016356671d1
    Κατάσταση αναφοράς: 0
    +
    System
    Provider
    [ Name]
    Windows Error Reporting
    EventID
    1001
    [ Qualifiers]
    0
    Level
    4
    Task
    0
    Keywords
    0x80000000000000
    TimeCreated
    [ SystemTime]
    2013-01-08T06:45:10.000000000Z
    EventRecordID
    95610
    Channel
    Application
    Computer
    computername
    Security
    EventData
    2970527469
    1
    APPCRASH
    Δεν υπάρχει
    0
    Safari.exe
    5.34.57.2
    4f982b5e
    CoreGraphics.dll
    1.87.0.0
    4f9739a0
    40000015
    0013a762
    C:\Users\username\AppData\Local\Temp\WER51A.tmp.WERInternalMetadata.xml
    C:\Users\username\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_Saf ari.exe_e273f639ef3d86d52c9d8e15dd2b42dce3e78061_1f86213d
    0
    ebe64ac9-595e-11e2-a977-0016356671d1
    0
    I have tried in-installing safari but it seems not to help. I have tried installing it to a third, newly installed pc and come to the same result.
    All PCs are fully up-to-date as it regards Microsoft and Apple patches. Any ideas as to why this might happen?

    Still having the same problem. Ever the optimist, I submit the following info.
    Error window screenshot can be found here: https://dl.dropboxusercontent.com/u/22465174/safari/safari_fail_01.JPG
    Enent log entry can be found here: https://dl.dropboxusercontent.com/u/22465174/safari/safari_fail_02.txt
    Version info can be found here: https://dl.dropboxusercontent.com/u/22465174/safari/safari_fail_03.JPG

  • Interactive console using Swing

    Hi,
    I am trying to implement an application administrative tool with interactive console
    (i.e. showing some info to the user and taking user input) using Swing and JDK 1.4.
    Up until now I have done info display part after selecting items from the menu
    (using JTextArea and append() ),
    but now I realized that user input has to be provided and processed.
    I don't see that I can associate an i/o stream with JTextArea. Is there a way to do that ?
    Or is there other Swing widget better suitable for that ?
    Please advise.
    Thank you in advance,
    Oleg.

    You can associate an I/O stream with the textArea using the methods,
    textArea.read(Reader reader) or the method
    textArea.write(Writer writer). These are found in the JTextArea's super class JTextComponent.
    The Reader takes and InputStream as an argument so you can use a FileInputStream to obtain a file from the user. Read more from the API documentation the classes javax.swing.text.JTextComponent and javax.swing.JTextArea.
    ICE

  • Displaying database info in a container

    I am currently working on a JAVA project. I am using MS Access together with JAVA. For my main menu I use a container with Menus and Buttons. I managed to display the info in the database using System.out.println and SQL statements. I would like to display the info in the container when I press the button, with a "back" (to main menu) button at the end of the info.
    How do u I do this??????

    Swing tutorial?

  • Unable to close OK button of JOption dialog when 2 dialogs are displayed.

    1. Run the below sample program
    2. Click the "Click me" button immediately.
    3. two dialogs are displayed, one by mouse click and another by threa.d
    4. Now OK button of both dialogs are not working.
    Expected behaviour:
    the ok button of second dialog shold be active and should close the dialog.
    Sample:
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class test
         public static void main(String arg[])
              MainFrame frm1 = new MainFrame();
              frm1.setVisible(true);
    class MainFrame extends JFrame implements Runnable, ActionListener
         messagedlg errdlg = new messagedlg();
         JButton btn;
         MainFrame()
              btn = new JButton("Click Me");
              JPanel pnl = new JPanel();
              this.getContentPane().add(pnl);
              pnl.setLayout(new FlowLayout());
              pnl.add(btn);
              btn.addActionListener(this);
              setSize(400,400);          
              setLocation(400,200);
              Thread t = new Thread(this);
              t.start();          
         public void run()
              errdlg.showError(this,"mainscreen message");
         public void actionPerformed(ActionEvent ae)
              System.out.println("action start");
    //          SwingUtilities.invokeLater(Thread.currentThread());
              errdlg.showError(this,"mainscreen action message");
              System.out.println("action end");
    class messagedlg
         public static void showError(JFrame frame, String msg)
              try{Thread.sleep(1000);}catch(Exception ex){}
              Object[] options = {"OK"};
              int n = JOptionPane.showOptionDialog(frame,(Object)msg, msg,
                   JOptionPane.OK_OPTION,1,
              null,     //don't use a custom Icon
              options,  //the titles of buttons
              options[0]); //default button title
    }

    Some things you need to know.
    1. NEVER create or modify UI objects outside of the event dispatch thread (EDT) - you are doing this when you pop up the dialog on the new thread
    2. NEVER sleep on the EDT - you are doing this when you respond to the action event
    3. When you make mistake number 1, if you feed the same root frame to two modal dialogs on different threads then, well, on your head be it
    Some reading for you, before you get into more trouble ;o)
    http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

  • Help using find dialog box with JTextArea

    Hi i am using JTextField and getting a file read and then displayed in JTextField. Now i have used a dialog box for finding string within that file displayed in JTextField. I want to make it such that it ignores cases while finding the string and also want to make find next available in Find dialog box.
    My code is: -
    * @author Administrator
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import javax.swing.*;
    public class TextAreaEx extends JPanel implements ActionListener {
    static JFrame fr;
    JButton button1;
    JTextArea tx;
    TextAreaEx()
    super(new BorderLayout());
    tx=new JTextArea();
    FileInputStream fis=null;
    StringBuffer sb=new StringBuffer();
    try{
    fis=new FileInputStream("C:/customers.xml");
    BufferedReader br=new BufferedReader(new InputStreamReader(fis));
    String h="";
    while((h = br.readLine()) != null) {
    sb.append(h + "\n");
    catch(Exception e)
    { e.printStackTrace();}
    tx.setText(sb.toString());
    button1=new JButton("Find");
    button1.addActionListener(this);
    add(button1,BorderLayout.PAGE_START);
    button1.setFocusable(false);
    JScrollPane p1=new JScrollPane(tx);
    add(p1);
    public static void createShow()
    JFrame.setDefaultLookAndFeelDecorated(true);
    fr=new JFrame("My Frame");
    TextAreaEx ob=new TextAreaEx();
    ob.setOpaque(true);
    fr.setContentPane( ob);
    fr.setSize(400,400);
    // fr.pack();
    fr.setVisible(true);
    public static void main(String s[])
    createShow();
    /* (non-Javadoc)
    * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
    public void actionPerformed(ActionEvent e) {
    if(e.getSource()==button1)
    String s=(String)JOptionPane.showInputDialog(fr,"FIND:\n","Find",JOptionPane.INFORMATION_MESSAGE,
    null,null,null);
    System.out.println(s);
    String text=tx.getText();
    int offset=text.indexOf(s);
    System.out.println(offset);
    tx.setFocusable(true );
    tx.select(offset,s.length()+offset );

    Sorry its not JTextField its JTextArea as mentioned in first line of first post.

  • My swing dialogs show up off-screen!

    I am investigating JWS and looking into whether my company would like to adopt it as our new "standard method" for distributing various existing and future in-house utility applications. A primary concern is not needing to rewrite any existing code (just providing a better way to get at it).
    JWS was looking pretty good as I successfully deployed one existing application. But the dialogs are not usable...
    Brief "History" of this App (maybe relevant): It is an application where the first thing user needs to do is open a dialog and enter some info. There are also other dialogs (error, yes/no, etc) Swing modal dialogs have an issue where they do not center w/resp.to the parent as they should. (Reference: I remember hearing many complaints in the Swing Forum) So when I was writing this application I overcame the centering problem by manually calculating the proper (centered) position for the dialog. And it worked beautifully when run from the commandline.
    But now that I run it with JWS, the dialog appears but seems to be centered about (0,0) of my screen, which means that 3/4 of it is not visible. It so happens that I can hit its Cancel button, otherwise I would not be able to do anything to close it. I can't move it (because the title bar is out of sight).
    Is there a workaround for this? Is there a workaround that does not involve changing existing code?
    Thanks,
    /Mel

    Even though one of my primary objectives is to not have to change existing code and have it work as-is from JWS, I did test the setLocationRelativeTo method (the code was calling setLocation method before with calculated relative location).
    The dialogs still show up off the screen.
    Next test is to download the 1.2 beta version (I am hoping that the couple of troubles I am still having will be fixed by using the newer version)....

  • Representating Hierarchical (Parent-Child) relation graphically using Swing

    Hi,
    I have to represent a hierarchical data which is having Parent-Child relation using Swing. I am not able to upload the image overhere, so I am represnting the data in such a way so that one can understand this problem. If anyone knows how to upload image on Sun forum, please let me know it will be great help for me.
    Parent Root - A
    Child of A - B, C, D
    Child of C - E, F, G
    Child of F - H
    Child of D - J, K
    The data needs to be represented in two formats-
    1. Tabular Format
    I am able to represent data in this format using combination of JTree and JTable. The data is getting represented in tabular format and I am able to expand and collapse the parent nodes to see the childs. The tabular data will look like below structure,
    A
    I_B
    I
    I_C
    I I_E
    I I
    I I_F
    | I |_H
    | I
    I I_G
    I
    I_D
    I
    I_J
    I
    I_K
    2. Graphical Format
    This is the other way in which I need to represent the data. The above shown tabular data needs to represented in graphical form. The end result should look like,
    I A I
    ____________________I__________________________
    ___I___ __I__ __I__
    I  B  I I  C   I I  D   I
    ____________________I____________ ______I________
    ___I___ __I__ __I__ __I__ ___I__
    I  E  I I  F   I I  G   I I  J   I I   K    I
    __I___
    I   H   I
    Each box representing alphabates will be a component (like JPanel) which will have details about the item to be displayed. The parent and child should be connected with each other using line. This representation should be created at runtime using the hierarchical data. Also the parent and child relations should be expandable/collapsible as they are in JTree.
    I am not able to find any component or any solution in Swing which can provide me this graphical representation. It will be great help if anyone can help me out in this.
    Thanks in advance.

    Sorry for inconvinience for the data representaion in graphical form. I don't know how this get jumblled. Please try to figure out the tabular/graphical representation using pen and paper as forum is not providing any help to upload an image.
    Sorry again for inconvinience.
    Thanks
    Manoj Rai

  • "Use Adobe Dialog" in open/save screens gone?

    Hi,
    I just upgraded to photoshop cs4 from cs2, and I noticed that a feature which I really, really loved is now gone, and that is the Use Adobe Dialog option in the open/save/save as file browser.
    I don't see any option for this anymore...was it taken out in CS4 or CS3? Or is there an option to enable it that I'm just missing?
    This let me access my favorite folders on the right side of the file browser to easily navigate there, which It's very much missed :(

    To add a location to the left-hand side of the Open and Save dialog boxes in
    Vista it's same as XP, use the group policy editor:
    Go to
    Start > Run > gpedit.msc > User Configuration > Adminstrative Templates >
    Windows Components > Windows Explorer > Common Open File Dialog
    Enable "Items displayed inPlaces Bar"
    type the path to the desired location

  • Variables Display With Info Field Web Item

    Dear Friends,
    We are facing one issue in BI 7 WAD.Can any one please suggest how to achieve this..
    Issue1) In my query, we are having 10 variables and user has enterd 2 variables for his
    selection.After executing the web i need to display those 2 variables only.But in my case i
    am displaying along the two variables with values and remaining 8 variables as blank.I need
    to show those two variables only.For variable display i am using info field web item.Can any one
    throw some light on this.
    Thanks in advance
    Regards
    Madhu

    Hi Madhu,
    It should work. Plz. check your variable settings again.
    Display Static Filter Values = Off (On in case you want to display characteristic restrictions used in your query)
    Display General Text Elements = Off (On in case you want infoprovider information)
    Display Dynamic Filter Values = Off (On in case you want dynamic filters on runtime to be displayed)
    Display Variables = On
    Variable Settings -> Only Variables with Values = On
    --Priya

  • Display linked info in a datatip

    hiya
    I have a chart and in the chart I have a dates on the horizontal axis, and the series is a numeric value.
    I have a renderer to show the value, but i also want to show a linked datafield in the datatips.
    My arraycollection comes from a database table - and the array does include a field called 'Comments' - Each day/value has a Comment which I'd like to show in the datatips
    Here is my Chart:
          <mx:ColumnChart  id="ccBarSystem"
          height="100%" width="100%" 
          showDataTips="true"  
          creationComplete="{PodContentBase.SystemHistory()}"
          dataTipRenderer="dashboard.renderers.ChartRender" x="19" y="10"   showDataTipTargets="true">
          <mx:horizontalAxis>
          <mx:CategoryAxis id="baraxis"
          dataProvider="{PodContentBase._SystemHistory}"
          c ategoryField="Period"  />
          </mx:horizontalAxis>
          <mx:series>
          <mx:ColumnSeries id="barseries"
          dataProvider="{PodContentBase._SystemHistory}" 
          yField="Breach"
               fillFunction="myFillFunction">           
               </mx:ColumnSeries>
          </mx:series>
             </mx:ColumnChart>
    ... and here is the renderer:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="286" height="100" backgroundColor="#241616" backgroundAlpha="0.5">
        <mx:Label x="10" y="10" text="{data.chartItem.yValue}" color="#FFFFFF"/>
        <mx:Label x="10" y="36" text="I WANT MY COMMENTS HERE" color="#FFFFFF"/>   
    </mx:Canvas>
    Any thoughts?  How do I reference the comments field in the renderer?
    cheers
    Andrew

    I managed to display BP's info. using this code:
    see file attached.
    I had to create columns and rows manually, to be able to display all info I need.

  • Desktop like view of files and folders using Swing

    I have an application for upload/download of files from a server. The application is developed using swing and it works perfectly. Currently, the files and folders are displayed in a table view(using jtable) in which the file/ folder will be displayed with icon and extension in each row.
    I need to display these files and folders in a desktop like view. How can I implement this?
    Anees

    Any sample demos or links? Thats why people give you links to the Swing tutorial. The hope is that you will actually look at the Table of Contents and read the tutorial before you post a question.
    Or you could even read the JList API to find a link to the tutorial.

Maybe you are looking for