I'm not using any list for rectangles
int x = x_cord_list.get(i);
int y = y_cord_list.get(i);
int width = width_list.get(i);
1.why should i have to do that?
2.should i have to add those codes to the paintComponent() or to drawdig()...
3.should i have to use mouseCliked() method or some other...
If i drag a rectangle,the old position should be moved to a new mouse position and repainteed.. In my case,only a copy of the rectangle is painted in a new mouse position..and the old position is not repainted..
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(getForeground());
1.I were talking about the code:
3.I don't have idea,how to clear the old position..
2.I'm using the mouseDragged method in my code
I'm using JAppelt,so i'm unable to use JFrame in my program.
1.I'm calling more than one method in paintComponent(),so i could able to call that method inside another method.
2.I'm extending the panel in the class ,so how can i create another panel Object...
3.I created Map and implemented in the same way you,did..I couldn't able to drag now...
JPanel panel = new JPanel()
{
@Override
rt.translate((int) (p.getX() - lastP.getX()),(int) (p.getY() - lastP.getY()));
1.My inner class had extended a panel, as per your code,should i have to use another panel inside the constructor
2.In my code,i add some methods to paintComponent() should i have to write that method,too inside the constructor.
Originally posted by Ulf Dittmer:
If it still doesn't work after you did that, tell us in detail what is actually happening - is the mouseDragged method being called at the appropriate times with reasonable values?
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
|