How to define the position of a JLabel in a JPanel?

Could anybody help me for my problem ?
- I added two JLabel into a JPanle using the folowwing code, but the two labels are displayed over each other. JLabel.setBounds() doesn't help.
questionL1 = new JLabel("question1");
questionL1.setBounds(50, 200, 700, 50);
questionL2 = new JLabel("question2");
questionL2.setBounds(50, 250, 700, 50);
graphicPanel = new JPanel();
graphicPanel.setPreferredSize(new Dimension(850, 450));
graphicPanel.setLayout(new BorderLayout());
graphicPanel.setBackground(Color.white);
graphicPanel.add(questionL1);
graphicPanel.add(questionL2);
Thanks in advance

By default components get added to the 'center' of a BorderLayout, so questionL2 replaces questionL1 in the panel.
Here is a link to the Swing tutorial on "Using Layout Managers":
http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html

Similar Messages

  • How to define the position of a JPanel in a JScrollPane?

    I have put a panel into scrollpane. The panel is used to draw some graphs, if the panel enlarge the scrollbar will dispaly. it works well. I use jScrollPane.getViewport().add(jPanelDraw, null) to add panel into the scrollpane. I found the panel is always in the top left coner of the scrollpane, how could i do if i want put the panel in the center of the scrollpane?

    Try something like this:
    BorderLayout bl = new BorderLayout();
    JPanel parent = new JPanel();
    JScrollPane scrollPane = new JScrollPane();
    Then set the layout:
    scrollPane.setLayout(bl); // Our BorderLayout
    To add a component in the center:
    scrollPane.getViewport().add(myJComponent, BorderLayout.Center);
    Then add the scoller to the parent
    parent.add(scrollPane);
    Of course you should also specify a layout for the parent, too...

  • HELP!! How to get the position of active windows in the desktop

    How to get the position of active windows in the desktop

    You mean, active windows other than the program you're running, or windows the program puts there? And a real desktop (like where MyComputer is), or a desktop pane?

  • How to define the date format for this date string

    2006-11-13 00:00:00.0
    How to define the date format in control file for sqlldr. "yyyy-mm-dd hh24:mi:ss" or "yyyy-mm-dd hh24:mi:ss.FF1" does not work
    thanks,

    SQL> desc t
    Name                                      Null?    Type
    TS                                                 TIMESTAMP(6)
    SQL> !cat t.ctl
    load data
    into table t
    truncate
    (ts timestamp "YYYY-MM-DD HH24:MI:SS.FF1")
    SQL> !cat t.dat
    2006-11-13 00:00:00.0
    SQL> !sqlldr userid=scott/tiger control=t.ctl data=t.dat log=t.log
    SQL*Loader: Release 10.2.0.3.0 - Production on Fri Sep 7 11:19:28 2007
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 1
    SQL> select * from t;
    TS
    13-NOV-06 12.00.00.000000 AMBest regards
    Maxim

  • How to change the position of a window created in the script?

    Hello to all
    A window called from another window are the same size. How can change the position of the window relative to the caller call window?

    That is worked, but for abs.coord. How make releative coord.?
    When I include that in my script, window show without elements ! See attachments №2

  • How to define the application parameter 'sap.xss.BaseConfigurationID'

    Hello All,
    I am developing a webdynpro ESS custom self service application. I have completed the development of the DC. But at the end when I am creating the application for the DC, I am not able to figure it out how to define the application parameter 'sap.xss.BaseConfigurationID' for the application. I have defined remaining all the parameters as specified in the following link.
    [http://help.sap.com/erp2005_ehp_03/helpdata/EN/43/3b95dab4ab1800e10000000a1553f6/content.htm]
    Could any one please detail the process to define the parameter 'sap.xss.BaseConfigurationID' ?
    Thanks a lot.
    Regards,
    Seshu.

    Pick a representative file.
    Get info. (Command-i)
    There you will see a place "Open with" where you can select the application for that file.
    Hit the "Change all..." button to do this for all files of this type.
    charlie

  • How to define the default activity for an unbounded task flow?

    In the new "Fusion Developer’s Guide for Oracle Application Development Framework 11g Release 1" documentation at the bottom of page 14-3 it states "An unbounded task flow .... contains a default activity, an activity designated as the first to run in the unbounded task flow, because an unbounded task flow does not have a single point of entry."
    What I can't find is how to define the default activity in an unbounded task flow and where this is recorded? Can we set this via the task flow diagrammer, and which configuration file is it stored?
    I note the first time I run the application with an unbounded task flow a dialog asks me which of the activities in the adfc-config.xml file to make the default, but I can't find where this is recorded.
    Anybody have any ideas?
    Thanks,
    CM.

    Chris,
    In fact this information is nothing that belongs into the taskflow meta data because unbounded taskflow have more than one entry point and there is no notion of default. Its a tools setting (JDeveloper) we had before
    Frank
    Message was edited by:
    Frank Nimphius

  • How to define the margins of a leaf in numbers 3.2

    how to define the margins of a leaf in numbers 3.2
    leaves appear without margin and not when moving from one sheet to another

    Hi Ariel,
    Numbers 3 does not show margins in normal (edit) view. Some help with layout:
    Try Alignment Guides and Rulers as suggested here:
    Print View workarounds
    Use a layout guide:
    Layout Guide for Numbers
    If you previously had Numbers 2.3 (Numbers '09) it now lives in a folder called iWork '09 inside your Applications folder. It works just as well as it used to, and has a proper Print View.
    Regards,
    Ian.

  • How to bring the hyperlink in a JLabel object ?

    How to bring the hyperlink in a JLabel object ?
    I tried the following--> [ this is a sample ]
    JLabel label;
    label=new JLabel("<HTML><A HREF='file://D:/Examination/calc.exe'>Calculator</A></HTML>");Using this JLabel object in an JDialog the label comes perfectly with such a look of the hyperlink
    [ Blue coloured and underlined ] that's all !!
    It doesn't work anything that it should do.
    While all the html tags work perfectly in java then why the hyperlink in label doesn't ?
    If you have an idea then please send me the code.
    Thanks!

    see JXHyperLink at https://swingx.dev.java.net/
    Yeah, I looked at this. I agree with the other guy who said that all this does, presumably, is change the color of the text when the button is getting mousedover. That doesn't solve anything.
    As far as JEditorPane, it has its bad points and ... well, mostly bad points. However that's not really fair. JEditorPane was not designed to be on the level of an IE or FireFox.
    The BEST thing to use JEditor's web browsing facilities on is for creating your own documentation and help pages for software you are developing. Here is a list of some of the things JEditorPane does not come equiped with (as of 1.4 I haven't tried playing with it in 1.5):
    1. Form submission, PUT, and GET
    2. Download status
    3. Caching
    4. Cookies
    5. Plugins (ie Java, Flash, Quicktime)
    6. No javascript.
    Beyond that it is extremely brittle in parsing the HTML, and if the HTML is not totally well formed (and many pages are not) you won't get anything

  • How to define the dynamic navigation between two component in web ui

    Hi All,
    I have a requirement to create a new assignment block in accounts overview screen .
    1.Created new view(Table view) in the BP_HEAD component.
    2.Created new button on the table view toolbar .
    3.If the user clicks the new button it should navigate to interaction log component(BT126H_CALL).
    Please hekp me step 3 how to do .
    I have checked planned activity assignment block in the account but is dynamic navigation.
    Please explain me how to define the dynamic navigation between two components.
    What is window delegate .
    Thanks,
    Venkyy

    Hi ,
    Kindly follow the link , this will be helpful for your issue :
    http://wiki.sdn.sap.com/wiki/display/CRM/CRM-NavigatingtoyourcustomBSP+component

  • How to define the Market Sales KF, in order to receive the desired result

    Hi all,
    I dont know how to define the Market Sales Kefigure, in order to get the following result. Any hint is more than welcome.
    Prd_ID = Product ID
    PS  =  Product Sales
    M_ID = Market ID
    MS  = Market Sales
    MS%  = Market Share ( formula in BEX PS/MS)
    <b>
    Prd_ID;PS;M_ID;MS;MS%</b>
    A00001;10;MRK1;100;10%
    A00002;20;MRK1;100;20%
    <b>SBTOT</b>;30;MRK1;100;30%
    B00001;40;MRK2;200;20%
    B00002;30;MRK2;200;15% 
    <b>SBTOT</b>;70;MRK2;200;35%
    <b>GTOTL</b>;100;MRKX;300;33,3%
    Products A00001 and A00002 compete in the same market. So the individual marketshares should be calculated against the market MRK1(200), e.g. 40/200 and 30/200.
    The totals now, of the A00001 and A00002 products(3040) should be compared against <b>the same market</b> MRK1(200),</b> and <b>not against</b> the MRK1MRK1(200+200).
    Thanks
    Vasso Siagri<b></b><b></b><b></b>

    Maik,
    thank you for your answer, but I am afraid this is not giving the desired results.
    What I want----
    >What am getting
    Prd_ID;PS;M_ID;MS;MS%
    A00001;10;MRK1;100;10%  ---> 10;MRK1;200;5%
    A00002;20;MRK1;100;20%  ---> 20;MRK1;200;10%
    SBTOT;30;MRK1;100;30%   ---> 30;MRK1;200;15%
    B00001;40;MRK2;200;20%  ---> 40;MRK2;400;10%
    B00002;30;MRK2;200;15%  ---> 30;MRK2;400;7,5%
    SBTOT;70;MRK2;200;35%   ---> 70;MRK2;400;17,5%
    GTOTL;100;MRKX;300;33,3% ---> 1000;MRKX;600;16,7%
    Neither resticted KF restricted on Market ID is working for many markets; it is working only if you analyze one market id.
    Any idea? bw idea? What actually I need is aggregation of unique records in terms on market id.

  • How to define the memory leak in stability test

    Hi
    Usually, we run our system with 70% CPU load for 72 hours for stability test (on solaris 10), because some plugin of our system is using mtmalloc, and we use prstat to monitor the memory of each plugin. But because of the complex memory usage of our application, we don't know when the application will use the Max memory, and because of the "mtmalloc", the memory showed by "prstat" will not released but continually increased.
    So fro the test point of view, there is the risk of memory leak, but actually, there may be no memory leak, so my question is how to define the memory leak in such condition.

    kevin wrote:
    Thank you for the input and all the info.
    isn't java heap the same as memory allocated to the java process in my weblogic
    starup script ?The heap is sized by the -Xmx and -Xms parameters you pass on the java
    command-line. The permanent generation is separate.
    >
    let me also download jprobe and try to run it and see what it gives me.
    I'd start by running with -verbose:gc. I'd want to know whether you're
    running out of heap or permgen space.
    -- Rob
    kevin
    Rob Woollen <[email protected]> wrote:
    Unfortunately memory leaks are not fun to track down even with tools.
    I'd first suggest determining whether you're running out of space in
    the
    permanent area (where classes are loaded), or you've exhausted the java
    help space.
    I'd start by adding -verbose:gc. Look at the gc messages right before
    you hit the OutOfMemoryError. If there's plenty of space left, I'd
    suspect you're running out of perm space. Search these newsgroups and
    the web for MaxPermSize, and you should see plenty of info.
    If you're running out of java heap, tools like jprobe and OptimizeIt
    are
    helpful. If you can tell me a little more about your application and
    how you're testing it, I can offer some more tips.
    -- Rob
    kevin wrote:
    Iam new to JAVA and weblogic. I have an application that runs out ofmemory time
    and again.
    please let me know how to pin point this problem and moreover, howto interpret
    or understand that there is a problem. I have downloaded JPROFILE tool,but it
    is very confusing to understand what is goin on in this tool.
    If somebody can let me know how to interpret and understand the memoryleak, that
    will be great !!!
    thank you.

  • How to copy the  positions and their relationships of one org.unit to other

    f there about 20 organization units among which 6 org.units have same positions and same relationships ,i know that we can create one org.units and their relationships among 6 similar org.units and then copy the same position and relationships to other 5 org.units as well instead of individually creating positions and assigning relationships to them  which results in wasting a quality time.but i dont know how to copy it? so please help me by informing me in details how to copy the positions n their relationships to other org units.

    Hi.
    This may sound like a bit of a pain in the *** but why not save the channel strip settings into your own folder then that way you can open them up in other songs and you have some channel strips to try out when you cant find anything else to fit. Plus its fun to open up lots of different audio onto the tracks and see what the effects sound like, Brian Eno style.....
    Hope this helps

  • How to define the size of private folder in Easy DMS?

    Hi,
    I have to ristrict the user to keep  the data in private folder after the maximum limit
    please help me how to define the private folder size in easy DMS.
    after the limit user is not able to keep data in private folder.

    Hi,
    This can be done in SAP Customization / SPRO
    Pl. check :
    Cross-Application Components>Document Management>Control Data>Define Document types
    Here the size limit can be defined.
    Also check : http://scn.sap.com/community/plm/document-management/blog/2014/06/20/how-to-create-dir-and-document-type-in-dms
    Hope this helps
    Regards,
    Remi

  • UJQ_RUN_RSDRI_QUERY: how to define the scope?

    Hi,
    I'm going to use UJQ_RUN_RSDRI_QUERY in a BADI in order to retrieve data from another application. It seems easy to use. But how to define the scope of the retrieved data, i.e. how to define the content of the it_sel parameter.
    thanks for your help,
    Romuald

    This is a selection table which contains the DIMENSION name and the selection options.  Here is how to fill the table. For example, say you wanted to select on only JAN.2012 for a certain account.
      clear ls_sel.
      ls_sel-dimension = 'ACCOUNT'.
      ls_sel-sign = 'I'.
      ls_sel-option = 'EQ'.
      ls_sel-low = 'CE40041000'.
      insert ls_sel into table lt_sel.
    clear ls_sel.
      ls_sel-dimension = 'TIME'.
      ls_sel-sign = 'I'.
      ls_sel-option = 'EQ'.
      ls_sel-low = 'JAN.2012'.
      insert ls_sel into table lt_sel.
    Cheers,
    Rich HEilman

Maybe you are looking for

  • How can i change my data package from 64 to 32 bytes

    I have a serious problem with my internet conecction because the ping is to high and i need to make slower pakage, i mean 64 to 32. Any body could help me please?

  • Storing data from Java Pogram(data in xml format) to SAP R/3

    Hi, I am having a java program which results me an xml. I want to dump the data to SAP R/3. What are the different ways/techniques should i use,to achieve the result? Thanks for your reply, regards, cg

  • PC loud speaker with bt home hub

    We installed the hub some months ago but only yesterday did I try the loud speaker for watching something on iplayer. There was just a very loud hum, moving the hub away helped the hum but still no other sound. Any suggestions and thanks in advance.

  • Help plz cause our prof won't help us

    ok, due to the fact that our professor Java feels himself way to god to give us (my class and I) an answer I post it here. //It's in Dutch but you should figure it out. class Kaart private final String[] color = {"zwarte","witte"}; private final Stri

  • Watermarking for Aperture's web gallery

    I really like Aperture's web gallery feature but would like to make use of the watermark feature for those images. That way, if images are 'borrowed' there is still a reference to my website. Any ideas on how this could be done? I'm guessing the only