How to create a sophisticated modal interface returning a value?

Hi,
I am trying to create an interface in Java with sophisticated features to allow a user to select a date value. It has to be modal, that is, when the user clicks on a button, the frame opens, the user selects a value and the value must be retrieved by the calling frame.
JDialog is not OK, because it does not allow to design a sophisticated interface. The customization possibilities of JDialog are not enough for my needs. I need to design a full screen with several tables, combox boxes, etc...
How should I proceed? What type of object should I use / inherit of? What mechanism should I use to retrieve the value selected by the user? I can see (in http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html) that JOptionPane allows to retrieve a value from a modal box. That is exactly what I need, but for a much more sophisticated interface.
Any ideas? Thanks !

I had a serious look at the source of JDialog once,
with a view to doing my own modal stuff. Too much
like hard work.It's really not that hard, as long as you realize that calling setVisible(true) on a modal dialog suspends the current event pump and starts a new one. Once the dialog is set invisible or disposed, the original pump resumes.
So, assuming that you've created a class to manage the dialog, you'd implement a show() method like the following (hasn't been compiled, may contain syntax errors):
// note: this class is responsible for building and displaying
//       a dialog; it doesn't need to inherit from JDialog, and
//       becomes a lot cleaner if you don't inherit
public class MyDialogManager
    private JDialog _myDialog;
    private JTextField _field;
    public MyDialogManager(JFrame owner, String title)
        _myDialog = new JDialog(owner, true, title);
        // build out the dialog here, including text field
    public String showMyDialog()
        _myDialog.setVisible(true);
        // this thread is suspended until the dialog is closed
        return _field.getText();
}

Similar Messages

  • AF TREE:How to Create Method in backing to Return TreeNode Value Selected

    Hi all;
    I use HR Schema
    in ADF Tree example; I created a Special Page for each Emplyee
    so I want to create a new Method called callPage in backing_test1 class to Return FirstName of the Employee at Selecting Employee Node in the Tree
    like my example below :
    <af:tree value="#{bindings.DepartmentsView1.treeModel}" var="node"
    binding="#{backing_test1.tree1}" id="tree1">
    <f:facet name="nodeStamp">
    <h:panelGroup>
    <af:commandLink text="#{node}" partialSubmit="false"
    id="nodeAction1"
    rendered="#{backing_test1.tree1.depth==0}"/>
    <af:commandLink text="#{node}" partialSubmit="false"
    id="nodeAction2"
    action="#{backing_test1.callPage}"
    rendered="#{backing_test1.tree1.depth==1}"
    actionListener="#bindings.setCurrentEmployeesRowWithKey.execute}"/>
    </h:panelGroup>
    </f:facet>
    </af:tree>
    Best Regards

    mail2bansi wrote:
    Please ignore my earlier message . I hit some key mistakenly and it resulted in send messageThere´s an edit button available as long as no one has responded to your message yet.
    if Validation fails on attribute "required=true"
    wouldn't it result in renderResponse phase
    OR
    it still proceeds to render Response phase Uh, validation happens in validations phase (or apply request values phase, when immediate is set to true). After that, if any validation has failed, then it will proceed to the render response phase immediately.
    Also i forgot to mention that we use Ajax4JSF,
    so to clear FacesMessage by ClientId
    if i retrieve ViewRoot it returns AjaxViewRoot thereby it never returns the correct Iterator meaning Iterator.hasNext() is always falseI don't have extensive experience with Ajax4jsf, so I have no idea what to say here.

  • How to create a function that will return a value of a JComboBox PLEASEHELP

    this is my psuedo code,. but it's still not worked. Plase help..
    String vpText;
    String abc = getit();
    String s_alert[] ={"WARNIGNS","CAUTIONS","NOTES"};
    JComboBox CBweapon = new JComboBox();
    for (int i=0;i<s_weapon.length;i++) {
    CBweapon.addItem (s_weapon);
    private String getit(){
    CBweapon.addActionListener(new ActionListener (){
    public void actionPerformed(ActionEvent e){
    wpText = (String)CBweapon.getSelectedItem() ;
    return;
    return wpText;

    Maybe I'm missing some subtle point here, but why not just do this:
    private String getit(){
    return CBweapon.getSelectedItem() ;
    It doesn't make sense to me to have a method which calls actionListener like this, as if you are going to be calling it over and over again. You want to only call actionListener(...) ONE time, and every time an event is triggered, that code will be executed automatically.

  • How crm visit the external website and return the value to crm

    how crm visit the external website and return the value to crm?
    Awen

    Can you elaborate the question? I assume that you are looking for some sort of mechanism to validate a customer's web site?
    Regardless of the scenario, the way to validate or retrieve a value from an external web site is to write a plugin that executes a WebRequest to the external site and reads the response.

  • How to create a method in Interface Controller

    Hi Guys,
            I am working with webdynpro ABAP sample application "Component usage" . There i got a issue like i am not able to create a method in Interface controller. There i am not able to edit anything. Can anybody please let me know how to do that.
                Thanks In Advance
    Regards
    Ravikumar

    Hi Ravi,
              Check This
    If one Web Dynpro component (parent component) needs access to another Web
    Dynpro component (child component) the parent component can declare the use
    of the child component. A specific component usage instance is then created and
    the parent component accesses the functionality of the child component via its
    component interface controller.
    The only parts of a Web Dynpro component that are visible to the user, are the
    interface controller and the interface view(s).
    All Web Dynpro components have only one interface controller. Via the
    interface controller, data, methods, and event handlers can be exposed to
    other components.
    Interface views represent the visual interface of a Web Dynpro component.
    There is a one-to-one relationship between a Window and an interface view.
    Each time a window is defined, a related interface view is automatically
    generated, which makes the window accessible from outside the component.
    The interface view only exposes those inbound and outbound plugs to the
    component user that have the interface property checked. Methods and
    context data of the window are not accessible via the related interface view.
    If the component has no views, there is no need to have Windows. In this
    case, the component will not implement an interface view. Such components
    having no visual interface are known as faceless components.
    Regards
    Sarath

  • How to Create a Procedure/Function to Return more than one value

    How I can write a function/Procedure to which one value is passed and it will return nine values. How I can use these values

    Syed,
    I would use PL_SQL table versus a VARRAY for this purpose as you will have an advantage of joining PL_SQL table if you want to in your SQL statements in the procedure.
    1. At the SQL prompt, create a type using,
       create or replace type myTable as table of VARCHAR2(100);
    2. Pass the table to your procedure as IN OUT parameter,
    Create or replace procedure
    myProc(pvar1 IN Number, passingArray IN OUT myTable) AS
    Begin
        --Fill the array with your logic
        for i in 1..9
        loop
            passingArray.extend;
            passingArray(passingArray.count) := 'what ever';
        end loop; 
    End;
    3. From your Main prog, you call  Myproc
       --declare a variable for type first
       passingArray myTable := myTable();
       begin
       myProc(10, passingArray());
       --At this point, You would be able to Join the PL_SQL table
       --which gives you the power of using SQL with PL_SQL tables
       end; -- end of main program
    4. All done!I have not shown how to use PL_SQL tables in SELECT statements, as that is not the subject here.
    At the end of the story, I would say, if you know the number of arguments that you are going to pass to a procedure, Simply use "that many" IN OUT parameters to finish your task(9 in your case). Although the proc call looks large with this, it is much simpler. The above approach is VERY helpful if YOU DO NOT KNOW THE NUMBER OF ARGUMENTS that you are sending AND receiving From a procedure.
    Thx,
    SriDHAR

  • How to create object for a interface (or) how to use ITextModel Interface

    Hi,
    I am new to vc++ and indesign, i am using windows xp as OS and Indesign CS3 as version, now i want to know how to create an object for the ITextModel Interface (or) how to use the ITextModel interface, for getting the selected text and to manipulate the content, for this i tried myself to the best for more than a week,
    but i not get any solution or any idea to do it, so i post this scrap, if any one knows kindly help me immediately, if u want any more details kindly reply me i am ready to give..
    Regards,
    ram

    Hi, Ram,
    as Jongware already has explained in a previous thread, this is the scripting forum, the SDK forum is next door.
    Besides, your question has already been answered over there in SDK forum - with a reference to an existing example, including documented source. There is also plenty more documentation (780 pages alone in the programming guide) and other working examples.
    The brief response was a perfect match to the vague, general scope of the question. If you want more details, be more specific yourself. Do not just touch such major topics as selection, text, object architecture in one sentence to expect a silver bullet. Instead, stick to one detail, find and read the relevant examples and documentation (did I mention the programming guide?) yourself e.g. using keyword search. Quote your code where you're stuck.
    Being new to both VC++ and InDesign is an explanation but no excuse. IMO, same goes for "using windows xp as OS". All together are bad starting conditions if you intend to write a plugin. Even a seasoned C++ programmer with some years of experience in publishing quirks will easily require months, so don't become impatient after just a week.
    If you need quick results and have a programming background such as a recent Java101, reconsider scripting (this forum). It can bring you amazingly far and you'll learn InDesign through a simplified object model. Same principles apply - there is plenty documentation and a good choice of examples.
    Regards,
    Dirk

  • Help with modal dialog returning a value to the calling page

    Greetings,
    Apex Version: 4.1.0.0.32
    What I am trying to do is to create a modal dialog that is called from a form page. The dialog will present the user with an IR report that will allow the him to select a row and return a value from that row to a field on the calling page. I have it working in Firefox, but I get an error using IE 8. I hope someone can show me why it is not working in IE.
    Here is how I am doing it:
    From the calling page:
    Created a button
         Action: Redirect to URL
         URL Target: javascript:var rc = window.showModalDialog('f?p=&APP_ID.:70:&SESSION.::&DEBUG.:::','','resizable:yes;center:yes;dialogWidth:1000px;dialogHeight:500px;');
    On the called page:
    The called page is an IR report where the query returns this as one of the columns:
    *(Note: I had to put a dot '.' in front of the onclick to get it to show in this thread. It is not there in my real code.)*
    select
    <a href="#" name="z" style="color:blue; text-decoration:underline;" .onclick="javascript:passBack(''' || LOT_NO ||''');">Select</a>' SelectThis
    , column1
    , column2
    from sometablename;This resolves the anchor to:
    <a .onclick="javascript:passBack('232158');"  href="#">Select</a>Here is the Javascript function that is called from the anchor onclick:
    function passBack(passVal1)
      opener.document.getElementById("P75_ITEM1").value = passVal1;
      close();
    }When I run this in Firefox, it works as expected. I click on the button on the parent page. The modal dialog is opened and the IR report is displayed. I click on one of the links in the report and it returns the correct value back to the calling page and closes the modal dialog.
    When I run it in IE8, it fails. I click on the button on the parent page. The modal dialog is opened and the IR report is displayed. I click on one of the links in the report and I get this error: “opener.document is null or not an object”.
    I hope that is clear and that someone can help.
    Thanks
    Larry

    A quick google search determines that window.opener doesn't exists when using window.showModalDialog
    Suggestions range from using window.open instead of window.showModalDialog to using dialogArguments instead of window.opener
    Try the following:
    In the parent page define a getPopupValue() function:
    function getPopupValue(){
       var dr =  window.showModalDialog('f?p=&APP_ID.:70:&SESSION.::&DEBUG.:::','','resizable:yes;center:yes;dialogWidth:1000px;dialogHeight:500px;');
        if ( (dr != undefined) && (dr != '') && (dr != false) ){
         $x("P75_ITEM1").value = dr;
    }Change the button url to call the function:
    javascript:getPopupValue(); On the popup page change the passback function to:
    function passBack(passVal1)
      returnValue = passVal1;
      close();
    }

  • How to check the sql:query is return null value

    I have use :
    <sql:query var="sql1" dataSource="${db}">
    select col_name from table_name
    where a=<c:out value="${row.test1}"/>
    and b='<c:out value="${row.test2}"/>'
    </sql:query>
    So, how can I check this statement return null value which is no record within this table?

    The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
        <sql:query var="books"
          sql="select * from PUBLIC.books where id = ?" >
          <sql:param value="${bookId}" />
        </sql:query>
         <c:if test="${books.rowCount > 0}">
         </c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
    Look for query Tag Result Interface

  • Vision DevMod: How to create large Gaussian filter kernels with integer values like Vision Assistant uses

    Hello,
    in Vision Assistant it is possible to create filter kernel of arbitrary size, like e.g. a 75x75 Gaussian kernel. These kernels feature integer-only elements. I tried to find a function in the Vision Development Module, but have been unable to find something so far. So I still create a Vision Assistant script with such a kernel and export it to a LabVIEW VI in order to abtain such a kernel. Any ideas on how to create such kernels programmatically?

    -You can generate custom kernels in LabVIEW also, but you need to have either string or numerical of that kernels. Without these two, i am not sure of how to do this.
    -Please check this for building kernels.
    http://zone.ni.com/reference/en-XX/help/370281M-01​/imaqvision/imaq_buildkernel/
    -Let's say you are able to programmatically generate kernel string, it will convert to kernel in double format automatically and connect this to convolute vi.
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • How to create a virtual ethernet interface in arch ?

    I have subscribed to a distant VPN service. My computer acts as a VPN client and creates a new interface tun0 each time the VPN is active.
    I want to only route the ip traffic from Transmission through VPN
    I tried to follow the tutorial from here (sorry it's in french) but this tutorial is for debian-based distribs.
    Since the VPN may have a dynamic IP, this tutorial proposes to create a 2nd virtual ethernet interface with a fixed IP adress. iptable is then used to perform NAT translation between the IP of this 2nd virtual ethernet interface and tun0.
    With debian-based distributions, the creation the this new virtual ethernet interface is managed by adding the following lines to the file /etc/network/interfaces :
    # The secondary loopback network interface
    auto lo:1
    iface lo:1 inet static
    address 192.168.0.1
    netmask 255.255.255.255
    I'm not sure how to perform this in arch. I read a lot about the ip command and I think that the solution may be something like that :
    ip tuntap add dev lo1 mode tap
    but I'm not sure and moreover, I don't know how to give a fixed IP adress (i.e. 192.168.0.1) to this new interface
    Any help would be really appreciated.

    It's just a wild guess, but maybe https://wiki.archlinux.org/index.php/Systemd-networkd would help?

  • How to Create a Jdialog class that returns a boolean parameter

    I'm trying to subclass a jdialog to return a boolean to another callling class, the parameter is return when the jdialog closes, how do i declare such a class and what method do i call on the windowclosed event
    I'm new to java so need some code sample, the program is to implement a login and password verification.
    thanks in advance for any assistance.

    Here's another way (a third way is to make the dialog form an inner class)
    in this eg, the password is hard-coded as java
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class MainWindow extends JFrame
      JLabel lbl = new JLabel("JLabel");
      JButton btn = new JButton("JButton");
      boolean loggedInOK = false;
      public MainWindow()
        new FTILogin_Jdia2(this, true).show();
        if(!loggedInOK) System.exit(0);
        buildGUI();
      public void buildGUI()
        setLocation(400,300);
        setSize(150,85);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel jp = new JPanel(new BorderLayout());
        jp.add(lbl,BorderLayout.NORTH);
        jp.add(btn,BorderLayout.SOUTH);
        getContentPane().add(jp);
        setVisible(true);
      public static void main(String[] args){new MainWindow();}
    class FTILogin_Jdia2 extends javax.swing.JDialog implements ActionListener
      JTextField tf = new JTextField(10);
      String password = "java";
      MainWindow mainWindow;
      public FTILogin_Jdia2(MainWindow parent, boolean modal)
        setModal(modal);
        mainWindow = parent;
        initComponents();
      public void initComponents()
        setLocation(400,300);
        getContentPane().setLayout(new BorderLayout());
        JPanel top = new JPanel();
        top.add(new JLabel("Password: "));
        top.add(tf);
        getContentPane().add(top,BorderLayout.NORTH);
        JButton btn = new JButton("OK");
        btn.addActionListener(this);
        getContentPane().add(btn,BorderLayout.SOUTH);
        pack();
      public void actionPerformed(ActionEvent e)
        if(tf.getText().equals(password))
          mainWindow.loggedInOK = true;
        dispose();
    [/code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to create a WAP/HDML interface to Calendar Server?

    I am charged with creating a WAP/WML/HDML interface to an installation of the latest version of iPlanet Calendar Server.
    I need all the information I can get on going about this. To my understanding, I'll need to use WCAP to effect conversions of Calendar's XML via XSLT.
    I'm completely unfamiliar with WCAP.
    Could somebody point me in the right direction?
    Thanks and forum karma,
    FZ

    Sort of. I found this article below that helped me to connect to the remote CF server using MXML. It seems that you have to create a regular project in Flex with Aplication Server Type set to None and connect to CF using the endpoint attribute of the RemoteObject MXML tag or via AS.
    http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/200
    However I found out after getting error using the AS3 code to use the endpoint property that
    mx.rpc.remoting.RemoteObject does not support  the "endpoint" property
    whereas mx.rpc.remoting.mxml.RemoteObject does. See link below
    http://www.mail-archive.com/[email protected]/msg101439.html//www.mail-archive.com/[email protected]/msg101439.html
    So I had to change my AS3 code by adding a new channel to my RemoteObject using a code similar to the one on the link below (Note that this code uses PHP, when I instantiate myRemoteObject, I do so informing that the destination is "ColdFusion" [new RemoteObject("ColdFusion")], so no need to set destination as in the code on the link below
    http://tech.groups.yahoo.com/group/flexcoders/message/120115
    I hope that helps you.

  • How to create a dropdown list to list the values from two different tables?

    Hi,
    I have the following requirement:
    1. I have to create a dropdown list to display all the values from the second column of  a table.
    2. Another dropdown list to display all the values from the second column of another table.
    3. A text box should help me to add the selected values.
    How to get this done in a PDF? Please help.
    Regards,
    Latha

    Is this a LC form? Because Acrobat forms have no concept of tables, just
    individual fields...

  • How to create 2-Axis chart all sharing x values?

    Hello,
    I'm trying to create a 2-Axis chart while preserving x-value sharing, i.e. my four paired data sets should be plotted in Scatter mode, I think. To be more clear, I wish to "combine these two charts below into one", with the second Y-axis on the right for the second chart (whose numbers are obviously higher):
    When I attempt to create a 2-Axis chart via the Insert menu, it changes the x-axis data (mAs) into its own data set, treating it as if it were a dependent variable:
    mAs is the independent variable, upon which the others depend ... I can't figure out how to get Numbers to realize this. Sorry for my rambling tone -- I think I should call it a night, but I wish to get this done. Is my problem clear? I want to create a 2-Axis chart, effectively "combining" those first two scatter charts into one 2-Axis scatter chart. Please help!
    Thank you for your time and assistance.

    ER,
    There is no option for a two-axis Scatter Chart. You can simulate it by scaling your data in such a way that it fits the chart and aligns with a second axis that you manually paste into the Sheet and combine with the chart so that it appears to belong there.
    Only the Scatter Chart plots values vs. values. All the other charts plot values against category names (text).
    Regards,
    Jerry

Maybe you are looking for