小编Twe*_*ekz的帖子

<class>与model <class>有关系,它没有安装或者是抽象的

from django.db import models    
from audit_trail.audit import AuditTrail    
from my_base_model.classes import BaseUuidModel                                    
from my_class_base import BaseClass

class Mini(BaseMaternalVisitModel):
    my_class_base = models.ForeignKey(BaseClass) 

class MiniHu(BaseUuidModel): 
    myclass = models.ForeignKey(Mini)   

    class Meta:
         app_label="classes"
Run Code Online (Sandbox Code Playgroud)

当我跑步时,python manage.py validate我得到这个错误

<MiniHu> has a relation with model <Mini>, which has either not been installed or is abstract.
Run Code Online (Sandbox Code Playgroud)

django

1
推荐指数
1
解决办法
6951
查看次数

在 Jpanel 上绘制一个可移动的画布

我想画一个可以在 Jpanel 上移动的画布。那就是当用户点击画布并拖动它时,它必须移动到一个新的位置。我已经实现了 MouseMotionListener 但我不知道在里面包含什么来使画布按照要求移动。这是 DisplayCanvas 类:

class DisplayCanvas extends Canvas
{
    public DisplayCanvas()
    {
        setBounds(20, 40, 300, 300);
        setBackground(Color.white);
    }
}
class shape extends JFrame  implements MouseMotionListener{

static JPanel panel;
static Container contentpane;
static DisplayCanvas canvas;
shape()
{
    canvas=new DisplayCanvas();
    canvas.addMouseMotionListener(this);
    panel= new JPanel();
    panel.setBounds(20,20,250,140);
    panel.setLayout(null);
    contentpane = getContentPane();
    contentpane.add(canvas);
    contentpane.add(panel);
}
@Override
public void mouseDragged(MouseEvent e) {}
@Override
public void mouseMoved(MouseEvent arg0) {}
}
Run Code Online (Sandbox Code Playgroud)

这就是我测试它的方式。

public class display 
{
    static JFrame frame;
    public static void main(String[] args) 
    { …
Run Code Online (Sandbox Code Playgroud)

java swing jpanel java-canvas

-1
推荐指数
1
解决办法
2093
查看次数

标签 统计

django ×1

java ×1

java-canvas ×1

jpanel ×1

swing ×1