Design of swing urgent

hi all..
I am new to swing,can anyone help me in designing the swing application like this
I should have textbox at the top like
label name: textbox
and below the textbox i should have a listbox,like
label:
listbox
and beside the textbox i should have a button
Can any one help me..
Thanks
ajay

I'll assume that you have a JFrame (an application window) to contain your application GUI stuff. In the JFrame, get your content pane and add the components to it using appropriate layout managers:
public class MyAppFrame extends JFrame {
     //-- class members
     JTextField jtf_Text;
     JButton jb_Button;
     JList jl_List;
     MyAppFrame(String title) {
          //-- initialize frame
          super(title);
          setLocation(x,y); //-- enumerate x and y
          setSize(w,h);       //-- enumerate w and h
          //-- add components to frame
          //---- this is the panel into which to place components for the frame
          JPanel contentPane = getContentPane();
          contentPane.setLayout(new BorderLayout());
          //---- label textbox button
          JPanel panel = new JPanel();
          panel.setLayout(new FlowLayout()); //-- fits components, first horizontally, then vertically
          panel.add(new JLabel("Name: "));
          panel.add(jtf_Text = new JTextField(/*Fill in ... */));
          panel.add(jb_Button = new JButton("Button"));
          contentPane.add(panel, BorderLayout.NORTH);
          //---- label
          panel = new JPanel();
          panel.setLayout(new GridLayout(2,1)); //-- 2 rows, 1 column
          panel.add(new JLabel("Label: "));
          panel.add(jl_List = new JList(/*Fill in... */));
          contentPane.add(panel, BorderLayout.CENTER);
          //-- display frame
          setVisible(true);
     public static void main(String[] args) {
          MyAppFrame maf = new MyAppFrame("Application Title");
}Realize that there is no absolute placement control of components, only relative placement precomputed and handled by the layout managers. Therefore, if the JFrame is resized, components may be shifted around depending upon the attributes of the layout manager. This is a good time to look at the Java 2 Swing tutorials or get a good book on Java Swing. "Graphic Java 2: Mastering the JFC, Vol. 2 - Swing" (Sun Microsystems Press) is recommended. Also keep abreast of differences between older Java versions (1.2, 1.3) and the latest (1.4).
Robert Templeton

Similar Messages

  • Application UI Design using Swing or JSP

    I am in the Design phase of my first project. the technology involved is not defined and the team(of 2) is not sure what would be best to use. we got to work on a staging table. mostly updating it. one complete partition(can have as many as 100K rows) has to be displayed in the UI. once it is updated the effected rows need to be inserted/updated to another permanent table, both in Oracle.
    so in short, the GUI should allow sorting and filtering options to the user to work on the staging table records. I am not sure how JSP's will fit into this piture. the network traffic is a big concern here.
    we might go with Swing Jtable. will that be feasible for this kind of UI? also can this be implemented using MVC(can be struts?) or just Model 1 architecture should do?
    I thought of using hibernate for the ORM but the DBA told that the schema is a bit conplex to work with hibernate. so i might be using plain JDBC prepare statements.
    can anyone put some light based on there experience.
    suggestion and views are welcome!

    Triple-post:
    http://forum.java.sun.com/thread.jspa?threadID=5246519
    http://forum.java.sun.com/thread.jspa?threadID=5246518
    http://forum.java.sun.com/thread.jspa?threadID=5246520

  • Design Mode Swing Appl

    I'm creating or generating a swing application.
    Then I do some work and add components or delete some .....
    Sometimes , I don't know when I cant't view the form after that
    in the designer window. There is only a white window.
    null

    Thomas,
    Which version of JDeveloper are you using?
    After you add/delete components, you might need to rebuild your
    project before viewing the Design tab again.
    When you say 'do some work and add components or delete some', is
    this in the same project as your swing application? In the same
    file (source tab)?
    Laura
    Thomas (guest) wrote:
    : I'm creating or generating a swing application.
    : Then I do some work and add components or delete some .....
    : Sometimes , I don't know when I cant't view the form after that
    : in the designer window. There is only a white window.
    null

  • Architecture for Design in Swing

    Hi,
    I am developing a standalone application using Swing.
    It is recommended to use GridBag Layout for the design.
    Grid Bag Constraints are having 11 parameters to be set to all the components.
    which will increase the lines of code and maintainability issues may raise.
    I request, to suggest an architecture for the same.
    A sample would be helpful to us to build on.
    Thanks in advance.
    Nagalakshmi

    Having started my first Java project (and first OO for that matter) at the beginning of the year, I was tasked to redesign our current GUI (non-Java), which is almost 100 frames. After reading up on different layout managers, the consensus from the books/tutorials that I read was that GridBag was the most complex, but also the most powerful. I tried a few others, but their limitations were obvious to me in short time. Ever since I turned to GridBag, I haven't looked back.
    I suggest you do not use GridBagLayout.
    It's inconvenient.I couldn't disagree more. What's inconvenient about total control?
    You can use BorderLayout, GirdLayout and FlowLayout to
    layout component in many case.True, but I can use GridBag in all cases.
    Grid Bag Constraints are having 11 parameters to be set to all the components.
    which will increase the lines of code and maintainability issues may raise.Very true if you let a GUI builder do it for you. I prefer to whiteboard the layout of my components first, then hand-code it. I also wrote some convenience methods to help me with the constraints and sizing and such, so that I don't have 12 lines of code each time that I want to add a single component, I just have one method call.
    Since I'm running 1.4, I haven't looked at SpringLayout yet (1.5 only, I believe). If DrLaszlo is endorsing it, then that's enough for me to know that I should at least check it out.
    Good luck.

  • Structres and cells in Bex query designer?? urgent plz

    hi experts,
    could you please give me the useful info. regarding structres and cells with the examples.
    thanks in advance
    regards
    vadlamudi

    1. In the Query Designer, choose Cells (open) from the toolbar or use the menu option under View to reach the Cell Editor functions.
    2. You can now use four different functions.
    New Selection
    u2022 Select a cell in the Cells dialog box, and use the right mouse
    button to choose New Selection.
    u2022 Define the required selection.
    u2022 Enter a description for the selection and choose OK.
    New Formula
    u2022 Select a cell in the Cell dialog box, and use the right mouse button to choose New Formula.
    u2022 Define the required formula. Enter a description for the formula
    and choose OK.
    New Cell Reference
    Each cell that you define can be reused in formulas. If you want to reuse the value of the implicit generic cell definition that automatically occurs at the intersection of two structure parts of a query, select this cell in the Cell Definition dialog box, and choose New Cell Reference using the right mouse button. The description arising from the two structure parts
    automatically appears in the cell. You can now refer to this cell.
    Additional cells
    Click on the cell adjacent to the Help Cells and choose the required option if you need additional cells for auxiliary selections or formulas which are not already included in the query structure you have defined from the construction of rows and columns.
    Ashok

  • Swings Urgent Requirement, Please Help me

    Hi ,
    I have a requirement like when a file dialog is displayed, I have to select only directories/folders. Now with using JFileChoser , I am able to choose file . Is there any possibility to choose only directories without file dialog or atleast by using filedialog?. If some solution Please help me as this is urgent requirement.
    Thanks and Regards,
    Rajeev L.

    JFileChooser has an instance method public void setFileSelectionMode(int mode)
    call when initialising the file chooser.
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );

  • Print a form's content that is designed by swings component?

    ive 2 questions to ask which ive asked one of them tow days before but i havent got a usefull solution for it!!!
    1)
    im trying to print a simple document by these codes:
        try
                FileInputStream textStream;
                textStream = new FileInputStream(
                        System.getProperty("user.home")+"/Desktop/errors.txt");
                if (textStream == null)
                        System.exit(0);
                DocFlavor flavor = DocFlavor.INPUT_STREAM.TEXT_HTML_US_ASCII;
                Doc mydoc = new SimpleDoc(textStream, flavor,null);
                PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
                aset.add(new Copies(2));
                PrintService[] services = PrintServiceLookup.lookupPrintServices(
                                flavor, aset);
                System.out.println(services.length);
                if (services.length > 0)
                        DocPrintJob job = services[0].createPrintJob();
                        job.print(mydoc, aset);
        } catch (Exception ee)
                System.err.println(ee.getMessage());
        }but it doesnt work at all !!!the line that has been bolded return 0 that it means it couldnt find ma printer???my printer is HP 1320 that is connected to ma computer by USB port?
    2)
    my goal after above problem is:i have a swing form that has some information from a user that is loaded from DB...
    how can i print this form by its components and information on the paper?
    thanks a lot MR/MRS ................
    zokho;)

    Why don't you use JDK 6's capability to print directly. Please refer to this link.
    http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/
    Shouldn't
    System.getProperty("user.home")+"/Desktop/errors.txt")
    actually be
    System.getProperty("user.home")+"\\Desktop\\errors.txt")

  • Adobe designer 7.0  URGENT submit by e-mail  change text

    Using the Adobe prof 7.0 - form designer - I've made a document with a submit by e-mail button. When clicking this button it generates the wanted xml document and attaches this to in a message in outlook.
    My question:
    1.) How do I alter the automatically generated accompanying text
    (in my case in dutch ' Het bijgevoegde bestand bevat gegevens die waren ingevoerd in een formulier. Het is niet het formulier zelf.De ontvanger van dit gegevensbestand moet dit lokaal opslaan onder een unieke naam. In Adobe Acrobat Professional 7 of hoger ...') ?
    This is a service message and I'd like our customers to see a text more like "thank you for filling in this form - this works just click 'send message' ...."
    2.) How do I alter the generated xml, eg remove <!--
    Als u een formulier hebt ingevuld:
    Dit bestand bevat gegevens die waren ingevoerd in een formulier.
    Het is niet het formulier zelf.
    .... -->
    Can anybody help? This needs to be solved in the next 8 hours - Aargh!
    Kind regards,
    L. Meynen

    Thank you, expert, for your quick reply.
    Described problem got solved: we noticed later that the extra text only appears for users using Adobe professional 7.0, 'normal' users with adobe 8.0 reader don't get the extra text, so that is ok for us.

  • Design von Swing like JarBuilder

    Hi all, do anyone know the programm JarBuilder. It haves a very well design. How can I make the Design of my application like the JarBuilder�s design.
    How can i edit the design for example of the Toolbar from an application and make it with schadows or anythink.
    Thanks verry well
    Nikolay

    Hi all, do anyone know the programm JarBuilder. It
    haves a very well design. How can I make the Design of
    my application like the JarBuilder�s design.
    How can i edit the design for example of the Toolbar
    from an application and make it with schadows or
    anythink.
    Thanks verry well
    NikolayHello,
    you need the [url http://www.incors.de/produkte.php3]Kunststoff Look&Feel.
    Regards,
    Tim

  • WAAS Design Help Needed - URGENT!

    Hi,
    I am currently designing and implementing a WAAS solution for s client in their Data Center. It is deployment of a single Accelerator and one CM.
    It has been decided that the WAAS accelerator (7341) will have its two NICs connected to two of their core switches (both 6500). The two core switches have a Layer 3 Etherchannel link between them and are running OSPF for network convergence (i.e. Layer 2 connectivity is not used).
    I am facing a problem in the design, since I know that the Active/Standby configuration for the accelerator would require a redundant gateway via HSRP (at least) but this is not possible in a routed environment in the core switches. Furthermore, I am to run WCCPv2 for redirection.
    Therefore, I am confused as to how to proceed in such a case considering that I can only configure one default gateway on the accelerator when I need high availability on two different subnets.
    Please assist at your earliest.
    Thanks.

    Amir,
       Considering your question below
    "I am facing a problem in the design, since I know that the Active/Standby configuration for the accelerator would require a redundant gateway via HSRP (at least) but this is not possible in a routed environment in the core switches. Furthermore, I am to run WCCPv2 for redirection."
    Do WAE is configured for Standby interface and is this your Primary Interface as well? If answer is yes then see below
    You will need a common VLAN for WAAS on both 65K swicthes in order for Active / Standby interface to work properly.
    1: When using OSPF make sure your tcp flows has both ingress and egress flows transit from same switch
    2: Use Generic GRE method for Egress under WAAS intercept configuration.
    Since you are running WCCP each swicth will be able to redirect its TCP traffic via GRE Tunnel to WAAS and WAAS will send the packet back to the same swicth. This will ensure packet path is not modified when WAAS / WCCP is introduced.
    Also make sure that you do not have any WCCP redirect on Layer 3 connection between 2 swicthes. Let me know if this helps.
    Ahsan Khan

  • How to Close Multi Child Windows : ADF Swings - Urgent

    Hi,
    I have developed a application having Login , Filter , Master , Details , and Detail Screen . In the Filter Screen If i click on button called " CLOSE CHILD WINDOW " , all the screens ( Master , Details And Summary ) to be closed .
    Can u please let me know how can i do this .
    For even Child Window to open from parent Window , i have implemented same piece of code from adfwhitepapers docs.
    private void jButton1_actionPerformed(ActionEvent e) {
    SalesOrderDetails salesOrderDetails = new SalesOrderDetails();
    salesOrderDetails.setBindingContainer(createDetailBinding(salesOrderDetails));
    DCIteratorBinding iterBinding = getPanelBinding().findIteratorBinding("SalesOrderEOVO1Iterator");
    RowSetIterator detailAccessor = iterBinding.getRowSetIterator();
    salesOrderDetails.getPanelBinding().findIteratorBinding("SalesOrderEOVO1Iterator").bindRowSetIterator(detailAccessor, false);
    salesOrderDetails.setVisible(true);
    int count = 0;
    private DCBindingContainer createDetailBinding(SalesOrderDetails salesOrderDetails)
    String detailBCName = "SalesOrderDetailsPageDef"+count;
    if (panelBinding.getBindingContext().get(detailBCName) == null)
    DCBindingContainerDef bcdef = DCBindingContainerDef.findDefObject("oracle.eaton.userinterface.pageDefs.SalesOrderDetailsPageDef");
    DCBindingContainer bc = bcdef.createBindingContainer(panelBinding.getBindingContext());
    bc.setName(detailBCName);
    panelBinding.getBindingContext().put(detailBCName, bc);
    ++count;
    return bc;
    return null;
    Regards
    Bhanu Prakash

    I have referred this link for the consecutive opening and closing screen for the linkage between the two screen like 1&2 , 2&3 , 3&4 , that was my understanding if so not can u please explain me . My requirement is to close all the child windows from the Super Parent Window , i.e. on Select of close button in Filter Screen all the screen ( Master,Detail,Summary ) should be disposed or close ,
    I have generated 4 screens :::
    1. Filter Screen
    2. Master Screen
    3. Detail Screen
    4. Summary Screen
    Can any one help me by giving there solution to sort out this issue . Its very Urgent .
    Regards
    Bhanu Prakash

  • Finance Trading Swing Urgent Positions

    Hi Folks ,
    I happen to be an ex technical developer and am currently working with 3 of major investment banks and inter broker dealers in NY, NJ.
    Some of the hiring managers are hurting big time and looking to speak to jave Swing expert who have financial trading experience or are looking to get into investment banks.
    Please do send me an email at [email protected] to talk further about my clients and their opportunity.
    Key Words : Java, Swing, Real time, multithreading, trading,finance.
    Please feel free to refer anyone you know, we have a strong referral fee structure.
    Thank You,
    Nick
    [email protected]

    Hi Folks ,
    I happen to be an ex technical developer and am currently working with 3 of major investment banks and inter broker dealers in NY, NJ.
    Some of the hiring managers are hurting big time and looking to speak to jave Swing expert who have financial trading experience or are looking to get into investment banks.
    Please do send me an email at [email protected] to talk further about my clients and their opportunity.
    Key Words : Java, Swing, Real time, multithreading, trading,finance.
    Please feel free to refer anyone you know, we have a strong referral fee structure.
    Thank You,
    Nick
    [email protected]

  • Lockbox design doucment - Very urgent please

    Hi !
    Could someone please send me the design document for lockbox configuration. I have to do the lockbox project with in one month for which I have to submit the design doucment by this weekend. I have no idea of this design document.
    Help will be really appreciated and rewarded.
    Thanks a lot in advance

    What i meant was instead of view page in the URL u can give controller.do which is rendering that view
    OnClientClick = onClientClick="javascript:window.showModalDialog('controller.do','GT','dialogWidth=604px;dialogHeight=377px;center=yes;help=no;scroll=no;status=no;');"
    but i guess this is required to be called from another page or view.
    regards
    rajeev

  • Designing Swing Applications - Layout

    When using JDeveloper to design a Swing application (not ADF Swing) is it possible to;
    1. when viewing the design of a frame for example, is it possible to display a grid so that you can align components correctly?
    2. when you have selected a layout from the properties editor for the panel you are working on, is it possible to display the grid lines of that layout so that you can clearly see what component/group of components are in each of the areas? Similar to when using Macromedia Dreamweaver and dragging components into a table where you can see which cell each component is currently within...
    3. add additional swing layouts to JDeveloper so that they can be used within the properties editor? i.e. tablelayout or design grid layout for example
    4. has anyone come across any guides/tutorials on using JDeveloper to design Swing based applications visually by dragging and dropping components from the palette?
    Thanks in advance for your help/advice
    David

    David - I had alot of those questions when I developed a Swing application. While I won't answer your question directly, take a look at this demo.
    http://www.oracle.com/technology/products/jdev/tips/muench/screencasts/simplejgoodies/binding_demo.html?_template=/ocom/ocom_item_templates/print
    The FormLayout as part of JGoodies managed makes the layout a lot easier - still a few things you have to get used to but it managed most of the hard stuff for your.
    Let me know if that helps
    Regards
    Grant

  • Visual Swing Designer (for Eclipse)

    Hi there
    We've developed a client software with JBuilder. Now we want to move
    the whole project to eclipse.
    Is there a good plugin for Eclipse to design Swing applications? I haven't found one so far.
    JBuilder has a Swing designer, and it is very usable for us. Eclipse
    hasen't such a Swing designer...
    It could also be a external tool, to design our Swing Panels. But it
    has to be a visual Designer tool for swing, like the one for VisualStudio and co.
    Does anybody know a good Designer WORKING Tool? Maybee as plugin for eclipse?
    Greetings,
    Adrian

    Hi,
    It would be good to have some feedback about Swing GUI builders for Eclipse, are they usable and good. I heard much good things on Eclipse and am curious to try (althought NetBeans are still very good for me), but I develop Swing application and porting to SWT is unacceptable for me (it is not so advanced as Swing and I need many features that are in Swing only).

Maybe you are looking for

  • Coloured text cycle

    Hi there, Need some help in creating text (individual letters) cycling through different colours. For example each letter cycling through say 6 colours, each letter a different colour to the next. Trying to create a behavior to do this but without mu

  • How to smooth edges?

    Hi all, I am in hopes that someone can tell me how to smooth the edges of the numbers in the attached image? Thanks for any advice, hints. etc.

  • Streaming photos is a MUST HAVE for SW Version 1.1

    The Apple TV I just installed is a thing of beauty in its ease of setup and use. But as of now, I have found one gaping hole in its capabilities: It can't STREAM photos. This means that, while you can view movies and listen to music from six computer

  • TS1368 I am using iPad 3 and I can not connect to iTunes Store,if I want to download it say you can not connect

    My question has not be answers yet,I am using iPad 3 and I can not get to connect to iTunes Store to download anything.

  • Undo_Retention

    Hi I had a Scenario : Undo_Management = AUTO Undo_Retention = 10 Undo Tablespace Size = 1MB i perform "insert into emp select * from emp" till the rows are around 14000; Now when i "insert into emp select * from emp", throws Unable to Extend Segment