|
Re: for Hiran...a small question..
|
Posted: Apr 20, 2002 7:18 AM
|
|
the following are two of my programs: when I uses jexegen it tells me that it can not find the class. Would appreciate your help. Thanks
the main program:-
import java.awt.*; import java.awt.event.*; import java.text.DecimalFormat; import java.io.*; import javax.swing.*;
public class FI extends JFrame{ JButton refresh, save, exit; JTextField b4, b5, b6, c4, c5, c6, c8, c9, f14, e12, b14, b11, b25, b28, b29, c24, c27; JTextField t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25, t26, t27, t28; double c9i, c8i, h3, h4, i3, i4, j3, j4, d8, b10, c10, c12, d10, e10, d16, d17, e16, e12b, e17, f16, f17, d12, d12d, h5, h11b, b16, b16d, b28b, c23, c22, c25, c25b, c26, c26b, c28, c28b, c29, c29b, f23; double number1, number2, number3, number4, number5, number6, number7, number8, number9, number10, number11, number12, number13, number14, number15, number16, number17; String one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen; String a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y; JFrame win; PrintWriter qwrite;
void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy){ gbc.gridx = gx; gbc.gridy = gy; gbc.gridwidth = gw; gbc.gridheight = gh; gbc.weightx = wx; gbc.weighty = wy; }
FI(){ openFile();
EventListen el = new EventListen();
GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); getContentPane().setLayout(gridbag);
buildConstraints(constraints, 1, 0, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel warp = new JLabel("Warp", JLabel.CENTER); gridbag.setConstraints(warp, constraints); getContentPane().add(warp);
buildConstraints(constraints, 3, 0, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel weft = new JLabel("Weft", JLabel.CENTER); gridbag.setConstraints(weft, constraints); getContentPane().add(weft);
buildConstraints(constraints, 5, 0, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel reed = new JLabel("Reed", JLabel.CENTER); gridbag.setConstraints(reed, constraints); getContentPane().add(reed);
buildConstraints(constraints, 7, 0, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel pick = new JLabel("Pick", JLabel.CENTER); gridbag.setConstraints(pick, constraints); getContentPane().add(pick);
buildConstraints(constraints, 9, 0, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; JLabel width = new JLabel("Width", JLabel.CENTER); gridbag.setConstraints(width, constraints); getContentPane().add(width);
buildConstraints(constraints, 11, 0, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; JLabel width1 = new JLabel("Width", JLabel.CENTER); gridbag.setConstraints(width1, constraints); getContentPane().add(width1);
buildConstraints(constraints, 0, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt1 = new JLabel("Yarn Count", JLabel.CENTER); gridbag.setConstraints(prompt1, constraints); getContentPane().add (prompt1);
buildConstraints(constraints, 2, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt2 = new JLabel("x", JLabel.CENTER); gridbag.setConstraints(prompt2, constraints); getContentPane().add (prompt2);
buildConstraints(constraints, 4, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt4 = new JLabel("/", JLabel.CENTER); gridbag.setConstraints(prompt4, constraints); getContentPane().add (prompt4);
buildConstraints(constraints, 6, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt6 = new JLabel("x", JLabel.CENTER); gridbag.setConstraints(prompt6, constraints); getContentPane().add (prompt6);
buildConstraints(constraints, 10, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt7 = new JLabel("in", JLabel.CENTER); gridbag.setConstraints(prompt7, constraints); getContentPane().add (prompt7);
buildConstraints(constraints, 12, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel cm = new JLabel("cm", JLabel.CENTER); gridbag.setConstraints(cm, constraints); getContentPane().add(cm);
buildConstraints(constraints, 0, 2, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt8 = new JLabel("Yarn Price", JLabel.CENTER); gridbag.setConstraints(prompt8, constraints); getContentPane().add (prompt8);
buildConstraints(constraints, 0, 3, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt9 = new JLabel("Sizing Charges", JLabel.CENTER); gridbag.setConstraints(prompt9, constraints); getContentPane().add (prompt9);
buildConstraints(constraints, 2, 3, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel rup = new JLabel("Rs/lb", JLabel.CENTER); gridbag.setConstraints(rup, constraints); getContentPane().add(rup);
buildConstraints(constraints, 0, 4, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt11 = new JLabel("Weaving charges", JLabel.CENTER); gridbag.setConstraints(prompt11, constraints); getContentPane().add (prompt11);
buildConstraints(constraints, 2, 4, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt12 = new JLabel("paisa/pick", JLabel.CENTER); gridbag.setConstraints(prompt12, constraints); getContentPane().add (prompt12);
buildConstraints(constraints, 0, 5, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt13 = new JLabel("Wastage", JLabel.CENTER); gridbag.setConstraints(prompt13, constraints); getContentPane().add (prompt13);
buildConstraints(constraints, 1, 6, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt14 = new JLabel("lbs/m", JLabel.CENTER); gridbag.setConstraints(prompt14, constraints); getContentPane().add (prompt14);
buildConstraints(constraints, 2, 6, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt15 = new JLabel("gms/m", JLabel.CENTER); gridbag.setConstraints(prompt15, constraints); getContentPane().add (prompt15);
buildConstraints(constraints, 3, 6, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt16 = new JLabel("Rs/m:", JLabel.CENTER); gridbag.setConstraints(prompt16, constraints); getContentPane().add (prompt16);
buildConstraints(constraints, 0, 7, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt17 = new JLabel("Warp", JLabel.CENTER); gridbag.setConstraints(prompt17, constraints); getContentPane().add (prompt17);
buildConstraints(constraints, 0, 8, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt18 = new JLabel("Weft", JLabel.CENTER); gridbag.setConstraints(prompt18, constraints); getContentPane().add (prompt18);
buildConstraints(constraints, 0, 9, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt19 = new JLabel("Rs/m", JLabel.CENTER); gridbag.setConstraints(prompt19, constraints); getContentPane().add (prompt19);
buildConstraints(constraints, 1, 10, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt20 = new JLabel("GSM", JLabel.CENTER); gridbag.setConstraints(prompt20, constraints); getContentPane().add (prompt20);
buildConstraints(constraints, 2, 10, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt24 = new JLabel("GLM", JLabel.CENTER); gridbag.setConstraints(prompt24, constraints); getContentPane().add (prompt24);
buildConstraints(constraints, 3, 10, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt25 = new JLabel("LBS/40 YDS", JLabel.CENTER); gridbag.setConstraints(prompt25, constraints); getContentPane().add (prompt25);
buildConstraints(constraints, 4, 10, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt26 = new JLabel("OZ/SQ YDS", JLabel.CENTER); gridbag.setConstraints(prompt26, constraints); getContentPane().add (prompt26);
buildConstraints(constraints, 0, 12, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel price = new JLabel("Price", JLabel.CENTER); gridbag.setConstraints(price, constraints); getContentPane().add(price);
buildConstraints(constraints, 0, 13, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt27 = new JLabel("Yarns for", JLabel.CENTER); gridbag.setConstraints(prompt27, constraints); getContentPane().add (prompt27);
buildConstraints(constraints, 2, 13, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt33 = new JLabel("m of greige", JLabel.CENTER); gridbag.setConstraints(prompt33, constraints); getContentPane().add (prompt33);
buildConstraints(constraints, 1, 14, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt28 = new JLabel("Warp", JLabel.CENTER); gridbag.setConstraints(prompt28, constraints); getContentPane().add (prompt28);
buildConstraints(constraints, 2, 14, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt29 = new JLabel("Weft", JLabel.CENTER); gridbag.setConstraints(prompt29, constraints); getContentPane().add (prompt29);
buildConstraints(constraints, 3, 14, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt30 = new JLabel("Total", JLabel.CENTER); gridbag.setConstraints(prompt30, constraints); getContentPane().add (prompt30);
buildConstraints(constraints, 0, 16, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt31 = new JLabel("Value", JLabel.CENTER); gridbag.setConstraints(prompt31, constraints); getContentPane().add (prompt31);
buildConstraints(constraints, 0, 17, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt32 = new JLabel("Greige width", JLabel.CENTER); gridbag.setConstraints(prompt32, constraints); getContentPane().add (prompt32);
buildConstraints(constraints, 0, 18, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt34 = new JLabel("Greige fabric", JLabel.CENTER); gridbag.setConstraints(prompt34, constraints); getContentPane().add (prompt34);
buildConstraints(constraints, 0, 19, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt35 = new JLabel("Processing charges", JLabel.CENTER); gridbag.setConstraints(prompt35, constraints); getContentPane().add (prompt35);
buildConstraints(constraints, 0, 20, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt36 = new JLabel("Processing wastage", JLabel.CENTER); gridbag.setConstraints(prompt36, constraints); getContentPane().add (prompt36);
buildConstraints(constraints, 0, 21, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt37 = new JLabel("Price", JLabel.CENTER); gridbag.setConstraints(prompt37, constraints); getContentPane().add (prompt37);
buildConstraints(constraints, 0, 22, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt38 = new JLabel("Frieght", JLabel.CENTER); gridbag.setConstraints(prompt38, constraints); getContentPane().add (prompt38);
buildConstraints(constraints, 0, 23, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt39 = new JLabel("Profit(%)", JLabel.CENTER); gridbag.setConstraints(prompt39, constraints); getContentPane().add (prompt39);
buildConstraints(constraints, 0, 24, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt43 = new JLabel("Currency Conversion", JLabel.CENTER); gridbag.setConstraints(prompt43, constraints); getContentPane().add (prompt43);
buildConstraints(constraints, 1, 24, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt40 = new JLabel("Rs", JLabel.CENTER); gridbag.setConstraints(prompt40, constraints); getContentPane().add (prompt40);
buildConstraints(constraints, 3, 24, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; JLabel prompt41 = new JLabel("per $", JLabel.CENTER); gridbag.setConstraints(prompt41, constraints); getContentPane().add (prompt41);
buildConstraints(constraints, 1, 25, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; save = new JButton("Save"); gridbag.setConstraints(save, constraints); getContentPane().add(save); save.addActionListener(el);
buildConstraints(constraints, 0, 25, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; refresh = new JButton("Refresh"); gridbag.setConstraints(refresh, constraints); getContentPane().add(refresh); refresh.addActionListener(el);
buildConstraints(constraints, 2, 25, 1, 1, 0, 0); constraints.fill = GridBagConstraints.NONE; exit = new JButton("Exit"); gridbag.setConstraints(exit, constraints); getContentPane().add(exit); exit.addActionListener(el); //co-ords corrected
buildConstraints(constraints, 1, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b4 = new JTextField(6); gridbag.setConstraints(b4, constraints); getContentPane().add(b4); b4.addActionListener(el);
buildConstraints(constraints, 3, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; c4 = new JTextField(6); gridbag.setConstraints(c4, constraints); getContentPane().add(c4); c4.addActionListener(el);
buildConstraints(constraints, 5, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b5 = new JTextField(6); gridbag.setConstraints(b5, constraints); getContentPane().add(b5); b5.addActionListener(el);
buildConstraints(constraints, 7, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; c5 = new JTextField(6); gridbag.setConstraints(c5, constraints); getContentPane().add(c5); c5.addActionListener(el);
buildConstraints(constraints, 1, 2, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b6 = new JTextField(6); gridbag.setConstraints(b6, constraints); getContentPane().add(b6); b6.addActionListener(el);
buildConstraints(constraints, 3, 2, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; c6 = new JTextField(6); gridbag.setConstraints(c6, constraints); getContentPane().add(c6); c6.addActionListener(el);
buildConstraints(constraints, 9, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; c8 = new JTextField(6); gridbag.setConstraints(c8, constraints); getContentPane().add(c8); c8.addActionListener(el);
buildConstraints(constraints, 11, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; c9 = new JTextField(6); gridbag.setConstraints(c9, constraints); getContentPane().add(c9); c9.addActionListener(el);
buildConstraints(constraints, 1, 3, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b11 = new JTextField(6); gridbag.setConstraints(b11, constraints); getContentPane().add(b11); b11.addActionListener(el);
buildConstraints(constraints, 1, 4, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; e12 = new JTextField(6); gridbag.setConstraints(e12, constraints); getContentPane().add(e12); e12.addActionListener(el);
buildConstraints(constraints, 1, 5, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b14 = new JTextField(6); gridbag.setConstraints(b14, constraints); getContentPane().add(b14); b14.addActionListener(el);
buildConstraints(constraints, 1, 13, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; f14 = new JTextField(6); gridbag.setConstraints(f14, constraints); getContentPane().add(f14); f14.addActionListener(el);
buildConstraints(constraints, 1, 19, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; c24 = new JTextField(6); gridbag.setConstraints(c24, constraints); getContentPane().add(c24); c24.addActionListener(el);
buildConstraints(constraints, 1, 20, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b25 = new JTextField(6); gridbag.setConstraints(b25, constraints); getContentPane().add(b25); b25.addActionListener(el);
buildConstraints(constraints, 1, 22, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; c27 = new JTextField(6); gridbag.setConstraints(c27, constraints); getContentPane().add(c27); c27.addActionListener(el);
buildConstraints(constraints, 1, 23, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b28 = new JTextField(6); gridbag.setConstraints(b28, constraints); getContentPane().add(b28); b28.addActionListener(el);
buildConstraints(constraints, 2, 24, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; b29 = new JTextField(6); gridbag.setConstraints(b29, constraints); b29.addActionListener(el); getContentPane().add(b29); //end of input fields
//start of output fields buildConstraints(constraints, 1, 7, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t1 = new JTextField(); t1.setEditable(false); gridbag.setConstraints(t1, constraints); getContentPane().add(t1); //h3
buildConstraints(constraints, 1, 8, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t2 = new JTextField(); t2.setEditable(false); gridbag.setConstraints(t2, constraints); getContentPane().add(t2);//h4
buildConstraints(constraints, 1, 9, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t3 = new JTextField(); t3.setEditable(false); gridbag.setConstraints(t3, constraints); getContentPane().add(t3);//h5
buildConstraints(constraints, 2, 7, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t4 = new JTextField(); t4.setEditable(false); gridbag.setConstraints(t4, constraints); getContentPane().add(t4);//i3
buildConstraints(constraints, 2, 8, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t5 = new JTextField();t5.setEditable(false); gridbag.setConstraints(t5, constraints); getContentPane().add(t5);//i4
buildConstraints(constraints, 3, 7, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t6 = new JTextField(); t6.setEditable(false); gridbag.setConstraints(t6, constraints); getContentPane().add(t6);//j3
buildConstraints(constraints, 3, 8, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t7 = new JTextField(); t7.setEditable(false); gridbag.setConstraints(t7, constraints); getContentPane().add(t7);//j4
buildConstraints(constraints, 1, 11, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t8 = new JTextField(); t8.setEditable(false); gridbag.setConstraints(t8, constraints); getContentPane().add(t8);//b10
buildConstraints(constraints, 2, 11, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t9 = new JTextField(); t9.setEditable(false); gridbag.setConstraints(t9, constraints); getContentPane().add(t9);//c10
buildConstraints(constraints, 3, 11, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t10 = new JTextField(); t10.setEditable(false); gridbag.setConstraints(t10, constraints); getContentPane().add(t10);//d10
buildConstraints(constraints, 4, 11, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t11 = new JTextField(); t11.setEditable(false); gridbag.setConstraints(t11, constraints); getContentPane().add(t11);//e10
buildConstraints(constraints, 3, 4, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t13 = new JTextField(); t13.setEditable(false); gridbag.setConstraints(t13, constraints); getContentPane().add(t13);//d12
buildConstraints(constraints, 1, 12, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t14 = new JTextField(); t14.setEditable(false); gridbag.setConstraints(t14, constraints); getContentPane().add(t14);//b16
buildConstraints(constraints, 1, 16, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t15 = new JTextField(); t15.setEditable(false); gridbag.setConstraints(t15, constraints); getContentPane().add(t15);//d16
buildConstraints(constraints, 1, 15, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t16 = new JTextField(); t16.setEditable(false); gridbag.setConstraints(t16, constraints); getContentPane().add(t16);//d17
buildConstraints(constraints, 2, 15, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t17 = new JTextField(); t17.setEditable(false); gridbag.setConstraints(t17, constraints); getContentPane().add(t17);//e16
buildConstraints(constraints, 2, 16, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t18 = new JTextField(); t18.setEditable(false); gridbag.setConstraints(t18, constraints); getContentPane().add(t18);//e17
buildConstraints(constraints, 3, 15, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t19 = new JTextField(); t19.setEditable(false); gridbag.setConstraints(t19, constraints); getContentPane().add(t19);//f16
buildConstraints(constraints, 3, 16, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t20 = new JTextField(); t20.setEditable(false); gridbag.setConstraints(t20, constraints); getContentPane().add(t20);//f17
buildConstraints(constraints, 1, 17, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t21 = new JTextField(); t21.setEditable(false); gridbag.setConstraints(t21, constraints); getContentPane().add(t21); //c22
buildConstraints(constraints, 1, 18, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t22 = new JTextField(); t22.setEditable(false); gridbag.setConstraints(t22, constraints); getContentPane().add(t22);//c23
buildConstraints(constraints, 2, 20, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t23 = new JTextField(); t23.setEditable(false); gridbag.setConstraints(t23, constraints); getContentPane().add(t23); //c25
buildConstraints(constraints, 1, 21, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t24 = new JTextField(); t24.setEditable(false); gridbag.setConstraints(t24, constraints); getContentPane().add(t24); //c26
buildConstraints(constraints, 2, 23, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t25 = new JTextField(); t25.setEditable(false); gridbag.setConstraints(t25, constraints); getContentPane().add(t25);//b28
buildConstraints(constraints, 4, 24, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; t26 = new JTextField(); t26.setEditable(false); gridbag.setConstraints(t26, constraints); getContentPane().add(t26);//b29 //co-ords correct setVisible(true); }
public double h3m(double x, double y, double z){ return (double) ((x * y * 1.07 * 1.0936) / (840 * z)); }
public double h4m(double x, double y, double z){ return (double) ((x * y * 1.06 * 1.0936) / (840 * z)); }
public double h5m(double x, double y){ return (double) (x * y); }
public double i3m(double x){ return (double) (x * 453.59); }
public double i4m(double x){ return (double) (x * 453.59); }
public double j3m(double x, double y){ return (double) (x * y); }
public double j4m(double x, double y){ return (double) (x * y); }
public double b10m(double w, double x, double y, double z){ return (double) (((w/x) + (y/z)) * 25.4); } // w = b5, x = b4, y = c5, x = c4
public double c10m(double x, double y){ return (double) (x * (y/39.37)); }//x = b10, y = c8
public double d10m(double x){ return (double) ((x * 36 * 40)/(453.59 * 39.37)); }// x = c10
public double e10m(double x){ return (double) ((x * 16 * 0.9144 * 0.9144)/453.59); }// x = b10
public double d12m(double x, double y){ return (double) ((x/100) * y); }// x = e12, y = c5
public double b16m(double v, double w, double x, double y, double z){ return (double) (v + w + x + y)*(1 + (z/100)); }// v = j3, w = j4, x = h5, y = c12, z = b14
public double d16m(double x, double y){ return (double) (x * y); }//x = h3, y = f14
public double e16m(double x, double y){ return (double) (x * y); }//x = h4, y = f14
public double f16m(double x, double y){ return (double) (x + y); }//x = d16, y = e16
public double d17m(double x, double y){ return (double) (x * y); }//x = d16, y = b6
public double e17m(double x, double y){ return (double) (x * y); }//x = e16, y = c6
public double f17m(double x, double y){ return (double) (x + y); }// x = d17, y = e17
public double c22m(double x){ return (double) x; }// x = c8
public double c23m(double x){ return (double) x; }// x = b16
public double c25m(double x, double y, double z){ return (double) ((x + y)*(z/100)); }// x = c23, y = c24, z = b25
public double c26m(double x, double y, double z){ return (double) (x + y + z); }// x = c23, y = c24, z = c25
public double c28m(double x, double y, double z){ return (double) ((x + y)*(1 + (z/100))); }// x = c26, y = c27, z = b28
public double c29m(double x, double y){ return (double) (x / y); }// x = c28, y = b29
public double c8m (double x){ return (double) (x/2.54); }// x = c9
public double c9m (double x){ return (double) (x * 2.54); }// x = c8
class EventListen implements ActionListener{
public void actionPerformed(ActionEvent e){
win = new Error1(); // win.resize(200, 100);
DecimalFormat f = new DecimalFormat("#.##");
try{ if (e.getSource() == b4){ one = b4.getText(); number1 = Double.valueOf(one.trim()).doubleValue(); } else if (e.getSource() == c4){ two = c4.getText(); number2 = Double.valueOf(two.trim()).doubleValue(); } else if (e.getSource() == b5){ three = b5.getText(); number3 = Double.valueOf(three.trim()).doubleValue(); } else if (e.getSource() == c5){ four = c5.getText(); number4 = Double.valueOf(four.trim()).doubleValue(); }else if (e.getSource() == b6){ six = b6.getText(); number6 = Double.valueOf(six.trim()).doubleValue(); }else if (e.getSource() == c6){ seven = c6.getText(); number7 = Double.valueOf(seven.trim()).doubleValue(); } else if (e.getSource() == f14){ eight = f14.getText(); number8 = Double.valueOf(eight.trim()).doubleValue(); }else if (e.getSource() == e12){ nine = e12.getText(); number9 = Double.valueOf(nine.trim()).doubleValue(); } else if (e.getSource() == b11){ eleven = b11.getText(); number11 = Double.valueOf(eleven.trim()).doubleValue(); }else if (e.getSource() == b14){ ten = b14.getText(); number10 = Double.valueOf(ten.trim()).doubleValue(); } else if (e.getSource() == b25){ twelve = b25.getText(); number12 = Double.valueOf(twelve.trim()).doubleValue(); } else if (e.getSource() == b28){ thirteen = b28.getText(); number13 = Double.valueOf(thirteen.trim()).doubleValue(); } else if (e.getSource() == c24){ fourteen = c24.getText(); number14 = Double.valueOf(fourteen.trim()).doubleValue(); } else if (e.getSource() == c27){ fifteen = c27.getText(); number15 = Double.valueOf(fifteen.trim()).doubleValue(); } else if (e.getSource() == b29){ sixteen = b29.getText(); number16 = Double.valueOf(sixteen.trim()).doubleValue(); } } catch (NumberFormatException nfe){ win.show(); win.setSize(200, 100); }
if (e.getSource() == c8){ five = c8.getText(); number5 = Double.valueOf(five.trim()).doubleValue(); c9i = c9m(number5); c9.setText(f.format(c9i)); }else if (e.getSource() == c9){ five = c9.getText(); number5 = Double.valueOf(five.trim()).doubleValue(); c8i = c8m(number5); c8.setText(f.format(c8i)); }
h3 = h3m(number3, number5, number1); t1.setText(f.format(h3)); h4 = h4m(number4, number5, number2); t2.setText(f.format(h4)); h5 = h5m(h3, number11); t3.setText(f.format(h5)); i3 = i3m(h3); t4.setText(f.format(i3)); i4 = i4m(h4); t5.setText(f.format(i4)); j3 = j3m(h3, number6); t6.setText(f.format(j3)); j4 = j4m(h4, number7); t7.setText(f.format(j4)); b10 = b10m(number3, number1, number4, number2); t8.setText(f.format(b10)); c10 = c10m(b10, number5); t9.setText(f.format(c10)); d10 = d10m(c10); t10.setText(f.format(d10)); e10 = e10m(b10); t11.setText(f.format(e10)); d12 = d12m(number9, number4); t13.setText(f.format(d12)); b16 = b16m(j3, j4, h5, c12, number10); t14.setText(f.format(b16)); d16 = d16m(h3, number8); t15.setText(f.format(d16)); e16 = e16m(h4, number8); t17.setText(f.format(e16)); f16 = f16m(d16, e16); t19.setText(f.format(f16)); d17 = d17m(d16, number6); t16.setText(f.format(d17)); e17 = e17m(e16, number7); t18.setText(f.format(e17)); f17 = f17m(d17, e17); t20.setText(f.format(f17)); c22 = c22m(number5); t21.setText(f.format(c22)); c23 = c23m(b16); t22.setText(f.format(c23)); c25 = c25m(c23, number14, number12); t23.setText(f.format(c25)); c26 = c26m(c23, number14, c25); t24.setText(f.format(c26)); c28 = c28m(c26, number15, number13); t25.setText(f.format(c28)); c29 = c29m(c28, number16); t26.setText(f.format(c29));
if (e.getSource() == save){ addRecord(); }if (e.getSource() == exit){ closeFile(); }if (e.getSource() == refresh){ b4.setText(""); c4.setText(""); b5.setText(""); c5.setText(""); c8.setText(""); c9.setText(""); b6.setText(""); c6.setText(""); f14.setText(""); e12.setText(""); b14.setText(""); b11.setText(""); b25.setText(""); b28.setText(""); c24.setText(""); c27.setText(""); b29.setText(""); t1.setText(""); t2.setText(""); t3.setText(""); t4.setText(""); t5.setText(""); t6.setText(""); t7.setText(""); t8.setText(""); t9.setText(""); t10.setText(""); t11.setText(""); t12.setText(""); t13.setText(""); t14.setText(""); t15.setText(""); t16.setText(""); t17.setText(""); t18.setText(""); t19.setText(""); t20.setText(""); t21.setText(""); t22.setText(""); t23.setText(""); t24.setText(""); t25.setText(""); t26.setText(""); } } } void openFile(){ try{ qwrite = new PrintWriter(new FileWriter("costings.csv")); } catch(IOException ou){ win.show(); } }
void addRecord(){ //for button save one = b4.getText(); two = c4.getText(); three = b5.getText(); four = c5.getText(); five = c8.getText(); six = b6.getText(); seven = c6.getText(); eight = f14.getText(); seventeen = c9.getText(); nine = e12.getText(); eleven = b11.getText(); ten = b14.getText(); twelve = b25.getText(); thirteen = b28.getText(); fourteen = c24.getText(); fifteen = c27.getText(); sixteen = b29.getText(); a = t1.getText(); b = t2.getText(); c = t3.getText(); d = t4.getText(); e = t5.getText(); f = t6.getText(); g = t7.getText(); h = t8.getText(); i = t9.getText(); j = t10.getText(); k = t11.getText(); l = t13.getText(); m = t14.getText(); n = t15.getText(); o = t17.getText(); p = t19.getText(); q = t16.getText(); r = t18.getText(); s = t20.getText(); t = t21.getText(); u = t22.getText(); v = t23.getText(); w = t24.getText(); x = t25.getText(); y = t26.getText(); qwrite.println(", Warp, , Weft, , Reed, , Pick, , Width in/cm, Width in/cm"); qwrite.println("Yarn Count," + one + ",x," + two + ",/," + three + ",x," + four + ",," + five + ", " + seventeen ); qwrite.println("Yarn Price," + six + ",," + seven); qwrite.println("Sizing Charges," + eleven + ", Rs/lb"); qwrite.println("Weaving Charges," + nine + ", paisa/pick," + l); qwrite.println("Wastage, " + ten); qwrite.println(", lb/m, gms/m, Rs/m"); qwrite.println("Warp, " + a + "," + d + ", " + f); qwrite.println("Weft, " + b + "," + e + "," + g); qwrite.println("Rs/m, " + c); qwrite.println(", GSM, GLM, LBS/40 YDS, OZ/SQ YDS"); qwrite.println("," + h + "," + i + "," + j + "," + k); qwrite.println("Price," + m); qwrite.println("Yarns for, " + eight + ", m of greige"); qwrite.println(", Warp, Weft, Total"); qwrite.println("," + q + "," + o + "," + p); qwrite.println("Value," + n + "," + r + "," + s); qwrite.println("Greige width," + t); qwrite.println("Greige fabric," + u); qwrite.println("Processing charges," + fourteen); qwrite.println("Processing wastage," + twelve + "," + v); qwrite.println("Price, " + w); qwrite.println("Freight, " + fifteen); qwrite.println("Profit(%)," + thirteen); qwrite.println("Currency Conversion, Rs," + sixteen + ", per $, " + y); }
void closeFile(){ qwrite.close(); System.exit(0); }
public static void main(String [] args) throws IOException{ FI fi = new FI(); fi.setSize(700, 600); fi.show(); } }
and the error window:- import java.awt.*; import java.awt.event.*; import javax.swing.*;
public class Error1 extends JFrame{
FlowLayout fl = new FlowLayout();
Error1(){ getContentPane().setLayout(fl); JLabel l = new JLabel("Incorrect Input"); JLabel m = new JLabel("Fields accept numeric values only"); getContentPane().add(l); getContentPane().add(m); }
public static void main(String [] args){ Error1 err = new Error1(); WindowListener wl = new WindowAdapter(){ public void windowClosing(WindowEvent e){ ((Window) e.getSource()).dispose(); System.exit(0); } }; err.addWindowListener(wl); err.setSize(200, 100); err.show(); } }
|
|