|
| 1 | +import java.awt.BorderLayout; |
| 2 | +import java.awt.EventQueue; |
| 3 | + |
| 4 | +import javax.swing.JFrame; |
| 5 | +import javax.swing.JPanel; |
| 6 | +import javax.swing.border.EmptyBorder; |
| 7 | +import javax.swing.JLabel; |
| 8 | +import java.awt.Font; |
| 9 | +import java.awt.Color; |
| 10 | +import javax.swing.JButton; |
| 11 | +import java.awt.event.ActionListener; |
| 12 | +import java.awt.event.ActionEvent; |
| 13 | +import javax.swing.AbstractAction; |
| 14 | +import javax.swing.Action; |
| 15 | +import javax.swing.JTextField; |
| 16 | + |
| 17 | +public class First extends JFrame { |
| 18 | + static int c=0; |
| 19 | + private JPanel contentPane; |
| 20 | + private final Action action = new SwingAction(); |
| 21 | + private JTextField textField; |
| 22 | + private JTextField textField_1; |
| 23 | + private JTextField textField_2; |
| 24 | + private JTextField textField_3; |
| 25 | + private JTextField textField_4; |
| 26 | + private JTextField textField_5; |
| 27 | + private JTextField textField_6; |
| 28 | + private JButton button; |
| 29 | + private JLabel lblNewLabel_1; |
| 30 | + private JButton btnBack; |
| 31 | + |
| 32 | + /** |
| 33 | + * Launch the application. |
| 34 | + */ |
| 35 | + public static void main(String[] args) { |
| 36 | + EventQueue.invokeLater(new Runnable() { |
| 37 | + public void run() { |
| 38 | + try { |
| 39 | + itemset newobj=new itemset(); |
| 40 | + c=newobj.o; |
| 41 | + First frame = new First(); |
| 42 | + frame.setVisible(true); |
| 43 | + } catch (Exception e) { |
| 44 | + e.printStackTrace(); |
| 45 | + } |
| 46 | + } |
| 47 | + }); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Create the frame. |
| 52 | + */ |
| 53 | + public First() { |
| 54 | + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 55 | + setBounds(100, 100, 450, 300); |
| 56 | + contentPane = new JPanel(); |
| 57 | + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
| 58 | + setContentPane(contentPane); |
| 59 | + contentPane.setLayout(null); |
| 60 | + |
| 61 | + SimpleLR obj=new SimpleLR(); |
| 62 | + itemset newobj=new itemset(); |
| 63 | + c=newobj.o; |
| 64 | + button = new JButton("Click ME!!"); |
| 65 | + button.addActionListener(new ActionListener() { |
| 66 | + public void actionPerformed(ActionEvent e) { |
| 67 | + int temp=0,temp2=0; |
| 68 | + temp2=obj.in[c]; |
| 69 | + if(obj.il[c][0]!=null && temp2>0) |
| 70 | + { temp=1; |
| 71 | + textField.setText(obj.il[c][0]+"->"+obj.ir[c][0]); |
| 72 | + } |
| 73 | + if(obj.il[c][1]!=null && obj.il[c][0]!=null && temp2>1) |
| 74 | + { |
| 75 | + textField_1.setText(obj.il[c][1]+"->"+obj.ir[c][1]); |
| 76 | + } |
| 77 | + if(obj.il[c][2]!=null && obj.il[c][0]!=null && temp2>2) |
| 78 | + { textField_2.setText(obj.il[c][2]+"->"+obj.ir[c][2]); |
| 79 | + } |
| 80 | + if(obj.il[c][3]!=null && obj.il[c][0]!=null && temp2>3) |
| 81 | + { textField_3.setText(obj.il[c][3]+"->"+obj.ir[c][3]); |
| 82 | + } |
| 83 | + if(obj.il[c][4]!=null && obj.il[c][0]!=null && temp2>4) |
| 84 | + { textField_4.setText(obj.il[c][4]+"->"+obj.ir[c][4]); |
| 85 | + } |
| 86 | + if(obj.il[c][5]!=null && obj.il[c][0]!=null && temp2>5) |
| 87 | + { textField_5.setText(obj.il[c][5]+"->"+obj.ir[c][5]); |
| 88 | + } |
| 89 | + if(obj.il[c][6]!=null && obj.il[c][0]!=null && temp2>6) |
| 90 | + { textField_6.setText(obj.il[c][6]+"->"+obj.ir[c][6]); |
| 91 | + } |
| 92 | + System.out.println("c:"+c+"and o:"+newobj.o+"and value of in:"+temp2); |
| 93 | + |
| 94 | + if(temp==0){ |
| 95 | + lblNewLabel_1.setText("SORRY NO PRODUCTION!!! "); |
| 96 | + } |
| 97 | + |
| 98 | + } |
| 99 | + }); |
| 100 | + button.setBounds(40, 89, 89, 23); |
| 101 | + contentPane.add(button); |
| 102 | + |
| 103 | + textField = new JTextField(); |
| 104 | + textField.setFont(new Font("Monospaced", Font.PLAIN, 14)); |
| 105 | + textField.setColumns(10); |
| 106 | + textField.setBounds(215, 51, 86, 20); |
| 107 | + contentPane.add(textField); |
| 108 | + |
| 109 | + textField_1 = new JTextField(); |
| 110 | + textField_1.setFont(new Font("Monospaced", Font.PLAIN, 14)); |
| 111 | + textField_1.setColumns(10); |
| 112 | + textField_1.setBounds(215, 82, 86, 20); |
| 113 | + contentPane.add(textField_1); |
| 114 | + |
| 115 | + textField_2 = new JTextField(); |
| 116 | + textField_2.setFont(new Font("Monospaced", Font.PLAIN, 14)); |
| 117 | + textField_2.setColumns(10); |
| 118 | + textField_2.setBounds(215, 111, 86, 20); |
| 119 | + contentPane.add(textField_2); |
| 120 | + |
| 121 | + textField_3 = new JTextField(); |
| 122 | + textField_3.setFont(new Font("Monospaced", Font.PLAIN, 14)); |
| 123 | + textField_3.setColumns(10); |
| 124 | + textField_3.setBounds(215, 143, 86, 20); |
| 125 | + contentPane.add(textField_3); |
| 126 | + |
| 127 | + textField_4 = new JTextField(); |
| 128 | + textField_4.setFont(new Font("Monospaced", Font.PLAIN, 14)); |
| 129 | + textField_4.setColumns(10); |
| 130 | + textField_4.setBounds(215, 174, 86, 20); |
| 131 | + contentPane.add(textField_4); |
| 132 | + |
| 133 | + textField_5 = new JTextField(); |
| 134 | + textField_5.setFont(new Font("Monospaced", Font.PLAIN, 14)); |
| 135 | + textField_5.setColumns(10); |
| 136 | + textField_5.setBounds(215, 203, 86, 20); |
| 137 | + contentPane.add(textField_5); |
| 138 | + |
| 139 | + JLabel lblNewLabel = new JLabel("ITEMS"); |
| 140 | + lblNewLabel.setFont(new Font("Copperplate Gothic Bold", Font.PLAIN, 22)); |
| 141 | + lblNewLabel.setBounds(40, 11, 169, 34); |
| 142 | + contentPane.add(lblNewLabel); |
| 143 | + |
| 144 | + textField_6 = new JTextField(); |
| 145 | + textField_6.setFont(new Font("Monospaced", Font.PLAIN, 14)); |
| 146 | + textField_6.setBounds(215, 234, 86, 20); |
| 147 | + contentPane.add(textField_6); |
| 148 | + textField_6.setColumns(10); |
| 149 | + |
| 150 | + lblNewLabel_1 = new JLabel(""); |
| 151 | + lblNewLabel_1.setFont(new Font("Copperplate Gothic Bold", Font.PLAIN, 12)); |
| 152 | + lblNewLabel_1.setBounds(25, 143, 150, 80); |
| 153 | + contentPane.add(lblNewLabel_1); |
| 154 | + |
| 155 | + btnBack = new JButton("BACK**"); |
| 156 | + btnBack.addActionListener(new ActionListener() { |
| 157 | + public void actionPerformed(ActionEvent e) { |
| 158 | + First newfirst=new First(); |
| 159 | + newfirst.dispose(); |
| 160 | + itemset newset=new itemset(); |
| 161 | + newset.setVisible(true); |
| 162 | + } |
| 163 | + }); |
| 164 | + btnBack.setFont(new Font("Copperplate Gothic Light", Font.ITALIC, 12)); |
| 165 | + btnBack.setBounds(335, 227, 89, 23); |
| 166 | + contentPane.add(btnBack); |
| 167 | + } |
| 168 | + private class SwingAction extends AbstractAction { |
| 169 | + public SwingAction() { |
| 170 | + putValue(NAME, "SwingAction"); |
| 171 | + putValue(SHORT_DESCRIPTION, "Some short description"); |
| 172 | + } |
| 173 | + public void actionPerformed(ActionEvent e) { |
| 174 | + } |
| 175 | + } |
| 176 | +} |
0 commit comments