所以,我最终完成了我的java项目,并从eclipse(File> Export> JAVA> Runnable JAR文件)导出项目,但产品至少可以说不令人满意。问题是,虽然我在JAVA中有令人满意的调试技巧,但在编译方面我并不这样做,而且我之前从未遇到过任何问题也无济于事。
我想发布工作/不工作的图片,但我还没有代表。基本上,Eclipse生成的可运行jar显示了我想要的白色屏幕,以及最顶部(SearchField)的文本字段的一部分。其他文本字段不会显示,但是当我将鼠标悬停在它们应该的位置时,它会更改光标图标。我的所有资源都打包在JAR中,就像它们在Eclipse中一样。我不太确定从哪里开始(实际上,我从谷歌开始,我一直试图解决这个问题2小时),而且我没有从Eclipse中得到任何错误。我很乐意发布您认为相关的任何内容。
文件结构:
omnitool
MathCalc.java
MonetaryField.java
Omnitool.java (<-- Main class)
PanelSets.java
SearchField.java
SingleField.java
ValueContainer.java
omnitool.Graph
Graph.java
GraphPanel.java
GraphScreen.java
omnitool.Grid
FirstPanel.java
Grid.java
GridPanel.java
LabelPanel.java
PeriodPanel.java
SecondPanel.java
ThirdPanel.java
omnitool.images
(directory of images used)
代码:
package omnitool;
class Omnitool extends JFrame {
public Omnitool() {
super("omnitool");
JSplitPane window = new PanelSets();
add(window);
}
}
/////////////////////////////////////////////
package omnitool;
class PanelSets extends JSplitPane {
public JSplitPane top() {
JSplitPane search_price = new JSplitPane();
search_price.setOrientation(JSplitPane.VERTICAL_SPLIT);
search_price.setTopComponent(search());
search_price.setBottomComponent(sell_buy());
return search_price;
}
public JSplitPane bottom() {
JSplitPane calc_mult = new JSplitPane();
calc_mult.setOrientation(JSplitPane.VERTICAL_SPLIT);
calc_mult.setTopComponent(tax_profit());
calc_mult.setBottomComponent(graphing_fields());
return calc_mult;
}
public PanelSets() {
search = new SearchField("Search...");
buy = new MonetaryField("Buy Price:", true, false);
sell = new MonetaryField("Sell Price:", true, false);
revenue = new MonetaryField("Revenue: ", false, false);
cost = new MonetaryField("- Cost:", false, false);
listing_fee = new MonetaryField("- Listing Fee: ", false, false);
sale_fee = new MonetaryField("- Sale Fee:", false, false);
quantity_field = new SingleField("blank.gif", false);
investment_field = new SingleField("gold.png", false);
profit = new MonetaryField("Profit: ", false, true);
blank_field = new SingleField("blank.gif", false);
setOrientation(JSplitPane.VERTICAL_SPLIT);
setTopComponent(top());
setBottomComponent(bottom());
}
MonetaryField buy;
MonetaryField sell;
MonetaryField revenue;
MonetaryField cost;
MonetaryField listing_fee;
MonetaryField sale_fee;
MonetaryField profit;
SingleField quantity_field;
SingleField investment_field;
SingleField blank_field;
JTextField search;
Grid grid_dialog;
Graph graph_dialog;
}