import javax.swing.JFrame; import java.awt.FlowLayout; import java.awt.Color; import javafx.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; public class FrameAndButton extends JFrame implements ActionListener { public static void main(String args[]) { FrameAndButton fnb = new FrameAndButton(); fnb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fnb.setSize(500, 300); fnb.setResizable(false); fnb.setTitle("Frame and Button"); fnb.getContentPane().setBackground(Color.white); fnb.setLocationRelativeTo(null);//to put the frame in the middle of the window,before setvislible() fnb.getContentPane().setLayout(new FlowLayout());//wont overlap the button to whole frame JButton btn = new JButton(); btn.setBackground(Color.white); btn.setText("Java Code trying"); fnb.add(btn); fnb.setVisible(true); btn.addActionListener(this); } //buttonAction(); public FrameAndButton() { constructFrame(); }//FrameAndButton constructor public final void constructFrame() { } public void actionPerformed(ActionEvent e) { JFrame frame2 = new JFrame("Your Stocks"); frame2.setVisible(true); frame2.setSize(600, 600); JLabel label = new JLabel("Your Personal Stocks"); JPanel panel = new JPanel(); frame2.add(panel); panel.add(label); } //fnb.pack();// autometically addjest the frame size put it at last after adding all butns etc.. // constructFrame method }
Dear people can you please help me with this code keeps telling me
non abstract method cannot be override by the abstract method.
but i think am doing it right way of course its wrong.