Class, interface, or enum expected errors in BULK
Solved/Closed
zlloyd1
Posts
10
Registration date
Tuesday December 11, 2012
Status
Member
Last seen
February 4, 2013
-
Jan 27, 2013 at 07:49 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jan 29, 2013 at 08:35 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jan 29, 2013 at 08:35 PM
Related:
- Class interface or enum expected
- Bus interface - Guide
- Chivalry 2 best class - Guide
- Ubuntu restart network interface - Guide
- Class position formula in excel ✓ - Office Software Forum
- How to calculate position (1st,2nd,3rd) in excel....? - Excel Forum
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Jan 29, 2013 at 07:29 AM
Jan 29, 2013 at 07:29 AM
stupid question but is your file named "newclass2.java" (case included)
Beside wrong calls, are you not missing
public class newclass2 extends JFrame implement ActionListener
I would suggest comment of every thing and start with empty shell of class
public class newclass2 extends JFrame implement ActionListener{
}
and one by one start adding lines. It will help you in identifying area where you have issues
Beside wrong calls, are you not missing
public class newclass2 extends JFrame implement ActionListener
I would suggest comment of every thing and start with empty shell of class
public class newclass2 extends JFrame implement ActionListener{
}
and one by one start adding lines. It will help you in identifying area where you have issues
Jan 29, 2013 at 07:47 AM
import java.awt.BorderLayout; import java.awt.Desktop; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class newclass2 extends JFrame implements ActionListener { private String s1, s2; private String s3; private JFrame f = new JFrame("text testing"); private JTextField txt = new JTextField(24); private JTextField txt2 = new JTextField(24); private JButton b1 = new JButton("Submit"); private JButton b2 = new JButton("Exit"); public newclass2() { f.setLayout(new BorderLayout()); JPanel p = new JPanel(); p.setLayout(new FlowLayout()); p.add(new JLabel("text1")); p.add(txt); p.add(new JLabel("text2")); p.add(txt2); f.add(p, BorderLayout.CENTER); JPanel p2 = new JPanel(); p2.setLayout(new FlowLayout()); p2.add(b1); p2.add(b2); b1.addActionListener(this); b2.addActionListener(this); f.add(p2, BorderLayout.SOUTH); f.setVisible(true); f.setSize(480, 480); } public void actionPerformed(ActionEvent e) { if (e.getSource() == b1) { // txtemp1 = (""); // txttemp2 = (""); String txttemp1 = txt.getText().trim(); String txttemp2 = txt2.getText().trim(); String s3 = ("text here" + txttemp1) + (txttemp2); String data = s3; try { BufferedWriter readz = new BufferedWriter(new FileWriter( new File("C:/users/zlloyd1/desktop/test1.doc"))); readz.write(data); readz.newLine(); readz.close(); System.out.println("Done"); } catch (Exception e2) { System.out.println("Error message text"); } } if (e.getSource() == b2) { JFileChooser choosa = new JFileChooser( "C:/users/zlloyd1/desktop/test1.doc"); int x = choosa.showOpenDialog(null); if (x == JFileChooser.APPROVE_OPTION) { File file = choosa.getSelectedFile(); try { Desktop.getDesktop().open(file); } catch (Exception e3) { System.out.println("Error text"); } } } } public static void main(String args[]) { new newclass2(); } }Jan 29, 2013 at 03:24 PM
Beside wrong calls, are you not missing
public class newclass2 extends JFrame implement ActionListener I am not sure exactly what you are saying here, but I have that line in my code??
Also, what wrong calls please??
Jan 29, 2013 at 03:38 PM
It should be public class newclass2 extends JFrame implements ActionListener
My stupid, but as I said, I knew it was something small I didn't see that I had done wrong!!
Jan 29, 2013 at 08:35 PM