Member Avatar

I created a custom 'text menu' that should print each String passed to it. This is the class: package com.github.geodox.areacalculator.menu; public class Menu { private static int index = 0; private static String[] menuItems; public void addItem(String menuItem) { menuItems = new String[index+1]; menuItems[index] = menuItem; index++; } public void printMenu() { for(String menuItem : menuItems) { System.out.println(menuItem); } } } This is what is passed. Menu menu = new Menu(); menu.addItem("rectangle"); menu.addItem("square"); menu.addItem("circle"); menu.addItem("triangle"); menu.addItem("trapezoid"); menu.addItem("parallelogram"); menu.printMenu(); However, this is what is printed: null null null null null parallelogram Any ideas on why this is happenning?

Member Avatar
0
11
Member Avatar

I have one problem at the line 20-23. What I need is when the blue box touches the red rectangle, the blue box gets resetted (it goes back to where it starts). However, the problem is, it doesn't touch the red rectangle area properly. Any suggestions? Thanks in advance. float moveX, moveY; float speed = 2; float controlX, controlY; int square = 50; float rectHori = 120; float rectVert = 20; void setup() { size(400, 400); background(255); moveX = width/2; moveY = 50; reset(); } void draw() { background(255); rectMove(); rectControl(); if (dist(controlX, controlY, moveX, moveY) <= rectHori/2 + rectVert/2) …

Member Avatar
0
8
Member Avatar

I have a loop in php which echo out these divs: <div class="nyhed"> <p class="nyheds_dato_p" style="color:#900;">'.$pub_date[1].'/'.$pub_date[2].'/'.$pub_date[0].'</p> <p class="nyhed_p">'.substr($teaser, 0, 55).'..</p> <a href="'.$url.'" class="nyheds_link">'.$link_navn.'</a> </div>'; When ever a link is hovered, i am adding an animation to change the background color of the div class="nyhed". As it is now, all the divs are animated..How do i only add the jquery function the specific div class="nyhed" belonging to the link being hovered? This is what i have: $(document).ready(function(){ $(".nyheds_link").hover(function() { $(".nyhed").animate({ backgroundColor: "#DDD" }, 800);},function() { $(".nyhed").animate({ backgroundColor: "#f5f5f5" }, 300); }); }); Do I need to add: .each and then .find …

Member Avatar
0
3

The End.