fork download
  1. import java.awt.FlowLayout;
  2. import java.awt.event.ActionEvent;
  3. import java.awt.event.ActionListener;
  4.  
  5. import javax.swing.JButton;
  6. import javax.swing.JFrame;
  7. import javax.swing.JLabel;
  8. import javax.swing.JTextArea;
  9. import javax.swing.JTextField;
  10.  
  11.  
  12. public class televison extends JFrame implements ActionListener{
  13.  
  14. int model,price,size;
  15.  
  16.  
  17. JLabel l1,l2,l3;
  18. JTextField t1,t2,t3;
  19. JButton b1,b2,b3,b4;
  20.  
  21.  
  22.  
  23. void setzero()
  24. {
  25. model=0;
  26. price=0;
  27. size=0;
  28. }
  29.  
  30. public televison() {
  31. // TODO Auto-generated constructor stub
  32.  
  33. l1=new JLabel("Model");
  34. l2=new JLabel("price");
  35. l3=new JLabel("size");
  36.  
  37. b1=new JButton("Model");
  38. b2=new JButton("price");
  39. b3=new JButton("size");
  40. b4=new JButton("Show");
  41.  
  42.  
  43. t1=new JTextField(25);
  44. t2=new JTextField(25);
  45. t3=new JTextField(25);
  46.  
  47. ta=new JTextArea();
  48.  
  49. add(l1);
  50. add(t1);
  51. add(l2);
  52. add(t2);
  53. add(l3);
  54. add(t3);
  55. add(ta);
  56.  
  57. add(b1);
  58. add(b2);
  59. add(b3);
  60. add(b4);
  61.  
  62. b1.addActionListener(this);
  63. b2.addActionListener(this);
  64. b3.addActionListener(this);
  65.  
  66.  
  67. setLayout(new FlowLayout());
  68.  
  69. }
  70.  
  71.  
  72.  
  73. public static void main(String[] args) {
  74. // TODO Auto-generated method stub
  75.  
  76.  
  77. televison t=new televison();
  78. t.setSize(1000, 400);
  79. t.setVisible(true); }
  80.  
  81.  
  82.  
  83. @Override
  84. public void actionPerformed(ActionEvent e) {
  85. // TODO Auto-generated method stub
  86.  
  87.  
  88. if(e.getSource()==b1)
  89. {
  90. String s=t1.getText();
  91.  
  92. model=Integer.parseInt(s);
  93.  
  94. if(model>9999)
  95. {
  96. try {
  97. throw new NOTMODEL();
  98. } catch (NOTMODEL e1) {
  99. // TODO Auto-generated catch block
  100. //e1.printStackTrace();
  101.  
  102. setzero();
  103. ta.setText(" "+model+" "+price+" "+size);
  104. }
  105. }
  106. else
  107. {
  108. ta.setText(" "+model+" "+price+" "+size);
  109. }
  110. }
  111.  
  112.  
  113. if(e.getSource()==b2)
  114. {
  115.  
  116. String s=t2.getText();
  117.  
  118. price=Integer.parseInt(s);
  119.  
  120. if(price>70000)
  121. {
  122. try {
  123. throw new PRICENOT();
  124. } catch (PRICENOT e1) {
  125. // TODO Auto-generated catch block
  126. setzero();
  127. ta.setText(" "+model+" "+price+" "+size);
  128.  
  129.  
  130. }
  131.  
  132. }
  133. }
  134.  
  135.  
  136. if(e.getSource()==b3)
  137. {
  138. String s=t3.getText();
  139.  
  140. size=Integer.parseInt(s);
  141.  
  142.  
  143. if(size<12||size>21)
  144. {
  145. try {
  146. throw new SIZENOT();
  147. } catch (SIZENOT e1) {
  148. // TODO Auto-generated catch block
  149. setzero();
  150. ta.setText(" "+model+" "+price+" "+size);
  151. }
  152. }
  153.  
  154. }
  155.  
  156. if(e.getSource()==b4)
  157. {
  158. ta.setText(" "+model+" "+price+" "+size);
  159. }
  160. }
  161.  
  162. }
  163.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: class televison is public, should be declared in a file named televison.java
public class televison extends JFrame implements ActionListener{
       ^
Main.java:98: error: cannot find symbol
					throw new NOTMODEL();
					          ^
  symbol:   class NOTMODEL
  location: class televison
Main.java:99: error: cannot find symbol
				} catch (NOTMODEL e1) {
				         ^
  symbol:   class NOTMODEL
  location: class televison
Main.java:124: error: cannot find symbol
					throw new PRICENOT();
					          ^
  symbol:   class PRICENOT
  location: class televison
Main.java:125: error: cannot find symbol
				} catch (PRICENOT e1) {
				         ^
  symbol:   class PRICENOT
  location: class televison
Main.java:147: error: cannot find symbol
					throw new SIZENOT();
					          ^
  symbol:   class SIZENOT
  location: class televison
Main.java:148: error: cannot find symbol
				} catch (SIZENOT e1) {
				         ^
  symbol:   class SIZENOT
  location: class televison
7 errors
stdout
Standard output is empty