Multiple Layouts in a single JFrame

Hi,
Is it possible to have multiple layouts in a single JFrame ? What I need to do is that I need to have following components in a SINGLE content pane of a JFrame:-
A) 2 Labels
B) 1 Button
C) 1 4x4 Grid of buttons
Now implement (C) I need to use GridLayout for nide grid like looks like
mContentPane.setLayout(new GridLayout(4,4));
But (A) and (B) obviously shouldn't be part of Grid. So I assume I need to use different layout in the same content pane. Any idea how can I accomplish this ?
Thanks

import java.awt.*;
import javax.swing.*;
class Testing extends JFrame
  public Testing()
    setLocation(400,300);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JPanel main = new JPanel(new BorderLayout());
    JPanel top = new JPanel(new GridLayout(4,4));
    for(int x = 0; x < 16; x++) top.add(new JButton(""+(x+1)));
    JPanel bottom = new JPanel();
    bottom.add(new JLabel("JLabel 1"));
    bottom.add(new JButton("JButton"));
    bottom.add(new JLabel("JLabel 2"));
    main.add(top,BorderLayout.CENTER);
    main.add(bottom,BorderLayout.SOUTH);
    getContentPane().add(main);
    pack();
  public static void main(String[] args){new Testing().setVisible(true);}
}

Similar Messages

  • Urgent ! How to add multiple JToolBars in a single JFrame

    How to implement multiple JToolBars in a single JFrame
    or what is the concept behind floating toolBars.If anybody can help me ,Thisis very urgent

    If you insist on multiple toolbars, use the following code:
    JToolBar tb1 = new JToolBar();
    //add stuff
    JToolBar tb2 = new JToolBar();
    //add stuff
    //put the toolbars on the top of the window
    JPanel toolbars = new JPanel(new BorderLayout());
    toolbars.add(tb1, BorderLayout.NORTH);
    toolbars.add(tb2, BorderLayout.CENTER);
    getContentPane().add(toolbars, BorderLayout.NORTH);Stephen

  • Combining documents with multiple layouts into a single book for pdf export

    I have made a series of documents that feature 3 different layouts, however I would like to connect all these documents into a book and then export 1 layout style from each document into a pdf to form a book. However when I go to the export book as pdf the option to select pages or ranges is greyed out and not clickable for some reason, does anyone know of another way to get around this short of exporting each individual document layout and then merging them as a pdf?

    You need to set up the book to contain precisely what you want to export.
    However, it is basically better to export single documents and merging them later as PDF, regarding colour spaces, page numbering, paragraph styles, page formats etc.

  • Different Headers and footers in case of multiple layouts

    Hi
    I have a requirement in which we have 4 layouts in one concurrent program and the layout to be selected is to be decided by the value of DFF at Invoice header level.
    The 4 layouts have different headers and footers for which i am trying use single template (RTF) or multiple sub templates through Import functionality in XML Publisher but not able to show different headers and footers in one document. Also i have tried with the ?start:body?> and <?end body?> tags but facing issues in displaying different headers and footers in one document as we cant call the same body tags again in one rtf.
    I am able to show different headers/footers data for 4 rtf templates by using import functionality as below but the footers can get shifted to next page if the line level records increases.
    Can someone please help. Want to know if its possible to have this functionality. Thanks in Advance.
    Regards,
    Sanket Z
    Edited by: 847314 on Feb 20, 2013 12:36 AM

    The possibility to have different headers/footers for 4 pages in a single word document. Is this functionality possible?
    I want to generate report in which the Invoice header DFF value will decide which template to pick up from 4 layouts and every template has different header/footer.
    i am trying use single template (RTF) or multiple sub templates through Import functionality
    There are two ways in which i am trying to achieve the solution.
    1. I am adding 4 layouts in a single document.
    We can't use the <?start:body?> and <?end body?> tags in one file multiple times so i cant go with this option.
    2. I am using import functionality in which i am registering one Master template which will call 4 sub templates as per the DFF value and that layout will be populated.
    Code for Master template
    <?if: TRX_TYPE ='INV'?>
    <?import:xdo://LLCUST.LL_TEST_LAYOUT1.en.AU/?><?call-template:SubledgerTemplate?>
    <?end if?>
    <?if: TRX_TYPE ='CM'?>
    <?import:xdo://LLCUST.LL_TEST_LAYOUT2.en.AU/?><?call-template:SubledgerTemplate2?>
    <?end if?>
    Code for Layout1 template(LL_TEST_LAYOUT1)
    <?template:SubledgerTemplate?>
    <?call-template:SubledgerTemplateHeader?>
    TAX INVOICE 1
    Invoice Date:TRX_DATE     
    Invoice No: TRX_NUMBER
    Lines data
    <?template:SubledgerTemplateHeader?> Header1<?end template?>
    <?template:SubledgerTemplateFooter?> Footer1<?end template?>
    <?call-template:SubledgerTemplateFooter?>
    <?end template?>
    But here after importing the RTF we need to call the particular template (<?call-template:SubledgerTemplate?>) which can't be combined with the <?start:body?> and <?end body?> tags. So the Footer will not be static at its place.
    Please suggest or let me know if you need any more info or i can forward you the template etc.
    Regards,
    Sanket

  • What is the best way to create the layout for a single page website in Adobe Muse?

    I was wondering the best way to create the layout for a single page website in Adobe Muse. Does anyone have any suggestions?

    I know how to create a website but will that help me create a single page website? Below I will leave a demo of what I want. I want it to only have one page but multiple sections. What is the easiest way to create a single page website like the demo below?
    Demo Website

  • Multiple layouts per portal

    i would like to create a look and feel like amazon.com(and many other sites) with tabs and each tab having different layout.
    since a portal can only have one layout per group, how can this be done.
    i was thinking of having multiple portals and then switch the user to different portals depending on the tab clicked.
    but that is clumsy with all that session information transfering and admin setup.
    i saw in you api that there is something called a category and that you can get a layout using a category as an argument.
    is there going to be native support for multiple layouts per portal? if so, when, next release?

    Hi Thomas,
    you have several options with the portal standard:
    1.) If the user only has one role assigned at a time you can attach the portal layout to the roles. So depending on the role the user has he sees the respective layout - BUT: how to asign the two roles to the user!? This can only be done by admins and I assume that it is no intended to call the admins every time the user needs the other role?
    2.) The entry to the portal is realized with different urls like http://yourportal.com/VIEW1 and http://yourportal.com/VIEW2.
    VIEW1 and VIEW2 are so called portal aliases and you can attach the different layouts to those aliases.
    BUT: the two roles have nothing to do with the aliases so you still have the problem of role assignment.
    3.) Each person gets two users with each user assigned to one role and one layout assigned to the user or group or role...
    Anyhow: I would ask the people who brought up the idea of two different layouts - WHY?? A portal is ONE single point of entry for EVERY application and information a user needs. So why two different layouts? And what, if five others are coming each bringing their own layouts, too?
    4.) If you really want to have different layouts each time a different top-level navigation point is active you have to program your own portal component. That would fit your needs but is besides standard.
    Hth,
    Michael

  • Can there be multiple ASM instances on single node?

    Hi,
    Can there be multiple ASM instances on single node?
    This one says No : http://www.freelists.org/archives/oracle-l/02-2008/msg00317.html
    And This one says Yes : http://www.databasejournal.com/features/oracle/article.php/3571371
    Thanks in advance.
    Thanks,
    Harsha
    Edited by: user498756 on Sep 11, 2008 2:23 AM

    ...that document doesnt say you cannot have multiple ASM instances on a node. It says "...ASM, +you only need one ASM+ instance for that computer, to manage the two database instances that use ASM."
    The fact that you only need one - and I cannot think of a good reason to have more than one - does not preclude the fact that you do seem to be able to have multiple ASM instances on a single node, each looking after its own set of disks and diskgroups.
    Again - I cannot think of a good reason to do so though!
    -Bob

  • How To Concatenate Column Values from Multiple Rows into a Single Column?

    How do I create a SQL query that will concatenate column values from multiple rows into a single column?
    Last First Code
    Lesand Danny 1
    Lesand Danny 2
    Lesand Danny 3
    Benedi Eric 7
    Benedi Eric 14
    Result should look like:
    Last First Codes
    Lesand Danny 1,2,3
    Benedi Eric 7,14
    Thanks,
    David Johnson

    Starting with Oracle 9i
    select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
    from
    (select last, first, code, row_number() over(partition by last, first order by code) rn
    from a)
    connect by last = prior last and first = prior first and prior rn = rn -1
    start with rn = 1
    group by last, first
    LAST       FIRST      CODES                                                                                                                                                                                                  
    Lesand         Danny          1,2,3
    Benedi         Eric           7,14Regards
    Dmytro

  • Selecting data from Multiple Partitions in a single select stmt.

    Hi all,
    My Database is very large & my tables are partitioned.
    My question is:
    1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
    If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
    (Note:I dont want to make use of Union concept, i want to do it in a single select statement)
    For ex:
    qry1.sql:
    select empno from emp_trans partition (P012000)
    This above query(qry1.sql) will work fine.
    qry2.sql:
    select empno from emp_trans partition (P012000,P022000)
    The above query(qry2.sql) will return will return the following error:
    ORA-00933: SQL command not properly ended
    If anybody has any solution for this, pls mail me immediately.
    Thanks in advance
    bye
    null

    All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
    Thaks for ur reply
    Bye
    null

  • Passing multiple values for a single field in URL to call sap Transaction

    Hi All,
    I need to pass multiple values for a single field to SAP transaction .
    means if i have say a field "Date" which can contain more than one value, <b>but its not a range which has two fields</b> . How is it possible.
    Let me know pls.
    Regards,
    Sirisha.R.S.

    Hi Satyajit,
    I need to call a transaction with multiple values which gives me the report based on those values.
    So I need to pass multiple values for a single parameter.
    I hope u got it.
    Regards,
    Sirisha.R.S.

  • Any way to pass Multiple Values for a single Label in the Parameter?

    I have a Report that Contains 2 Parameters, @Customer & @Area. When trying to set up the Available Values for @Area, I'm having issues using multiple values for one Label, i.e. = "4006" Or "4610"
    One of the Filters in the Report is an Operation number, which is the [OPERATION] field, which is setup as a filter on the Tablix referencing the @Area parameter. 
    PROBLEM: I cannot retrieve any data when trying to use the ‘Or’ Operator here. If I simply put “4006” or “4610” I retrieve data, but when trying to combine it returns no data.
    Example, I need to allow a user to select ‘Chassis Incoming’, which would include data from Operations 4006 & 4610.
    QUESTION:
    Any way to pass Multiple Values for a single Label in the Parameter?
    I realize the typical solution may be to use ‘Multi-Value’ selection, but in this case we want the User to select the Area and the multiple values for Filtering will be automatically determined for them. Otherwise, they are subject to not getting
    it correct.
    I have tried several different ways, such as =”4006” Or “4610”, =(“4006”, “4610”), = In(“4006”, “4610”), etc….
    Note: We are using Report Builder 3.0

    Based on my experience, there's no way to 'intercept' the query that gets passed back to SQL Server, so a Split wouldn't work.
    Try creating either a function or stored procedure using the code below (compliments to
    http://www.dotnetspider.com/resources/4680-Parse-comma-separated-string-SQL.aspx) to parse the string: 
    CREATE FUNCTION dbo.Parse(@Array VARCHAR(1000), @Separator VARCHAR(10))
    RETURNS @ResultTable TABLE (ParseValue VARCHAR(100))AS
    BEGIN
    DECLARE @SeparatorPosition INT
    DECLARE @ArrayValue VARCHAR(1000)
    SET @Array = @Array + @Separator
    WHILE PATINDEX('%' + @Separator + '%' , @Array) <> 0
    BEGIN
    SELECT @SeparatorPosition = PATINDEX('%' + @Separator + '%', @Array)
    SELECT @ArrayValue = LEFT(@Array, @SeparatorPosition - 1)
    INSERT @ResultTable VALUES (CAST(@ArrayValue AS VARCHAR))
    SELECT @Array = STUFF(@Array, 1, @SeparatorPosition, '')
    END
    RETURN
    END
    Once created you can do things like this:
    SELECT * FROM Parse('John,Bill,David,Thomas', ',')
    SELECT * FROM (SELECT 'John' AS TestName union select 'David' AS TestName) AS Main
    WHERE TestName IN (SELECT ParseValue FROM dbo.Parse('John,Bill,David,Thomas', ','))
    This is what your SQL query would probably look like:
    SELECT OperationID, OperationName FROM dbo.Operations
    WHERE AreaID IN (SELECT ParseValue FROM dbo.Parse(@Area, ','))
    You may need to fiddle around with the Separator depending on whether SQL Server inserts a space between the comma and next value.

  • Multiple values in a single cell in report !!

    Hello,
    I want to display multiple values in a single cell, each value separated by comma.
    Ex: I have Employee and Department.
    If a employee works for many departments, all the Department names should be displayed in the same cell in the report.
    Please help !

    Thanks for your replies !
    Is there any other way to achieve this ?
    There is 1 InfoObject which has 2 fields Employee and Department.
    Employee     Department
    001                A
    001                B
    001                C
    In the report there should be 1 row for Employee 001 with all the Departments displayed in the same cell separated by commas.
    Can this be done in the backend through a ABAP code?

  • Multiple Excise Invoice for Single GRPO

    Hello All
    How do we create multiple excise invoices from a single GRPO document.
    Thanks
    Santhosh.K

    Hi
    As per the scenario you mentioned.
    You can't create multiple Excise Invoice against Single GRPO. And as per the law of excise also there is no way to do like this.
    Gate  Pass  made against delivery when some vendor send the item to the client. Time quantity and rate with the duties are mentioned in that.
    similarly when client received the material all the above should be there in the gate pass.
    Ashish Gupte

  • Passing multiple values to a single input parameter

    Hi folks,
    I have a Microstrategy query successfully passing input parameter to a calculation view.  For example I can pass a movement type to a material movements calculation view input parameter.  However if I try to pick more than one movement type the query then fails; 
    Generated SQL that works looks like this;
    select
    sum(a11.TOTALQUANTITY)  WJXBFS1
    from
    "_SYS_BIC"."MyPackage/CA_TEST_PASS_PARAMETER"
    ('PLACEHOLDER' = ('$$MoveType$$', '101')
    a11
    When choosing more than one value in Microstrategy the SQL now fails and looks like this;
    select
    sum(a11.TOTALQUANTITY)  WJXBFS1
    from
    "_SYS_BIC"."MyPackage/CA_TEST_PASS_PARAMETER"
    ('PLACEHOLDER' = ('$$MoveType$$', '101'),
    'PLACEHOLDER' = ('$$MoveType$$', '103'))
    a11
    If I cut and paste the SQL and run directly in HANA studio the error is;
    Could not execute 'select sum(a11.TOTALQUANTITY) WJXBFS1 from "_SYS_BIC"."MyPackage/CA_TEST_PASS_PARAMETER" ...' in 66 ms 361 µs .
    SAP DBTech JDBC: [2048]: column store error: search parameter error:  [2018] A received argument has an invalid value;TABLE/VIEW parameter: ( 'PLACEHOLDER'='$$MoveType$$, 103') not supported
    Is it possible to pass multiple values in a single parameter?  I'm using SP67 for this test.
    Thanks,
    -Patrick

    Ravi, also to answer one of your questions about how this will work in Microstrategy; I just heard back from my Microstrategy developer and he is trying MSTR Freeform SQL query with syntax like this;
    select (sumPAR_TEST.TOTALQUANTITY TOTALQUANTITY
    from "_SYS_BIC"."MyPackage/CA_TEST_PASS_PARAMETER"
    ('PLACEHOLDER' =('$$MoveType$$', '[Movement Type]')) PAR_TEST
    In this example [Movement Type] is the microstrategy prompt.  Unfortunately though it translates like this which is missing extra single quotes around each value;
    select     sum(PAR_TEST.TOTALQUANTITY)  TOTALQUANTITY
    from     "_SYS_BIC"."development.pr1959/CA_TEST_PASS_PARAMETER"
    ('PLACEHOLDER' = ('$$MoveType$$', ''101', '102''))   PAR_TEST
    instead of what we need which is;
    ('PLACEHOLDER' = ('$$MoveType$$', '''101'', ''102'''))   PAR_TEST
    So at this point we are not sure if this will be possible or not.
    -Patrick

  • Multiple users on a single iTunes account

    I am wondering if anyone knows how one will be able to manage multiple users under a single account under the new iOS5. Let me explain. In my house my wife and children download content ( movies, music, app) under my itunes log in so we can decide to watch the movie on my computer or my sons iphone without running into DRM issues. With the automatic syncing of pictures with iCloud I dont want my pictures and hers being mixed up but would like to each have an account. The problem is that I dont want to loose the ability of having the same DRM account for different itunes account. In other words, is there a way to associate a couple of me.com (icloud) emails / accounts to be associated with one itune store purchase account to be able to take advantage of sharing content with in the family. My apologies for the long winded question but I couldn't explain it any other way.:)
    Any insight is greatly appreciated. thanks

    This is from a MobileMe page, so it may not fully apply, but it suggests you'll be able to use separate accounts for iCloud and iTunes.
    http://www.apple.com/mobileme/transition.html
    If I use different accounts for iTunes and MobileMe, can I merge them into a single account and use it with iCloud?
    No. You cannot merge two accounts into one. However, you will be able to move your MobileMe account ([email protected]) to iCloud and, if you choose, you can continue to use a different iTunes account for store purchases and iTunes in the Cloud.

Maybe you are looking for