- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
好吧,我仍然是一个 Java 新手。说实话,这是一份家庭作业,但我现在正在用头撞墙。我不知道从这里该去哪里。
我正在为作业编写一个库存程序,它必须使用普通数组。不是 ArrayList
我感到困惑的部分是您必须向数组添加新条目的部分。我通过使用 Arrays.copyof 创建它的第二个版本,然后将其重新复制到具有增强长度的原始版本来实现。它似乎有效,通过控制台我可以毫无问题地打印我的新数组,并完成新条目。我遇到的问题是我的 gui 的问题。每次我尝试在我的 gui 中显示新条目时,我都会得到
"Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 5"
我确信我犯了一些愚蠢的错误,但我已经度过了漫长的一天,我完全被这个问题难住了。
package inventoryprogram3;
public class Inventoryprogram3 {
public static void main(String[] args) {
inventoryGui gui = new inventoryGui();
gui.setVisible(true);
}
}
package inventoryprogram3;
import java.io.Serializable;
class sItem implements Serializable{
int itemNumber;
String itemName;
int itemStock;
double itemPrice;
double stockTotal;
public sItem(int iNumber, String iName, int iStock, double iPrice){
itemNumber = iNumber;
itemName = iName;
itemStock = iStock;
itemPrice = iPrice;
}
}
public class rBook extends sItem {
int pCount;
double rFee;
public rBook(int iNumber, String iName, int iStock, double iPrice, int pageCount) {
super(iNumber, iName, iStock, iPrice);
pCount = pageCount;
rFee = (iPrice * iStock) * 1.05;
}
}
package inventoryprogram3;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
public class inventoryGui extends javax.swing.JFrame {
/**
* Creates new form inventoryGui
*/
static int max = 5;
static rBook[] rpg = new rBook[max];
double invValue;
int counter = -1;
public inventoryGui() {
initComponents();
rpg[0] = new rBook(1, "Mutants & Masterminds", 4, 19.99, 200);
rpg[1] = new rBook(2, "Exalted", 6, 25.99, 542);
rpg[2] = new rBook(3, "D&D Next", 15, 49.95, 350);
rpg[3] = new rBook(4, "Eclipse Phase", 3, 28.99, 426);
rpg[4] = new rBook(5, "The Mutant Epoch", 8, 19.99, 386);
}
private void initComponents() {
jLabel4 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
nameLabel = new javax.swing.JLabel();
titleLabel = new javax.swing.JLabel();
iNumberLabel = new javax.swing.JLabel();
priceLabel = new javax.swing.JLabel();
pCountlabel = new javax.swing.JLabel();
stockLabel = new javax.swing.JLabel();
restockLabel = new javax.swing.JLabel();
entireInventoryLabel = new javax.swing.JLabel();
restockField = new javax.swing.JTextField();
stockField = new javax.swing.JTextField();
pCountField = new javax.swing.JTextField();
priceField = new javax.swing.JTextField();
iNumberField = new javax.swing.JTextField();
titleField = new javax.swing.JTextField();
inventoryValueLabel = new javax.swing.JLabel();
inventoryValueField = new javax.swing.JTextField();
nextButton = new javax.swing.JButton();
entireInventoryField = new javax.swing.JTextField();
buttonLabel = new javax.swing.JLabel();
previousButton = new javax.swing.JButton();
companyLogo = new javax.swing.JLabel();
saveButton = new javax.swing.JButton();
loadButton = new javax.swing.JButton();
addbutton = new javax.swing.JButton();
deleteButton = new javax.swing.JButton();
modifyButton = new javax.swing.JButton();
searchButton = new javax.swing.JButton();
jLabel4.setText("jLabel4");
jLabel2.setText("jLabel2");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("RPG Inventory Program v0.4");
nameLabel.setText("Role Playing Game Inventory");
titleLabel.setText("Title");
iNumberLabel.setText("Item Number");
priceLabel.setText("Price");
pCountlabel.setText("Page Count");
stockLabel.setText("Copies in Stock");
restockLabel.setText("Restocking Fee");
entireInventoryLabel.setText("Value of Entire Inventory");
restockField.setEditable(false);
iNumberField.setEditable(false);
inventoryValueLabel.setText("Inventory Value");
nextButton.setText("Next");
nextButton.setToolTipText("Click toDisplay Next Item");
nextButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nextButtonActionPerformed(evt);
}
});
entireInventoryField.setEditable(false);
buttonLabel.setText("Item Display");
previousButton.setText("Previous");
previousButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
previousButtonActionPerformed(evt);
}
});
companyLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/inventoryprogram3/logo4.png")));
saveButton.setText("Save");
saveButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveButtonActionPerformed(evt);
}
});
loadButton.setText("Clear");
loadButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
loadButtonActionPerformed(evt);
}
});
addbutton.setText("Add");
addbutton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addbuttonActionPerformed(evt);
}
});
deleteButton.setText("Delete");
deleteButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
deleteButtonActionPerformed(evt);
}
});
modifyButton.setText("Modify Current Item");
modifyButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
modifyButtonActionPerformed(evt);
}
});
searchButton.setText("Search");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(pCountlabel)
.addGap(18, 18, 18)
.addComponent(pCountField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(entireInventoryLabel))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(restockLabel)
.addGap(192, 192, 192)
.addComponent(previousButton))
.addGroup(layout.createSequentialGroup()
.addComponent(loadButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(addbutton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deleteButton)
.addGap(18, 18, 18)
.addComponent(modifyButton)
.addGap(12, 12, 12)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(nextButton)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(saveButton))))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(nameLabel)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(priceLabel)
.addGap(18, 18, 18)
.addComponent(priceField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(titleLabel)
.addGap(18, 18, 18)
.addComponent(titleField, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(iNumberLabel)
.addGap(18, 18, 18)
.addComponent(iNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(searchButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(companyLogo)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(restockField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(inventoryValueLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(inventoryValueField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(stockLabel)
.addGap(18, 18, 18)
.addComponent(stockField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(entireInventoryField, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(buttonLabel)
.addGap(15, 15, 15)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {iNumberLabel, pCountlabel, priceLabel, restockLabel, stockLabel, titleLabel});
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {iNumberField, inventoryValueField, pCountField, priceField, restockField, stockField, titleField});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(nameLabel)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(titleLabel)
.addComponent(titleField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(searchButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(iNumberLabel)
.addComponent(iNumberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(priceLabel)
.addComponent(priceField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(companyLogo, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(pCountlabel)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pCountField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(entireInventoryLabel)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(stockLabel)
.addComponent(stockField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(entireInventoryField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(inventoryValueLabel)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(inventoryValueField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonLabel)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(restockLabel)
.addComponent(restockField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(previousButton)
.addComponent(nextButton))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveButton)
.addComponent(addbutton)
.addComponent(deleteButton)
.addComponent(modifyButton)
.addComponent(loadButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}
private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {
if(counter< max -1){
counter = counter + 1;
}
else{
counter = 0;
}
NumberFormat realMoney = NumberFormat.getCurrencyInstance(Locale.US);
invValue = 0;
for (int x=0; x < max -1; x++) {
invValue += rpg[x].itemStock * rpg[x].itemPrice;
}
System.out.println(counter);
titleField.setText(rpg[counter].itemName);
iNumberField.setText(String.valueOf(rpg[counter].itemNumber));
pCountField.setText(String.valueOf(rpg[counter].pCount));
priceField.setText(String.valueOf(realMoney.format(rpg[counter].itemPrice)));
stockField.setText(String.valueOf(rpg[counter].itemStock));
restockField.setText(String.valueOf(rpg[counter].rFee));
inventoryValueField.setText(String.valueOf(rpg[counter].itemStock * rpg[counter].itemPrice));
entireInventoryField.setText(String.valueOf(realMoney.format(invValue)));
}
private void previousButtonActionPerformed(java.awt.event.ActionEvent evt) {
if(counter>= 1){
counter = counter - 1;
}
else{
counter = max -1;
}
NumberFormat realMoney = NumberFormat.getCurrencyInstance(Locale.US);
invValue = 0;
for (int x=0; x < max -1; x++) {
invValue += rpg[x].itemStock * rpg[x].itemPrice;
}
titleField.setText(rpg[counter].itemName);
iNumberField.setText(String.valueOf(rpg[counter].itemNumber));
pCountField.setText(String.valueOf(rpg[counter].pCount));
priceField.setText(String.valueOf(realMoney.format(rpg[counter].itemPrice)));
stockField.setText(String.valueOf(rpg[counter].itemStock));
restockField.setText(String.valueOf(rpg[counter].rFee));
inventoryValueField.setText(String.valueOf(rpg[counter].itemStock * rpg[counter].itemPrice));
entireInventoryField.setText(String.valueOf(realMoney.format(invValue)));
}
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {
ObjectOutputStream savefile = null;
int dirmake = 1;
do{
try {
savefile = new ObjectOutputStream(new FileOutputStream("C:\\inventory\\inventory.dat"));
savefile.writeObject(rpg);
savefile.close();
dirmake = 2 ;
}
catch (Exception e){
String savePath = "c:\\Inventory";
Path invPath = Paths.get(savePath);
try {
Files.createDirectory(invPath);
} catch (IOException ex) {
Logger.getLogger(inventoryGui.class.getName()).log(Level.SEVERE, null, ex);
}
}
}while(dirmake == 1);
}
private void loadButtonActionPerformed(java.awt.event.ActionEvent evt) {
titleField.setText("");
iNumberField.setText("");
pCountField.setText("");
priceField.setText("");
stockField.setText("");
restockField.setText("");
inventoryValueField.setText("" );
entireInventoryField.setText("");
}
private void modifyButtonActionPerformed(java.awt.event.ActionEvent evt) {
int mINumber = Integer.parseInt(iNumberField.getText());
double ss = Double.parseDouble(priceField.getText().replaceAll("[^\\d.]", ""));
rpg[mINumber -1] = new rBook(mINumber, titleField.getText(), Integer.parseInt(stockField.getText()), ss, Integer.parseInt(pCountField.getText()));
}
private void addbuttonActionPerformed(java.awt.event.ActionEvent evt) {
double ss = Double.parseDouble(priceField.getText().replaceAll("[^\\d.]", ""));
max ++;
rBook[] rpg2 = Arrays.copyOf(rpg, rpg.length);
rBook[] rpg = Arrays.copyOf(rpg2, max);
rpg[max -1] = new rBook(max, titleField.getText(), Integer.parseInt(stockField.getText()), ss, Integer.parseInt(pCountField.getText()));
System.out.println(max + titleField.getText() + Integer.parseInt(stockField.getText()) + ss + Integer.parseInt(pCountField.getText()));
counter = -1;
System.out.println(max);
for (int x=0; x< max; x++) {
System.out.println("Item Number:" + rpg[5].itemNumber);
System.out.println("Rpg Name:" + rpg[5].itemName);
System.out.println("Copies in stock:" + rpg[5].itemStock);
System.out.println("Price: $" + (rpg[5].itemPrice));
System.out.println("Page Count:" + rpg[5].pCount);
System.out.println("Restocking fee: $" + (rpg[5].rFee));
System.out.println();
System.out.println();
System.out.println(rpg.length);
}
}
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(inventoryGui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(inventoryGui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(inventoryGui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(inventoryGui.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new inventoryGui().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton addbutton;
private javax.swing.JLabel buttonLabel;
private javax.swing.JLabel companyLogo;
private javax.swing.JButton deleteButton;
private javax.swing.JTextField entireInventoryField;
private javax.swing.JLabel entireInventoryLabel;
private javax.swing.JTextField iNumberField;
private javax.swing.JLabel iNumberLabel;
private javax.swing.JTextField inventoryValueField;
private javax.swing.JLabel inventoryValueLabel;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel4;
private javax.swing.JButton loadButton;
private javax.swing.JButton modifyButton;
private javax.swing.JLabel nameLabel;
private javax.swing.JButton nextButton;
private javax.swing.JTextField pCountField;
private javax.swing.JLabel pCountlabel;
private javax.swing.JButton previousButton;
private javax.swing.JTextField priceField;
private javax.swing.JLabel priceLabel;
private javax.swing.JTextField restockField;
private javax.swing.JLabel restockLabel;
private javax.swing.JButton saveButton;
private javax.swing.JButton searchButton;
private javax.swing.JTextField stockField;
private javax.swing.JLabel stockLabel;
private javax.swing.JTextField titleField;
private javax.swing.JLabel titleLabel;
}
最佳答案
你的问题的一部分是,你正在隐藏你的变量......
max ++;
rBook[] rpg2 = Arrays.copyOf(rpg, rpg.length);
rBook[] rpg = Arrays.copyOf(rpg2, max);
在这里,您已将 rpg
声明为局部变量,因此您对其所做的任何更改都不会被类的其余部分看到。尝试使用更像...的东西
rpg = Arrays.copyOf(rpg2, max);
相反...
您还可以考虑使用System.arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
相反...但我会先解决你其他问题;)
rBook[] rpg2 = new rBook[rpg.length + 1];
System.arraycopy(rpg, 0, rpg2, 0, rpg.length - 1);
rpg = rpg2;
或者类似的东西......
关于java swing ui 不显示重建的数组索引越界,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23729029/
如果我使用 alter index x rebuild 重建不可用的索引,是否会重新评估之前使用该索引的任何 SQL 的执行计划? 我知道在我使用的数据库版本 - Oracle 10.2.0.4.0
我正在研究 3d 重建。现在当我考虑一对图像时。我有一组对应点。我有我的相机详细信息。例如我有焦点细节,旋转和平移矩阵(4 * 4)。我想在 3D(三角剖分)中投影我的点。因此,据我所知,因子代数非常
从教程中:https://programtalk.com/vs2/?source=python/8176/opencv-python-blueprints/chapter4/scene3D.py 我不
我需要您的帮助和建议。这个问题包括以下几项:某房间的照片,该房间站在严格固定位置的房间内(一个房间围绕轴线旋转)。如何将所有这些图片组合在一起,从而产生一种效果,就像我们用眼睛看到的一样?从一点开始就
嘿那里,以下问题:我在工作中使用一个相当奇怪的 Linux 发行版(Centos 5),它似乎有一个较旧的内核(或者至少在内核中存在一些差异),并且您不能简单地更新它。我需要安装的程序需要一个函数 c
我读了一些关于受限玻尔兹曼机的文章。这些机器的重建能力经过了测试。我了解训练是如何进行的,但不了解重建是如何完成的。有人可以给我一些提示吗? 最佳答案 杰夫·辛顿 (Geoff Hinton) 的演讲
如果轻量级迁移失败,我将尝试重建核心数据数据堆栈,并将用户送回登录屏幕。我正在通过将一对多关系更改为一对一关系来对此进行测试。 起初,我在删除新的 persistentStoreCoordinator
以下所列示例中中 `table_name` 表示数据表名,`index_name` 表示索引名,column list 表示字段列表(如:`id`,`order_id`)。 1、创建索引 索引的
当您根据 ListView.builder 和 ListView.separated valueKey = key; return _messages
切换底部导航页面后,我有一个非常烦人的谷歌地图 flutter 重建问题。我已经坚持了最后一次缩放和相机位置,但是每次我进入 map 页面时,小部件都会自行重建。如何预防? 最佳答案 采用 Autom
我是 Python 的新手。我在重建一个错误的 Dataframe 时遇到了麻烦。我的数据框如下所示: df = pd.DataFrame({'col1': ['id 1', 'id 2', 'tes
我正在尝试从 2 个图像中实现 3d 重建。我遵循的步骤是, 1. Found corresponding points between 2 images using SURF. 2. Impleme
// Start with this JSON var initialJson = { "rows": [{ "ID": 123, "Data": 430910, "Ver
在有状态的小部件中,我有一个导航部分,用户可以在其中选择父项,并在子项下方显示。 当我选择父级也可以重建子部件时,但是当我导航抛出父项而不选择一个子部件时,父级也可以重建(这是正常的),但是子部件也可
我有一个网络摄像头,它可以围绕人的头部以给定的角度步长旋转,并为每一步获取一张图片。 我正在寻找一个免费的开源库,该库从获取的图像集开始,使我能够生成代表人头部的 3D 表面,或者至少是定义明确的 3
我想从一行中读取一个字符串,然后将其放入一个变量中,该变量随后用作文件名。该字符串位于 .csv 文件中的第二行末尾。由于不必要的标题,需要删除第一行。还有‘;’旧 .csv 文件中使用的内容需要替换
我正在使用file-embed如此封装: import qualified Data.ByteString as B import qualified Data.ByteString.Internal
我的 makefile 总是重建,不明白为什么.. 这里是: SRC = $(DIR)/my_getnbr.c \ $(DIR)/my_isneg.c \ $(DI
我有一个附带编辑器的 Eclipse 插件。 我添加了更改语法突出显示颜色的首选项,但这些更改仅在我手动重新启动编辑器后才适用。 我通过一个 DefaultDamagerRepairer 实现了语法高
我有一段 php 可以输出 div(取决于数组中有多少个)并为该 div 分配一个 id(即 div_1、div_2)等 我还设置了一个隐藏字段,其中包含输出了多少个 div 的计数(divcount
我是一名优秀的程序员,十分优秀!