Create a swing component derived from two or more Swing components

Hello

I want to make a component reusable swing which will consist of TextField and Jbutton. Click on the the Jbutton a JFileChooser open through which the user can select a directory and the path selected will appear in the TextField.

I googled a lot but couldn't find a good article. All the article shows that stretches from one component Swing, but none no indication how to combine two or more elements in one.

Can someone please send me an article / excerpt/Code tutorial on how I can create a custom Swing component from two or more basic Swing Component.


Thank you
Rohit

Create a subclass of JPanel that contains two widgets from left to right:

public FileChooserCallout extends JPanel {
  private JButton jbFileChooser = new JButton("Browse...");
  private JLabel jlPath = new JLabel(".");

  public FileChooserCallout() {
    ... // set layout
    this.add(jbFileChooser);
    this.add(jlPath);
    jbFileChooser.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        ... // display file chooser, then set new path in label
      }
    });
  }
}

Tags: Java

Similar Questions

  • Create a simple internal network between two or more virtual machines

    Hello guys,.
    I just wanted to ask how to create an internal network between several virtual machines without the host must be a part of.

    I don't want that your network has a NAT, but I want to HOST a part of another network.


    I tried the changes on network cards, but does not work...
    Obviously with VMware Workstation 8

    Yes, your "Virtual Machine settings" - screenshot #1 - Select VMnet2 (for example).  Do this for each customer that you want on this private network, "Guest-only.  Note that you need to configure the network settings on each client within each guest OS; or have a guest to be a server with a dhcp server running that other clients can obtain an IP address configuration of.

  • Why can't create shades of color from scratch (not derived from photo)?

    Hey Adobe-ers,

    I am a long-time Adobe product user, and I used the tools of color from Kuler. It is disconcerting that the mobile versions of this tool (CC color then its subsequent integration with catch CC) do not seem to give you the means to create shades of color from scratch - instead requiring an input image and picking color points.

    It seems obvious that finding inspiring colour combinations of your external environment (and take a picture of them) and derived from the color combination of your imagination, is completely different creative workflow that can the two place to the creation of assets of color. Only the former mode (probably more complex) is supported seems quite bizarre!

    I appreciate really new workflows that adobe have aroused, especially on the use of cloud storage to make simple goods to share between machines - but I'd love to have a place to create shades from scratch (in the way of the CC of color web - app) without the workaround of blocking pipeline creative to have to take a picture at random and then change the colors derived from distraction to possibly meet what I had imagined.

    PS Apologies in advance integrated;  There is a way to do and there is just something missing me, this has been answered, or if this is not the right place for feature requests etc.

    Hello Stephen,

    Thanks for that. No, you do not miss anything. This feature is only in the web version of the application. From time to time, we receive requests, to incorporate it into the app now in the mobile version, you need to capture a theme. Then change it.

    I'll leave a note for the team with your comments.

    And, just to alleviate any concerns... the right place for your comments is everywhere where it is easier for you to leave. Finally, we see (and try to respond to) everything.

    Thanks again.

    Sue.

  • 12.2.4 creating a requisition internal error (error of calculation of the tax: the system cannot determine the geographic information for this place and cannot be derived from a tax jurisdiction).

    Hi all

    I have created a new configuration of client and location. Now try to create IR and get below error.

    ----------------

    Error: The tax calculation: the system cannot determine the geographic information for this place and cannot be derived from a tax jurisdiction. Please contact your system administrator.

    --------------------

    I've made a few changes by looking at Doc-ID 1385936.1 and community discussions.

    Ran "Name geography program SEO" and the journal looks very good. No registration rejected.

    +---------------------------------------------------------------------------+

    From simultaneous program ' geo referencing worker name: 1'

    Start 08/07/15 07:44:56

    Treatment for the Table: HZ_LOCATIONS and run Type: ALL

    Parameters: Country Code: U.S.

    Use code: all THE

    Location Id: NULL: location Id: null

    Start date: NULL: End Date: NULL

    Number of workers: 1

    Total number of records of location of treaties: 7319

    Number of records managed: 7319

    Number of rejected records: 0

    Name of georeferencing process completed successfully

    +---------------------------------------------------------------------------+

    But still, I get the same error during the creation of IR

    Someone help me please by looking in the uploaded screenshots. Incase if any additional necessary information, pls let me know.

    This is related planning tests for this customer, I don't know about this part of the tax.

    Any help is really appreciated. Thanks in advance.

    Akshay

    PS: This is not the sensitive customer data.

    Hello Akshay,

    Can you please follow the note Transaction Workbench error: System cannot determine your location for information
    This location and cannot derive from a tax jurisdiction (Doc ID 438718.1) and see if that helps

  • 'CREATE JAVA' error: ORA-29506: derived from the USING clause invalid query

    Hello

    I created a table with the following attributes:

    name varchar2 (200);
    LOB_DATA blob


    I loaded a java source file in the lob_data blob.

    I then called the SQL:

    create or replace and compile the java source named "RemoteCommand" using blob
    Select lob_data from str_blob_table where name = 'RemoteCommand.java ';

    and I get the error:

    ORA-29506: invalid query from the USING clause
    ORA-00936: lack of expression
    29506 00000 - "query invalid derived from USING clause.
    * Cause: The USING clause does not form a valid query.
    * Action: Correct the USING clause.



    If I simply copy and paste the query part of the USING clause:

    Select lob_data from str_blob_table where name = 'RemoteCommand.java ';

    I get a valid result in SQLDeveloper.


    Any thoughts on what is happening here?

    A few notes:
    1. it is a 8i database.
    2. it works very well on a 9i database, but according to the SQL reference for 8i, it should work as well.

    Thank you
    Brent

    Try to delete "select" in the USING clause, that is to say change the SELECT BLOB SUPPORT... for BLOB to HELP... The original form of the syntax of JAVA to CREATE did not expect the SELECT token must be explicitly provided. Somewhere between 8i and 9i the parser was changed to try the provided text as well as what, with SELECT prefixed. So a CREATE JAVA statement you tried working in 9i but in 8i fails because SELECT would always be added before you try using the clause as a query, resulting a SELECT duplicate token.

  • NIDAQmx to simulate synchronized analog input from two devices of simulations?

    I would test synchronized analog input from two MFDs simulated from the NI6225.  I created two devices of simulated able NI6225 & Automation (M & A) and tagged the first NI6225a and the second NI6225b.   M & I created a RTSI cable configuration and added both simulated devices.  However, when you call NIDAQmx C functions in my test code, I get an error condition indicating that the simulations devices are not synchronized.  Before continuing, I would like firstly to confirm if NIDAQmx is designed to

    simulate synchronized the analog input data of two devices of simulations.  If this isn't the case, then it will explain the error condition that I have encountered in my test code.

    Thank you

    Ian

    Hello John and Jared,

    If I remember well used to support the simulated synchronized devices.   I ran various tests this week, but all fail.  I'm going to order/install a RTSI cable and test with physical devices.

    Thanks for your help.  I close this post.

    Ian

  • How to create a Pool of connections to two different databases in OBIEE

    Hello

    I have a requirement where few reports coming from databases and a few others to another database. I created two pools of connections and added the frame connection details. But when I created the report I get error as below.

    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 17001] Oracle error code: 942, message: ORA-00942: table or view does not exist to the call of the OCIStmtExecute OIC. [nQSError: 17010] Prepare the SQL statement failed. (HY000)

    Now, I would like to see if I can create a pool of connections to two different databases. If so, how that happen.

    Thank you!

    Hi Antonio,.

    Cross database joins are possible, no problem for it. But you do not do so in an object of unique data base in the physical layer using 2 pools of connections connection to the source A and B, then adding objects to A and B children of your unique database.

    You create 2 databases in the physical layer, each with its own connection pool, then you can do your knuckles crossed on the physical schema.

    As a picture is worth a thousand words, take a look:

    The physical diagram uses objects of A and B and define the rules of the join between them, it is a cross-database join. But in the physical layer of the database A and B are 2 separate objects each with its own pool of connections.

  • Copy the data from two rows together in a new line

    Hello everyone.

    I have a question for copying data from two lines together in a new third line.

    See this short example:

    This is the current situation. The lines STATE_1 and STATE_2 contain different information separate.

    In the past data were recorded at random in one of these lines.

    It's the state table:

    ID Cust_id STATE_1 STATE_2 STATE_3
    188Customer is waiting.Call since yesterday.
    211Mr. Smith, no answer.Wait until December
    311Pls Create PO.Old PO has been cancelled
    45No access to the system.

    Now, everything must be recorded in the STATE_3 void, but I also need than the old entries from the past which must also be copied together in STATE_3

    Like this:

    ID Cust_id STATE_1 STATE_2 STATE_3
    188Customer is waiting.Call since yesterday.Customer is waiting. Call since yesterday
    211Mr. Smith, no answer.Wait until December.Mr. Smith, no answer. Wait until December.
    311Pls Create PO.Old PO has been cancelled.Pls create in. old PO was canceled.
    45No access to the system.No access to the system.

    Y at - it an SQL-easy order?

    Thanks for any help.


    What:

    update set state_3 = state_1 State | » '|| state_2;

    ?

  • Creating a Swing JDeveloper 12 application

    I am aware that Swing will not grow anything, but it has beed dropped JDeveloper?

    JDeveloper 11 I could create a new application and add a branch Java Swing/AWT for the gallery application.

    12 there is no Java in Swing/AWT applications more. Is this intentional or just a bug?

    If it's not a bug, can someone peremptorily point me in the right direction for what is the process of creating a Swing application in JD 12 please.

    Well, just try and worked for me.

    1 has created a new desktop application

    2. has created a new project (both of the Wizard)

    3. in the project created a JFrame from galay and got

    package de.hahn.blog.swingtest;

    /**

    *

    Timo * @author

    */

    SerializableAttribute public class BSTJFrame extends javax.swing.JFrame {}

    / * Creates the new BSTJFrame form * /.

    public BSTJFrame() {}

    initComponents();

    }

    / * This method is called in the constructor for

    to initialize the form.

    * ATTENTION: Do NOT change this code. The contents of this method is

    * always regenerated by the form editor.

    */

    @SuppressWarnings ("unchecked")

    private void initComponents() {//GEN-BEGIN:initComponents

    setDefaultCloseOperation (javax.swing.WindowConstants.EXIT_ON_CLOSE);

    layout = new javax.swing.GroupLayout javax.swing.GroupLayout (getContentPane ());

    getContentPane () .setLayout (layout);

    () layout.setHorizontalGroup

    layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)

    .addGap (0, 400, Short.MAX_VALUE)

    );

    () layout.setVerticalGroup

    layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)

    .addGap (0, 300, Short.MAX_VALUE)

    );

    Pack();

    } //GEN-END:initComponents

    /**

    @param args command-line arguments

    */

    Public Shared Sub main (String [] args) {}

    / * Define the look and feel of Nimbus * /.

    //

    / * Si Nimbus (introduced in Java SE 6) is not available, stay with the default appearance.

    For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

    */

    try {}

    {for (javax.swing.UIManager.LookAndFeelInfo info: {javax.swing.UIManager.getInstalledLookAndFeels ())}

    If (Nimbus".equals (info.getName ())) {" "}

    javax.swing.UIManager.setLookAndFeel (info.getClassName ());

    break;

    }

    }

    } catch (ClassNotFoundException ex) {}

    java.util.logging.Logger.getLogger (BSTJFrame.class.getName ()) .log (java.util.logging.Level.SEVERE, null, ex);

    } catch (InstantiationException ex) {}

    java.util.logging.Logger.getLogger (BSTJFrame.class.getName ()) .log (java.util.logging.Level.SEVERE, null, ex);

    } catch (IllegalAccessException ex) {}

    java.util.logging.Logger.getLogger (BSTJFrame.class.getName ()) .log (java.util.logging.Level.SEVERE, null, ex);

    } catch (javax.swing.UnsupportedLookAndFeelException ex) {}

    java.util.logging.Logger.getLogger (BSTJFrame.class.getName ()) .log (java.util.logging.Level.SEVERE, null, ex);

    }

    //

    / * Create and show the form * /.

    java.awt.EventQueue.invokeLater (new Runnable() {}

    public void run() {}

    new BSTJFrame () .setVisible (true);

    }

    });

    }

    Declaration of variables - do not modify / / GEN-BEGIN: variables

    End of variables declaration / / GEN-END: variables

    }

    As you can see there is a main class that provides all the logic necessary to run the application.

    Timo

  • Help to create the MXML component

    I can't understand how to create a simple component in FB4:

    I create a folder in the src folder, called "components".

    I click with the right button on components and select new > MXML component

    In the resulting dialog box, in front of the light, when I pess the search button, all I get is a choice, "spark.components.Group.

    I don't know where to go from there.

    So how, exactly, I created a component based on, say, ComboBox?

    Just type "Combo" in the text field to the light and select ComboBox spark or MX ComboBox control from the drop-down.

    Peter

  • Tracing data from two locations on the block diagram on the same graph

    Hello world

    I'm trying to plot data from two distinct processes on a chart.  These processes occur in the order.

    I have developed several solutions, which none produce the result I want.  What I want is for the data to trace in real time each process is running.

    The two processes are functionally identical - one loop "for".  With each iteration of these loops, data is produced and traced.

    The data are plotted in real time, which means that each reference appears on the chart as soon as it is produced.

    However, I am not able to get the second process data on the same graph in the same way.

    The closest I got combines the graphic with a local variable.  This allows the data for the two processes to draw in real time, but the second set of data replaces the first.

    I have attached a very simple test VI showing my problem.

    Any help with this would be greatly appreciated.

    Thank you

    You can do something like this. Is the second process just a continuation of the first? If so, it becomes even easier and you can just to keep construction of the table in the second loop.

  • 'Create a group' has disappered from Contacts in Windows Mail

    In Windows Mail 'contacts', 'create a group' is missing from the toolbar.  How can I get it back?

    http://www.vista4beginners.com/missing-buttons-from-Windows-contacts-toolbar

    The above information will help you solve the problem.

    http://www.Vistax64.com/tutorials/186477-new-contact-new-contact-group-button-missing.html

    Another tutorial on this subject.

    See you soon.

    Mick Murphy - Microsoft partner

  • Can someone help me create a Bootable ISO DVD from a windows bootable USB ISO file?

    OT: Burning ISO file.

    Can someone help me create a Bootable ISO DVD from a windows bootable USB ISO file?

    I tried to burn the ISO of the DVD file in my system through Image burning software. All copied and verified by himself and said ok.

    But, when I tried to open/run the file, it displays that autorun.dll is not a valid windows image file.  Whereas the same iso file is the opening of the bootable USB key.

    Therefore, I want to copy the file to the USB.iso on DVD.

    It would be simpler just take your. ISO file and use it to burn a DVD using ImgBurn. Don't forget to check the "Hash" value of your. ISO (before creating the DVD) from time to time people do they receive a corrupted download .iso.

    J W Stuart: http://www.pagestart.com

  • Create a custom component which scales

    Hi all

    Maybe I can't think good question, but I can't find anything on it.

    I created a custom component extending UIComponent. Inside I have Bitmap, TextField, form. For now the width is fixed.

    Now, I like my element designed to always keep 100% width of the container that I put in it and based on the width would calculate height. I would like to stay same size (ie. not Bitmap scaling), except that we should adapt width of TextField and form - based on the width of the container parent.

    I have to add some listeners for a parent, or override my methods of a component? I'm totally lost here.

    Thank you!

    Michal

    A custom event in the scrolling pane, the configuration container, and the event through your components of bubble.

    i.e. the scrollpane triggers your custom event to the custom container event that triggers the event to your custom components.

  • Is it possible to create a shuttle component in Oracle ADF, where the available and selected lists are tables of the adf?

    Hi all


    We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.


    Is it possible to create a shuttle component in Oracle ADF, where the available and selected lists are tables of the adf?



    I did a POC sample on it. I can share with you. I can't put in my dropbox because dropbox is blocked in my network. Share your email. I'll send the POC through

Maybe you are looking for

  • the sign "more" to open a new tab disappeared. That's happened?

    the sign "more" to open a new tab disappeared. That's happened? How can this be repaired?

  • removal of app Launchpad?

    Is it possible to get rid of apps in launchpad? There are two that I don't know how they got there that I don't want. I tried to move it to the trash, but it does not work.  El Capitan, 10.11.4 9.1 Safari OSX

  • Please help me error on the ePrint on window8.1 installation process

    I try to install on my Surface3 OS window8.1 ePrint, but finally the ERROR I don't know what is happening and how to solve the problem. Please help me.

  • Trojan horse: J/SBlacoleRefC

    I use Windows XP and recently downloaded an email with the Trojan horse that above. The Trojan horse was only partially deleted with the Microsoft Safety Scanner. Does anyone know how to completely remove the malware. Your really Paul Lamprecht

  • Windows XP insufficient system resources

    Hello Recently my company computer bit is facing error "insufficient system resources exist to complete the requested service" on and outside, since mid Nov 2009. This happen when the user opens a number of excel (with link & macro), Lotus Notes & in