Need help displaying shapes inside jframe

Hi, Im trying to display shapes inside a jframe but I cant work out why I am only getting one shape to show up, any suggestions on how I can get 2 or more shapes showing on the same jframe?, the code bellow shows what ive done so far. thank you
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
public class Draw extends JFrame
     public void paint(Graphics g)
         Graphics2D g2 = (Graphics2D)g;
         super.paint(g2);
         Rectangle2D.Double mySquare = new Rectangle2D.Double(150, 150, 50, 50);
         g2.setColor(Color.green);
         g2.fill(mySquare);
    public void paint(Graphics g)
        Graphics2D g3  = (Graphics2D)g;
        super.paint(g3);
        Rectangle2D.Double mySquare2 = new Rectangle2D.Double(100, 100, 60, 60);
        g3.setColor(Color.green);
        g3.fill(mySquare2);
     public static void main(String[] args)
          Draw p = new Draw();
          p.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          p.setSize(500,500);
          p.setVisible(true);
}

extremely sorry
this is the code which is compileable, accidently showed a previous version
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
public class Draw extends JFrame
     public void paint(Graphics g)
         Graphics2D g2 = (Graphics2D)g;
         super.paint(g2);
         Rectangle2D.Double mySquare = new Rectangle2D.Double(150, 150, 50, 50);
         g2.setColor(Color.green);
         g2.fill(mySquare);
        Graphics2D g3  = (Graphics2D)g;
        super.paint(g3);
        Rectangle2D.Double mySquare2 = new Rectangle2D.Double(100, 100, 60, 60);
        g3.setColor(Color.green);
        g3.fill(mySquare2);
     public static void main(String[] args)
          Draw p = new Draw();
          p.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          p.setSize(500,500);
          p.setVisible(true);
}Edited by: jakal121 on Nov 30, 2009 12:02 PM

Similar Messages

  • Need help in drawing inside the Oval and outside it

    I need help in something
    I have an array and I want the numbers to be around the oval and I have part of the array and I want to fill part of the oval
    and when I want to put a number I would like a line from the center to point at the number
    I know its hard to explain so I have picture maybe you will know hwo its work
    http://img265.imageshack.us/i/55788522.jpg/
    I have almost everything done the oval and all the code but I have no clue how to do what I explained

    import static java.lang.Math.*;
    import java.awt.*;
    import javax.swing.*;
    @SuppressWarnings("serial") public class Trefoil extends JComponent {
            setPreferredSize(new Dimension(400, 400));
        @Override protected void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D) g.create();
            int w = getWidth(), h = getHeight();
            g2.setColor(getBackground());
            g2.fillRect(0, 0, w, h);
            g2.setColor(getForeground());
            g2.translate(w/2, h/2);
            g2.setRenderingHint(
                RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
            int rays = 100;
            for(int i=0; i<rays; ++i) {
                double angle = i*(2 * PI)/rays;
                double flange = cos(1.5* angle - PI/4);
                int r = (int)(190 * flange * flange);
                int x = (int)(r* cos(angle));
                int y = (int)(r* sin(angle));
                g2.drawLine(0, 0, x, y);
            g2.dispose();
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    JFrame f = new JFrame("Trefoil");
                    f.add(new Trefoil());
                    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • Hi, need help, displaying text in crystal report

    Post Author: decentsimple
    CA Forum: Crystal Reports
    CR8.5 help, displaying included or not included  i
    have a win app that calls the report, during rendering of report, the
    win app will first create a temp table that holds all the fields for
    the report, then the report is accessing that temptable. i want my report to display &#91;not&#93; included text for a field that contains the right value..here is the tricky part, the field is not in the temp table..is there a way for the crystal report to read the value of that certain field that is not in the temptable..so far.. i have a parameter     3 parameters, the value can be B/P/U          ?B / ?P /?U each parameter have its own formula:  @havefieldvalue        if {?B} = "T" then            ""  else  "Not" same for the rest..if the report generated have B     then the report should display B - includedsame for the rest.. 

    you can always use an array if there's no pattern to your positions:
    var positionA:Array=[ [100,20], [2,222], [55,2], [201,111], [78,23] ];
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import com.adobe.serialization.json.JSON;
    var loader:URLLoader = new URLLoader(new URLRequest("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=ScottMitchell"));
    loader.addEventListener(Event.COMPLETE, loadComplete);
    function loadComplete(e:Event):void {
        processData(e.target.data);
    function processData(data:String):void {
        var tweets:Array = JSON.decode(data) as Array;
    for(var i:int=0;i<5;i++){
    var tf:TextField=new TextField();
    addChild(tf);
    tf.multiline=true;
    tf.width=300;
    tf.text =   tweets[i].text;
    tf.autoSize="left";
    tf.x=positionA[i][0];
    tf.y=positionA[i][1];
    nextY+=tf.height;

  • Need help displaying layouts

    I'm new to Java swing but have read the tutorials.. maybe I'm just not very fast learner. However I need to display some things, but having problems doing so in JavaSwing.
    Basically my display needs to be like this
    Name: <textfield>
    Address: <textfield>
    Are you married? <yes option> <no Option>
    My problem is the yes and no options. If I make the Grid 3 columns then the textfields are displayed in the 2nd column rather than spreading across the 2nd and 3rd columns. The other thing is I want all the Labels (name, address, are you married) to be on one left column while the other items are in another column. I guess this is kinda like a nest panel or something? I'm not really sure. Are there examples of how to do something like this? I learn best by examples.

    Swinging :) is kinda like a top-down * bottom-up approach (mix of both). So you gotta think from the top and implement from the bottom. (We can call this design-down, implement-up neh? :)
    1. Essentially, you need three rows, with two columns.
    2. First column contains three rows of the same size.
    3. Second column contains three rows too.
    a. First and second rows of second column span the entire row.
    c. Last row is split into two.
    Make a label panel for holding the labels such as "Name" and "Address". Make this a grid panel of 3 rows and 1 column. Call this LPANEL
    Now make another panel, this also with three rows and one column using a grid layout. Call this the FPANEL.
    Now, add a textfield to the first two rows.
    For the last, create a new panel with a grid layout with size 1x2 (1 row, 2 columns). Call this the OPANEL. Add it to the FPANEL last. So, now you have two panels. How do you ensure they line up?
    Set the same margin sizes (and insets) for all components/grid layouts.
    Finally, make a MPANEL (main panel) which uses grid bag layout. You want your FPANEL to expand to fill the MPANEL but the LPANEL should be constant no? So we use gridbaglayout and add LPANEL with normal constraints (read up on the constrainst and how to use gridbaglayout :). Add FPANEL with gridbagconstraints that cause it to fill the remainder of the space ("remainder" is the key here).
    Voila!
    Your are done :)
    Now, I would make your life easier by recommending you use netBeans for desiging UI's or Eclipse. But, a year of swinging by hand will give u enuf expertise that when u do start using netBeans etc, you will have be able to get the maximum out of them.
    tell me if u got it right!
    -vijai.

  • I need Help for Shape Hints.

    Dear friend,
    I want some help on Shape Hints. When we use a box for
    creating a animated
    cube using shape hints. The prespective view don't shows the
    center line
    between two sides while rotating. How to create or get that
    line?
    Thanks & Regards
    Arvind Sharma

    See my reply to your previous thread : https://discussions.apple.com/message/22851849#22851849

  • Tree component children displays [Object, Object] need help displaying the names :)

    hey guys... i've run into yet another problem...
    i have a tree component that gets its data from a httpservice.. xml file.
    i then pasrse thru the recieved xml to create a dataprovider for the tree component. the code for that is below...
    <mx:Tree id="tree" dataProvider="{treeData2}" showRoot="false" width="50%" height="100%" />
    [Bindable] public var treeData2:ArrayCollection = new ArrayCollection;
    [Bindable] public var treeData:Object;
    public var resultArr:Object;
    public function initNavTab():void{
        var navService:HTTPService = new HTTPService();
        navService.url = "http://www.apxalarm.com/pages/getnav";
        navService.method = "POST";
        navService.useProxy = false;
        navService.resultFormat = "e4x";
        //navService.resultFormat = "array";
        navService.addEventListener(ResultEvent.RESULT, returnNavData);
        navService.addEventListener(FaultEvent.FAULT, navDataFault);
        navService.send();
    public function returnNavData(event:ResultEvent):void{
        navData = event.result;
        //resultArr = event.result;
        Alert.show("load complete");
        tree_labelFunc(navData);
    public function navDataFault(event:FaultEvent):void{
        Alert.show(event.fault.faultDetail);
    public function tree_labelFunc(item:Object):void{
        var node:XML = XML(item);
        var nav:XMLList = new XMLList();
        nav = node.sections;
        var i:Number = 0;
        for each (var section:XML in nav.section){
            var obj:Object = new Object();
            obj.label = section.name;
            obj.urlName = section.urlName;
            obj.children = new ArrayCollection;
                for each(var nav1:XML in section.navs.nav){
                    obj.children.addItem([{label: nav1.name}]);
            treeData2.addItem(obj);
    the tree_labelFunc parces thru the xml and creates the appropriate structure i need to be displayed in the tree component... but unfortunately the children of the tree component only shows [Object, Object]
    can someone show me how to display the labels instead of the Object???
    thank you soo much in advace guys!!! i really appretiate it!!!
    oh and this is part of the xml that it is pulling
    <siteMap>
      <sections>
        <section>
          <name>About APX</name>
          <urlName>about</urlName>
          <position>1</position>
          <defaultaction>/about/mission</defaultaction>
          <navs>
            <nav>
              <name>Our Mission</name>
              <urlName>mission</urlName>
              <position>1</position>
              <defaultaction>13</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Links</name>
              <urlName>links</urlName>
              <position>4</position>
              <subNavs>
                <nav>
                  <name>iamapx.com</name>
                  <urlName>iamapx</urlName>
                  <position>1</position>
                  <defaultaction>http://www.iamapx.com</defaultaction>
                  <subNavs/>
                </nav>
                <nav>
                  <name>apxgivesback.com</name>
                  <urlName>agb</urlName>
                  <position>2</position>
                  <defaultaction>http://www.apxgivesback.com</defaultaction>
                  <subNavs/>
                </nav>
              </subNavs>
            </nav>
            <nav>
              <name>Newsletter</name>
              <urlName>newsletter</urlName>
              <position>3</position>
              <defaultaction>37</defaultaction>
              <subNavs/>
            </nav>
          </navs>
        </section>
        <section>
        </section>
        <section>
        </section>
        <section>
        </section>
        <section>
        </section>
        <section>
        </section>
      </sections>
    </siteMap>
    i need the name tags in the xml to be displayed in the tree component....
    again thank you soo much in advace for your help!!

    thank you soo much for your quick responce alex!!
    the toXMLString is exactly like the xml
    <siteMap>
      <sections>
        <section>
          <name>About APX</name>
          <urlName>about</urlName>
          <position>1</position>
          <defaultaction>/about/mission</defaultaction>
          <navs>
            <nav>
              <name>Our Mission</name>
              <urlName>mission</urlName>
              <position>1</position>
              <defaultaction>13</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Links</name>
              <urlName>links</urlName>
              <position>4</position>
              <subNavs>
                <nav>
                  <name>iamapx.com</name>
                  <urlName>iamapx</urlName>
                  <position>1</position>
                  <defaultaction>http://www.iamapx.com</defaultaction>
                  <subNavs/>
                </nav>
                <nav>
                  <name>apxgivesback.com</name>
                  <urlName>agb</urlName>
                  <position>2</position>
                  <defaultaction>http://www.apxgivesback.com</defaultaction>
                  <subNavs/>
                </nav>
              </subNavs>
            </nav>
            <nav>
              <name>Newsletter</name>
              <urlName>newsletter</urlName>
              <position>3</position>
              <defaultaction>37</defaultaction>
              <subNavs/>
            </nav>
          </navs>
        </section>
        <section>
          <name>APX Security Systems</name>
          <urlName>apxsystems</urlName>
          <position>2</position>
          <defaultaction>/apxsystems/systems/products</defaultaction>
          <navs>
            <nav>
              <name>Service Areas</name>
              <urlName>serviceareas</urlName>
              <position>1</position>
              <defaultaction>25</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Systems</name>
              <urlName>systems</urlName>
              <position>2</position>
              <defaultaction>27</defaultaction>
              <subNavs>
                <nav>
                  <name>Get A System</name>
                  <urlName>get</urlName>
                  <position>2</position>
                  <defaultaction>27</defaultaction>
                  <subNavs/>
                </nav>
                <nav>
                  <name>Browse Products</name>
                  <urlName>products</urlName>
                  <position>1</position>
                  <defaultaction>28</defaultaction>
                  <subNavs/>
                </nav>
                <nav>
                  <name>Refer A Friend</name>
                  <urlName>refer</urlName>
                  <position>3</position>
                  <defaultaction>38</defaultaction>
                  <subNavs/>
                </nav>
              </subNavs>
            </nav>
          </navs>
        </section>
        <section>
          <name>Customer Support</name>
          <urlName>support</urlName>
          <position>3</position>
          <defaultaction>/support/specialist</defaultaction>
          <navs>
            <nav>
              <name>Technical Support</name>
              <urlName>tech</urlName>
              <position>2</position>
              <defaultaction>32</defaultaction>
              <subNavs>
                <nav>
                  <name>Troubleshooting</name>
                  <urlName>troubleshooting</urlName>
                  <position>2</position>
                  <defaultaction>32</defaultaction>
                  <subNavs/>
                </nav>
              </subNavs>
            </nav>
            <nav>
              <name>Speak To A Specialist</name>
              <urlName>specialist</urlName>
              <position>1</position>
              <defaultaction>30</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Move Options</name>
              <urlName>moves</urlName>
              <position>3</position>
              <defaultaction>35</defaultaction>
              <subNavs/>
            </nav>
          </navs>
        </section>
        <section>
          <name>Home Safety</name>
          <urlName>safety</urlName>
          <position>4</position>
          <defaultaction>/safety/outside</defaultaction>
          <navs>
            <nav>
              <name>Indoor Tips</name>
              <urlName>inside</urlName>
              <position>1</position>
              <defaultaction>17</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Outdoor Tips</name>
              <urlName>outside</urlName>
              <position>2</position>
              <defaultaction>18</defaultaction>
              <subNavs/>
            </nav>
          </navs>
        </section>
        <section>
          <name>Customer Stories</name>
          <urlName>stories</urlName>
          <position>5</position>
          <defaultaction>/stories/videos</defaultaction>
          <navs>
            <nav>
              <name>Videos</name>
              <urlName>videos</urlName>
              <position>3</position>
              <defaultaction>15</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Read Stories</name>
              <urlName>read</urlName>
              <position>1</position>
              <defaultaction>19</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Tell Your Story</name>
              <urlName>tell</urlName>
              <position>2</position>
              <defaultaction>20</defaultaction>
              <subNavs/>
            </nav>
          </navs>
        </section>
        <section>
          <name>Newsroom</name>
          <urlName>press</urlName>
          <position>6</position>
          <defaultaction>/press/compprofile</defaultaction>
          <navs>
            <nav>
              <name>Press Releases</name>
              <urlName>pr</urlName>
              <position>2</position>
              <defaultaction>21</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Media Kit</name>
              <urlName>media</urlName>
              <position>3</position>
              <defaultaction>22</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Company Profile</name>
              <urlName>compprofile</urlName>
              <position>1</position>
              <defaultaction>34</defaultaction>
              <subNavs/>
            </nav>
            <nav>
              <name>Contact Us</name>
              <urlName>contact</urlName>
              <position>4</position>
              <defaultaction>39</defaultaction>
              <subNavs/>
            </nav>
          </navs>
        </section>
      </sections>
    </siteMap>
    i need to subNavs to be available within the tree dropdown...

  • Need help with "paste inside" feature, please!

    Hello. I'm a former Freehand user who needs to know how to accomplish the "paste inside" task in Illustrator. I have a graphic which I want to show through only in the areas where the other graphic exists. I don't know how else to explain it. Help!

    Hi JBinReno,
    You may be referring to a clipping mask. Say I want this image of a city to be contained inside of this sheared rectangle.
    Just select both the shape and the image and choose Object > Clipping Mask > Make.
    To edit the image inside of the shape, simply double click on the graphic and you can edit "inside".
    Is this the solution you're looking for?
    Michael

  • Need Help Displaying Results

    hi
    our class group is making a program which a user enters the names, ids, final exam grade and midterm grade of up to 50 students. and at the end we just want to display all the results
    now my question is that we currently have this as our output
    else if (evt.getActionCommand ().equals("Display")) {  // Display button pressed
    if (counterOfStudents > 0) {
    for (int count = 0; count < counterOfStudents; count ++)
    result = result + studentList [count].name + ": " + studentList [count].ID + "\n";
    JOptionPane.showMessageDialog (null, result, "Student List", JOptionPane.INFORMATION_MESSAGE); // display pop-up message dialog box
    // displayButton.setEnabled (false);
    now i really want to makes this look really better than just a simple popup. is there any way you can help me please?
    i want something that looks better.
    thanks a bunch

    Presumably you're using swing for this? (ie are you importing javax.swing.*?)
    If so then why not use a JList or JTable to display the results?
    The code below creates a JList in a JFrame. You pass your array of student records (I don't know what you've called it so you'll need to change the constructor slightly) when you create it.
    Call new ListDisplay(studentList) to have a (very) basic JList containing your student data. You will need to override the toString() method of your student type class so that it outputs the right data, ie:
    public void toString(){
         return this.name+" "+this.ID;
    should do it. email me on [email protected] if you're stuck, or try my MSN Messenger(same address).
    <pre>
    class ListDisplay extends JFrame{
    public ListDisplay(studentData students[]){
    super("records test");
    JList jl = new JList();
    Container c = this.getContentPane();
    this.setSize(400,400);
    c.add(jl);
    jl.setListData(students);
    this.setVisible(true);
    </pre>

  • Need help displaying images with List component for Flash CS4 (ActionScript 3.0)

    Hi folks:
    I am an inexperienced user of Flash CS4 Pro (v10.0.2). I am attempting to use the List component with ActionScript 3.0 to make a different image display when a user clicks each item in a list.
    I did find a tutorial that showed me how to make different text display using a dynamic text box and the following ActionScript:
    MyList.addEventListener(Event.CHANGE, ShowSelectedItem);
    function ShowSelectedItem(event:Event):void {
        ListText.text=MyList.selectedItem.data;
    ...where My List is the instance of the List component and ListText is the dynamix text box. In this case, the user clicks an item in the list, defined by the label value in the dataProvider parameter of the List component, and text displays as defined in the data value in the dataProvider parameter.
    However, as I mentioned to start, what I really want to do is make images display instead of text. Can anyone provide me the steps to do this?
    I appreciate your help (in advance)!!
    Cindy

    Hi...thanks for responding! I was planning on using images from the Library, but if there is a better way to do it, I'm open. So far, I just have text in the data property. This is part of my problem. I don't know what I need to put in the data value for an image to display. Do I just put the image file name and Flash will know to pull it from the Library? Do I need to place the images on the stage on different frames? I apologize for the "stupid user" questions, but as you can tell, I'm a newbie.
    Appreciate your patience and any help you can offer!
    Cindy

  • Need help displaying data in text field... Help?

    i have this code:
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import com.adobe.serialization.json.JSON;
    var loader:URLLoader = new URLLoader(new URLRequest("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=ScottMitchell"));
    loader.addEventListener(Event.COMPLETE, loadComplete);
    function loadComplete(e:Event):void {
        processData(e.target.data);
    function processData(data:String):void {
        var tweets:Array = JSON.decode(data) as Array;
        trace(tweets[0].text);
    It works, in the output it tells me the tweets.
    but i need it to be displyed on the app, i need to no how to do this, someone pointed me in the direction of using a item renderer extended from sprite?
    But really all i need to do is display it in a text field, all i want to do is display the data.
    Can anyone help???
    I know this is probably simple and i did try to figure this out on my own, but had no luck.
    All help is appreciated.
    Many thanks in advance.

    you can always use an array if there's no pattern to your positions:
    var positionA:Array=[ [100,20], [2,222], [55,2], [201,111], [78,23] ];
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import com.adobe.serialization.json.JSON;
    var loader:URLLoader = new URLLoader(new URLRequest("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=ScottMitchell"));
    loader.addEventListener(Event.COMPLETE, loadComplete);
    function loadComplete(e:Event):void {
        processData(e.target.data);
    function processData(data:String):void {
        var tweets:Array = JSON.decode(data) as Array;
    for(var i:int=0;i<5;i++){
    var tf:TextField=new TextField();
    addChild(tf);
    tf.multiline=true;
    tf.width=300;
    tf.text =   tweets[i].text;
    tf.autoSize="left";
    tf.x=positionA[i][0];
    tf.y=positionA[i][1];
    nextY+=tf.height;

  • Need Help Displaying Query

    I am having problems with this, I need to re-write this into
    3 different routes the CFIF can take. Currently this works because
    the query only returns 9 records, they are being displayed as 3
    rows with 3 columns. I need to re-write and have it where if the
    record count is LT9 to only have the output be on 2 columns with 3
    rows....and if the count is LT6 then i only want 1 row with 3
    columns. I am having problems figuring out how to modify this code
    to accomplish this task. Any help would be greeeeeeeeeeeeat.
    <cfif alsobought_counter LTE 9>
    <cfif (prodCount+(detailsColCount-1)) MOD detailsColCount
    EQ 0><div class="clearfix"></cfif>
    <div class="productThumbCont">
    <cfset product_link = link("product",
    alsoBought_product_id, product_title)>
    <div class="productThumbImg">
    <a href="#product_link#" class="picksLink"
    title="#linktitle#"><img
    src="#cfimage[alsobought_counter].thumb.path#" alt="" border="0"
    tooltip="#alsoBought_product_id#" />
    <cfif len(trim(qryAlso_Bought.is_ondemand)) and
    qryrelated_products.is_ondemand EQ 1 AND qryAlso_Bought.is_disabled
    NEQ 1 AND request.allowVOD eq 1><div
    class="on-demand-call-out"
    style="cursor:pointer;margin-top:-22px;margin-top:-25/**/px;margin-left:21px;background:
    url(../skins/graphics/btns/ondemand-overlay.gif) 0 0
    no-repeat;width:79px;height:22px;filter:alpha(opacity=80);-moz-opacity:.80;opacity:.80;">< /div></cfif></a>
    </div>
    <div class="productThumbTitle">
    <a href="#product_link#" class="picksLink"
    title="#linktitle#">#product_title#<cfif
    len(trim(extendedTitle))>
    (#extendedTitle#)</cfif></a>
    <!--- <cfif len(trim(qryAlso_Bought.hotmovies_id)) AND
    qryAlso_Bought.is_disabled NEQ 1 AND request.allowVOD eq
    1><div
    style="padding-top:5px;"><img
    src="../skins/graphics/btns/ondemand.gif" alt="Available
    On-Demand"
    border="0" /></div></cfif> --->
    </div>
    </div>
    <cfif prodCount MOD detailsColCount EQ
    0></div></cfif>
    <cfset prodCount = IncrementValue(prodCount)>
    <cfset alsobought_counter =
    IncrementValue(alsobought_counter)>
    </cfif>
    </cfoutput>
    <cfif (prodCount-1) MOD detailsColCount NEQ
    0></div></cfif>
    </div>
    Text

    After you run your query, look at the record count. Run all
    the if/else logic you have to to determine the number of columns
    you want. Don't worry about the number of rows, that will take care
    of itself.
    Once you have the number of columns figured out, output your
    data as simply as possible, no style tags, no links, just data. Use
    the modulus operator to decide when to start a new row.
    Once you've accomplished that, start adding the rest of your
    stuff.

  • Beginner needs help with subform inside of subform

    I need to add a few different subforms depending upon the answers given in the form.  The first level is phase. Then they answer the question does this phase have tasks?  If yes then I want the tasks subform to appear.  If no then I want then I want the working org subform to appear.  After they answer then they have the option of adding another phase and starting the process again.  I have the phase adding again, but cannot figure out to have addtional subforms in between the phases.  Any help or examples would be greatly appreciated.
    Thanks!

    The answer to this depends on how the content of the  tasks and working org sections are organized.  Since each phase entry is set up as a table that's in a row of a parent table, the only way to insert a section under the phase would be to add a row.  You can add a row for tasks and a row for working org after the phase row, so that every time you insert a phase you'll get both.  Set them both to hidden, and unhide the appropriate row based on the answer to the "tasks" question.  The only issue is that if your task and working org info is complex it'll be tricky to format all of the info as a table row.  This can be done by making your row one cell wide (full width of the row) and setting that cell content to a subform, then adding all of your info into the subform.  However if there's a lot of data then the row constraint may be an problem.
    The other method would be to convert the phase section to a subform, then have three child subforms inside: phase, tasks and working org.  The idea is the same as what you're doing now, but you're using subforms rather than table rows.  You can add instances of subforms the same way that you add instances of table rows.
    I wired up your example using rows; see the attached form.

  • Need help displaying HTML files stored in content repository

    I have a very simple HTML file stored in a binary attribute (so the file could
    be uploaded through the Admin Portal) named "html" in the BEA Repository (8.1sp2)
    and would like to display it in a JSP. Here's a snippet from that JSP:
    <cm:getNode path="<%=myNodePath%>" id="myNode"/>
    <cm:getProperty node="<%=myNode%>" name="html" conversionType="html"/>
    I expected the getProperty tag to fetch the HTML file and render it inline, but
    I guess that's wishful thinking. Am I missing something?
    Thanks for any help!

    I added transactionTimeout="30" to the tag shown below. That did the trick, as
    long as I avoided certain combinations of tag attributes. Guess this one's a little
    moody.
    Thanks, Greg.
    Gregory Smith <[email protected]> wrote:
    Try setting the transactionTimeout to something greater than 0 on the
    <cm:getProperty> tag.
    Greg
    Marc N wrote:
    I have a very simple HTML file stored in a binary attribute (so thefile could
    be uploaded through the Admin Portal) named "html" in the BEA Repository(8.1sp2)
    and would like to display it in a JSP. Here's a snippet from that JSP:
    <cm:getNode path="<%=myNodePath%>" id="myNode"/>
    <cm:getProperty node="<%=myNode%>" name="html" conversionType="html"/>
    I expected the getProperty tag to fetch the HTML file and render itinline, but
    I guess that's wishful thinking. Am I missing something?
    Thanks for any help!

  • (Need Help) Display pictures can't update on my bbm

    I have upgrade my bbm to a new version. But I have trouble here. My display picture can't update, so all my friends can't see my picture (just blank like no photos). Any solution? Please help me to solve this problem.
    Information :
    I use blackberry bold 9900 with OS 7.1
    Thank you.

    More information :
    I use blackberry bold 9900 with OS 7.1
    Country Indonesian
    BBM also can't connect to BBM connect like facebook, etc. It must failed when step 2 verifying to bbm. Please help me to solve this problem.
    Thank you

  • Need help displaying image on canvas  :((

    can anybody help me with my coding. my problem is, i cannot display an image on my canvas. plz..someone help me to solve my problem..
    Here's my coding...
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;
    import java.util.*;
    public class ImageMidletServlet
        Display display = null;
        //Form f = null;
        String url = "http://localhost:8080/banner/hp0.gif";
        String url2 = "http://localhost:8080/banner/rotateNumber";      
        //String url = "http://localhost:8080/banner/banner";
        Command backCommand = new Command("Back", Command.BACK, 0);
        Command submitCommand = new Command("Submit", Command.OK, 2);
        Command exitCommand = new Command("Exit", Command.STOP, 3);
        private Test test;  
        private StringItem stringItem2;
        private TextField txtField;
        private Timer tm;          // Timer
        private load load;       // Task
        private int id = 0;
        Image img = null;
        //String id;
        public ImageMidletServlet(Display display)
            this.display=display;  
            loadimage();
        public void loadimage()
            tm = new Timer();
            load = new load();
            tm.schedule(load,0,6000);
         class Test extends Canvas implements Runnable, CommandListener
            private Canvas canvas;
            public Test(Canvas canvas)
                this.canvas=canvas;
                setCommandListener(this);
            public void start()
                Thread t = new Thread(this);
                t.start();
            public void run ()
                DataInputStream is = null;
                DataInputStream is2 = null;
                StringBuffer sb = new StringBuffer();
                Image img= null;
                TextBox txtBox = null;
                StringBuffer b = new StringBuffer();
                HttpConnection c2 = null;
                OutputStream os = null;           
                ++ id;
                try
                    c2 = (HttpConnection)Connector.open(url2+ "?bannerid="+id);
                    os = c2.openOutputStream();
                    os.write(("bannerid="+id).getBytes());              
                    os.flush();
                    //HttpConnection c = (HttpConnection) Connector.open(url+ "?bannerid="+id);
                    HttpConnection c = (HttpConnection) Connector.open(url);
                    int len = (int)c.getLength();
                    if (len > 0)
                        is = c.openDataInputStream();
                        byte[] data = new byte[len];
                        is.readFully(data);
                        is2 = c2.openDataInputStream();
                        int ch;
                        while ((ch = is2.read()) != -1) {
                        b.append((char) ch);
                        System.out.print((char)ch);
                        try {
                        //img = Image.createImage(data, 0, len);
                        img = Image.createImage("/images/splash.png");
                        Graphics graphics = img.getGraphics();                   
                        catch (Exception e)
                        if(img==null)
                        System.out.print("no image");
                        else {System.out.print("got image");}
                    else
                        showAlert("length is null");;
                    is.close();
                    c.close();
                    c2.close();
                   // repaint();
                catch (Exception e)
                    e.printStackTrace();
                    showAlert(e.getMessage());
            /* Display Error On screen*/
            private void showAlert(String err)
                Alert a = new Alert("");
                a.setString(err);
                a.setTimeout(Alert.FOREVER);
                display.setCurrent(a);
             public void commandAction(Command c, Displayable d)
            if (c == exitCommand)
                //destroyApp(true);
                //notifyDestroyed();
            else if (c == backCommand)
                //display.setCurrent(f);
            else if (c == submitCommand)
                /*test  = new Test(this);
                test.start();*/
             protected void paint(Graphics graphics)
             if (img != null)
                graphics.setColor(0x000000);  
                graphics.drawImage(img, 0, 0, Graphics.TOP | Graphics.HCENTER);
             else
             {System.out.print("no drawing");}
        class load extends TimerTask
        private Test canvas;
           public final void run()
          this.canvas = canvas;
          test  = new Test(canvas);
          //test();
          test.start();
    }

    Hi
    I would do like this: take the code that draws the image an put it into a separate class (which will extend the Canvas class) which will take as a parameter to its constructor either an array of bytes or an Image object (it's up to you) and call this class after you have downloaded all the bytes from the input stream. I presume that you get the "no drawing" message..
    Mihai

Maybe you are looking for

  • Item Category

    Dear Friends, I am having Requirement like this iam  making the Consumption PO for 2 Line items(without material Master) and for Freight iam making 3rd Line Item with Item Category B (Limit). is it possible to distribute the cost of this with the fir

  • How do i upgrade my hard drive on a hp/compaq nc6000 laptop

    I have a HP/Compaq NC6000 laptop and the hard drive has failed, I have tried 60GB and an 80GB known good hard drive in the machine bit all it says is "Non system disk", how do I upgrade or do I have to put a 30GB HDD back into it

  • Extended Program Check

    Hi, I am getting an error in extented program check as below. Does not use DESCRIBE to confirm there are records in an internal table before using it in a SELECT as the target of FOR ALL ENTRIES IN in YV_MARINE_SEL at line 72. for the below select st

  • Material master upload -lsmw

    Hai guys,            I want to upload material using lsmw for material master.i am following all the steps in the lsmw. i am using the batch input method for uploading.If the sales unit is different from the unit of measure..i will be getting the con

  • Got "Reponse is not well-formed XML" error when calling FormDataIntegration web service

    Hi, I'm using Windows Server 2008 + LiveCycle Server ES2 (Reader Extensions) + ASP.NET This problem only happened when I run the ASP.NET program with the licensed version of the server, (which i installed form the CD provided) However, there is no pr