KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Can anyone guide me how to code the arrow line in different direction. wa and wl is positive the rectangle will be on top of the x-axis. Below example shown if wl is negative and wa is positive. The code below shown how i code the rectangle shape. x1 is the varaible to state where to start at x axis. e1 is the length of the shape, wa1 and wl1 is the height. wsign to determine the height wa1 or wl1 should display at negative side or positive side. if (Math.abs(wl1) > Math.abs(wa1)) { y_scale = (load_y0 - 40) / (double) Math.abs(wl1); } else { y_scale = (load_y0 - 40) / (double) Math.abs(wa1); } g.drawLine((int) ((double) x0 + x1 * x_scale), (int) (load_y), (int) ((double) x0 + x1 * x_scale), (int) (load_y + (wa1 * y_scale) * -1)); g.drawLine((int) ((double) x0 + (x1 + e1) * x_scale), (int) (load_y), (int) ((double) x0 + (x1 + e1) * x_scale), (int) (load_y + (wl1 * y_scale) * -1)); g.drawLine((int) ((double) x0 + x1 * x_scale), (int) (load_y + (wa1 * y_scale * -1)), (int) ((double) x0 + (x1 + e1) * x_scale), (int) (load_y + (wl1 * y_scale) * -1));
Tags (comma-separated)
Save Edits
Cancel