我正在尝试初始化一个包含3个值的数组,一个矩形的x和y坐标以及它是否在屏幕上可见以执行此操作我已编写此代码:
@Entity
@Table(name = "ha_details")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "HaDetails.findAll", query = "SELECT h FROM HaDetails h")
, @NamedQuery(name = "HaDetails.findByHadID", query = "SELECT h FROM
HaDetails h WHERE h.hadID = :hadID")
, @NamedQuery(name = "HaDetails.findByBusinessName", query = "SELECT h FROM
HaDetails h WHERE h.businessName = :businessName")
, @NamedQuery(name = "HaDetails.findByContactNum", query = "SELECT h FROM
HaDetails h WHERE h.contactNum = :contactNum")
, @NamedQuery(name = "HaDetails.findByBusinessAddress", query = "SELECT h
FROM HaDetails h WHERE h.businessAddress = :businessAddress")
, @NamedQuery(name = "HaDetails.findByStatus", query = "SELECT h FROM
HaDetails h WHERE h.status = :status")
, @NamedQuery(name = "HaDetails.findByRegDate", query = "SELECT h FROM
HaDetails h WHERE h.regDate = :regDate")
, @NamedQuery(name = "HaDetails.findByRemarks", query = "SELECT h FROM
HaDetails h WHERE h.remarks = :remarks")
, @NamedQuery(name = "HaDetails.findByLongitude", query = "SELECT h FROM
HaDetails h WHERE h.longitude = :longitude")
, @NamedQuery(name = "HaDetails.findByLatitude", query = "SELECT h FROM
HaDetails h WHERE h.latitude = :latitude")})
public class HaDetails implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "hadID")
private Integer hadID;
@Basic(optional = false)
@Column(name = "businessName")
private String businessName;
@Basic(optional = false)
@Column(name = "contactNum")
private String contactNum;
@Basic(optional = false)
@Column(name = "businessAddress")
private String businessAddress;
@Basic(optional = false)
@Column(name = "status")
private String status;
@Basic(optional = false)
@Column(name = "regDate")
@Temporal(TemporalType.TIMESTAMP)
private Date regDate;
@Column(name = "remarks")
private String remarks;
@Basic(optional = false)
@Column(name = "longitude")
private String longitude;
@Basic(optional = false)
@Column(name = "latitude")
private String latitude;
@JoinColumn(name = "landlordID", referencedColumnName = "landlordID")
@ManyToOne(optional = false)
private Landlord landlordID;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "hadID")
private Collection<HaImages> haImagesCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "hadID")
private Collection<HaAmenities> haAmenitiesCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "hadID")
private Collection<HaTypes> haTypesCollection;
@OneToMany(mappedBy = "hadID")
private Collection<Tenant> tenantCollection;
public HaDetails() {
}
public HaDetails(Integer hadID) {
this.hadID = hadID;
}
public HaDetails(Integer hadID, String businessName, String contactNum, String businessAddress, String status, Date regDate, String longitude, String latitude) {
this.hadID = hadID;
this.businessName = businessName;
this.contactNum = contactNum;
this.businessAddress = businessAddress;
this.status = status;
this.regDate = regDate;
this.longitude = longitude;
this.latitude = latitude;
}
public Integer getHadID() {
return hadID;
}
public void setHadID(Integer hadID) {
this.hadID = hadID;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getContactNum() {
return contactNum;
}
public void setContactNum(String contactNum) {
this.contactNum = contactNum;
}
public String getBusinessAddress() {
return businessAddress;
}
public void setBusinessAddress(String businessAddress) {
this.businessAddress = businessAddress;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getRegDate() {
return regDate;
}
public void setRegDate(Date regDate) {
this.regDate = regDate;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public Landlord getLandlordID() {
return landlordID;
}
public void setLandlordID(Landlord landlordID) {
this.landlordID = landlordID;
}
@XmlTransient
public Collection<HaImages> getHaImagesCollection() {
return haImagesCollection;
}
public void setHaImagesCollection(Collection<HaImages> haImagesCollection) {
this.haImagesCollection = haImagesCollection;
}
@XmlTransient
public Collection<HaAmenities> getHaAmenitiesCollection() {
return haAmenitiesCollection;
}
public void setHaAmenitiesCollection(Collection<HaAmenities>
haAmenitiesCollection) {
this.haAmenitiesCollection = haAmenitiesCollection;
}
@XmlTransient
public Collection<HaTypes> getHaTypesCollection() {
return haTypesCollection;
}
public void setHaTypesCollection(Collection<HaTypes> haTypesCollection) {
this.haTypesCollection = haTypesCollection;
}
@XmlTransient
public Collection<Tenant> getTenantCollection() {
return tenantCollection;
}
public void setTenantCollection(Collection<Tenant> tenantCollection) {
this.tenantCollection = tenantCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (hadID != null ? hadID.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof HaDetails)) {
return false;
}
HaDetails other = (HaDetails) object;
if ((this.hadID == null && other.hadID != null) || (this.hadID != null
&& !this.hadID.equals(other.hadID))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.balay.entity.HaDetails[ hadID=" + hadID + " ]";
}
}
我在void rupee() {
int [] [] myArray = { {200, 110, 1}, {290, 110, 1}, {380, 200, 1}, {470, 110, 1}, {560, 110, 1}, {650, 200, 1}, {110, 200, 1}, {110, 290, 1}, {110, 380, 1}, {200, 470, 1}, {290, 560, 1}, {380, 650, 1}, {470, 560, 1}, {560, 470, 1}, {560, 470, 1}, {650, 380, 1}, {650, 290, 1} };
fill(0, 255, 0);
for (int i = 0; i<16; i++) {
for (int j = 0; j<3; j++) {
rect(myArray(i,i), myArray(j,j),50,50);
}
}
}
下都收到此错误“函数”myArray(int,int)“不存在。
答案 0 :(得分:-2)
您尝试使用错误的语法访问myArray
。试试myArray[i][j]
...