so i'm working on little e-store program right bunch of basic e-store functions. have have button comes sort of 'view order' dialog box displays date/time, list of things purchased, subtotal, etc.
so here's problem. if dialog box set this:
private void viewactionperformed(java.awt.event.actionevent evt) { joptionpane.showmessagedialog(null, list); }
'list' array of items ordered, print out, want:
but if add more things joptionpane code, this:
joptionpane.showmessagedialog(null, "date: " + x.format(dnow) + "\n\n" + "number of line items: " + count + "\n\n" + "item# / id / title / price / qty / disc % / subtotal\n\n" + list);
list @ end of dialogue box, this:
with highlighted part being array 'list'. want highlighted portion display in other dialogue box array. 'list' array in second code snippet underlined (netbeans) , says "array concatenated string". help? i'd post whole code it's super messy right now.
option 1:
- create jtable,
- create appropriate tablemodel it, 1 appropriate columns (i.e., item#, id, title, price, qty, disc %, subtotal),
- add data model,
- set model jtable,
- add table jscrollpane ,
- then display in joptionpane.
quick , dirty option 2:
- use non-editable, non-focusable jtextarea,
- give
font.monospaced
type font - create data table appending jtextarea true formatted text -- not tabs rather use of
string.format(...)
Comments
Post a Comment