小编Pab*_*ais的帖子

JavaFX:循环之间的旋转动画延迟

我使用以下代码基于RotatedTranstion为ImageView创建了一个动画:

ImageView icon = ImageCache.getImage("refresh.png");
RotateTransition rotateTransition = new RotateTransition(Duration.millis(2000), icon);
rotateTransition.setByAngle(360.0);
rotateTransition.setCycleCount(Timeline.INDEFINITE);

rotateTransition.play();
Run Code Online (Sandbox Code Playgroud)

这导致以下动画:

行动中的轮换

你可能已经注意到动画gif,动画不连续,即动画周期之间有一个小的延迟(暂停).

我试图看看API,但无法弄清楚导致这种延迟的原因以及我如何摆脱它.

java animation javafx

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

将@OneToMany 关系映射为主键作为外键

我正在尝试在 JPA 中映射下图中描述的一对多表关系:

活动图 JPA

如可以看到的,"activity_property"表使用与复合主键(id,name)和列"id"是一个外键列"id"在表中"activity"

我当前的实体是这样映射的(为了清楚起见,省略了一些辅助方法):

活动.java

@Entity
@Getter
@Setter
public class Activity {
   @Id
   @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "act_id_generator")
   @SequenceGenerator(name = "act_id_generator", sequenceName = "activity_id_seq", allocationSize = 1, initialValue = 1)
   private Integer id;

   private String name;

   @OneToMany(mappedBy = "id.activityId", cascade = CascadeType.ALL, orphanRemoval = true)
   private List<ActivityProperty> properties;
}
Run Code Online (Sandbox Code Playgroud)

活动属性.java

@Entity
@Getter
@Setter
@Table(name = "activity_property")
public class ActivityProperty {
    @EmbeddedId
    private ActivityPropertyId id;

    private String value;

    @Enumerated(EnumType.STRING) …
Run Code Online (Sandbox Code Playgroud)

java hibernate jpa

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

标签 统计

java ×2

animation ×1

hibernate ×1

javafx ×1

jpa ×1