473,396 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

I get the error DelegatingMethodAccessor when i run this code from AlphaApp

18
atsun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at bluej.runtime.ExecServer$3.run(ExecServer.java:730 )

MainMenu
Expand|Select|Wrap|Line Numbers
  1. import java.awt.*;
  2. import java.io.*;
  3. import java.util.*;
  4. import java.net.*;
  5. import javax.swing.*;
  6. import java.awt.event.*;
  7. import java.awt.FlowLayout.*;
  8.  
  9. public class MainMenu extends JPanel
  10. {
  11.    static JLabel title, advert;
  12.    static JButton addBooks, addSoftware, addProduct, viewCart, makeOrder;
  13.    static JPanel manuPanel; 
  14.    static CardLayout cardLayout; 
  15.    static FlowLayout flowLayout;
  16.  
  17.  
  18.    static public ArrayList<Order> orderHistory = new ArrayList<Order>();
  19.    static public ArrayList<Book> bookList = new ArrayList<Book>();
  20.    static public ArrayList<Cart> cart = new ArrayList<Cart>();
  21.    static public ArrayList<Software> softwareList = new ArrayList<Software>();
  22.  
  23.    @SuppressWarnings("unchecked") //  gets rid of the unchecked or unsafe warning
  24.    public MainMenu(){                    
  25.        final String dir = System.getProperty("user.dir");
  26.        Color Gray = new Color(1,1,1); 
  27.        Color titleColor = new Color(1,1,1);
  28.  
  29.        setLayout(new FlowLayout());       
  30.        manuPanel = new JPanel(new FlowLayout());
  31.  
  32.        addBooks = new JButton("ADD BOOKS");
  33.        addBooks.setLocation (30,450);//(30,450);
  34.        addBooks.setSize(80,40);
  35.         add(addBooks);
  36.  
  37.        addSoftware = new JButton("ADD SOFTWARE");
  38.        addSoftware.setLocation(30,451);
  39.        addSoftware.setSize(80,40);
  40.         add(addSoftware);       
  41.  
  42.        makeOrder = new JButton("MAKE ORDER");
  43.        makeOrder.setLocation(30,452);
  44.        makeOrder.setSize(80,40);
  45.         add(makeOrder);
  46.  
  47.        viewCart = new JButton("VIEW CART");
  48.        viewCart.setLocation(30,453);
  49.        viewCart.setSize(80,40);
  50.         add(viewCart);
  51.  
  52.          addBooks.addActionListener(new ActionListener()
  53.          {
  54.             public void actionPerformed(ActionEvent evt)
  55.             {
  56.                 Product bookID = new Product();       //int productID = bookID.getproductID();          
  57.                AlphaApp.cardLayout.show(AlphaApp.cards, "Add Books");
  58.             }
  59.         });
  60.  
  61.         addSoftware.addActionListener(new ActionListener()
  62.         {
  63.             public void actionPerformed(ActionEvent evt)
  64.             {
  65.  
  66.               AlphaApp.cardLayout.show(AlphaApp.cards, "Add Softwares");
  67.             }
  68.         });
  69.  
  70.  
  71.         makeOrder.addActionListener(new ActionListener()
  72.         {
  73.             public void actionPerformed(ActionEvent evt)
  74.             {  
  75.                 AlphaApp.window.setSize(1200,800);
  76.                 AlphaApp.window.setResizable(false);
  77.                 AlphaApp.window.setLocationRelativeTo(null);  
  78.                 AlphaApp.makeOrderCard.book.setSelected(true);
  79.                 AlphaApp.makeOrderCard.updateBookTable();
  80.                 AlphaApp.cardLayout.show(AlphaApp.cards, "Make Order");              
  81.             }
  82.         });
  83.  
  84.         viewCart.addActionListener(new ActionListener()
  85.         {
  86.             public void actionPerformed(ActionEvent evt)
  87.             {
  88.         boolean emptyRow = AlphaApp.viewCartCard.historyTable.getSelectedRowCount() > 0;
  89.         if(!emptyRow){
  90.            AlphaApp.viewCartCard.populateHistoryTable();               
  91.         }else{
  92.             JOptionPane.showMessageDialog(null, "MAKE AN ORDER!", "Information", JOptionPane.WARNING_MESSAGE);
  93.         }
  94.                 AlphaApp.window.setSize(1000,600);
  95.                 AlphaApp.window.setLocationRelativeTo(null);     
  96.                 //AlphaApp.viewCartCard.updateCartTable();
  97.                 //AlphaApp.viewCartCard.updateOrderTable();       
  98.                 //AlphaApp.viewCartCard.populateHistoryTable(); 
  99.                 AlphaApp.cardLayout.show(AlphaApp.cards, "View Cart");              
  100.             }
  101.         });
  102.  
  103.  
  104.  
  105.         add(manuPanel);
  106.         manuPanel.add(addBooks, "split 2, gapTop 130, gapRight 65"); 
  107.         manuPanel.add(addSoftware, "gapTop 130, wrap");     
  108.         manuPanel.add(makeOrder, "split 2, gapTop 50, gapRight 60");   
  109.         manuPanel.add(viewCart, " sg a, wrap, gapTop 50");     
  110.  
  111.  
  112. }
  113.  
AlphaApp
Expand|Select|Wrap|Line Numbers
  1. import java.awt.*;
  2. import javax.swing.*;
  3.  
  4. public class AlphaApp extends JFrame
  5. {
  6.     static JFrame window;    
  7.     static public CardLayout cardLayout;    
  8.     static public JPanel cards;  
  9.  
  10.     MainMenu menu = new MainMenu();
  11.  
  12.     static public AddBooks addBooks = new AddBooks();
  13.     static public AddSoftware addSoftwares = new AddSoftware();
  14.     static public MakeOrder makeOrderCard = new MakeOrder();
  15.     static public ViewCart viewCartCard = new ViewCart();
  16.  
  17.  
  18.     public static void main(String [] args){
  19.         try {  
  20.                 UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
  21.  
  22.             }  
  23.             catch (Exception ex1){}
  24.  
  25.        AlphaApp app = new AlphaApp();   
  26.     }
  27.  
  28.     public AlphaApp(){        
  29.         window = new JFrame("");
  30.         window.setSize(800,600);
  31.         window.setLocationRelativeTo(null);    // trying to center the window
  32.         //window.setMinimumSize(new Dimension(400, 400)); // frame size
  33.         window.setResizable(true);  
  34.  
  35.  
  36.         cardLayout = new CardLayout();  // PANELS     
  37.         cards = new JPanel(cardLayout);   //PANELS
  38.  
  39.  
  40.  
  41.  
  42.         window.add(cards);
  43.         cards.add(menu, "Main Menu");
  44.         cards.add(addBooks, "Add Books");
  45.         cards.add(addSoftwares, "Add Softwares");
  46.         cards.add(makeOrderCard, "Make Order");
  47.         cards.add(viewCartCard, "View Cart");
  48.  
  49.         cardLayout.show(cards, "Main Menu");
  50.         window.setVisible(true);
  51.     }
  52.  
  53.  
  54. }
  55.  
Oct 3 '15 #1
0 914

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Patrice FRITSCH | last post by:
I'm trying to run a batch file from an asp page using WScript.Shell object. Dim oWSH set oWSH= Server.CreateObject("WScript.Shell") call oWSH.Run("cmd.exe /c " & szCmd , 0, true) szCmd...
4
by: Mark | last post by:
Not sure this is the right place for this questions, but here goes: I get an error message when deleting an table from a Access database. The code is as follows and the error message is after...
4
by: John | last post by:
Hi all; I write my first code using vector and list. When I run it, segmentation fault. Try to debug it, but it can not pass linking with -g option. What is the error with it? Thanks a lot....
4
by: OutdoorGuy | last post by:
Greetings, I am attempting to compile the code below, but I am receiving an error message when I do so. The error message is: "CSO161: 'Forloop.CalcAvg(int)': Not all code paths return a...
4
by: Al Santino | last post by:
Hello, I've created a simple C# web services project using Visual Studio 2005. My service compiles and runs correctly when called by remote clients. I'm able to step through the service in the...
1
by: Nathan Sokalski | last post by:
When I click after about 15 minutes on a page I wrote I recieve the following error: Server Error in '/' Application....
2
by: LeoK | last post by:
After finally completing my database I was ready to transfer it to our client, but when the access database was opened, everything works great, except for the SEND_EMAIL part, whenever any code that...
10
by: surferj | last post by:
I am beginning to receive an error message when trying to execute the .Send command when using the CDO.Configuration and CDO.Message in a W2k3 server environment on WXP machines and IE6. Below is a...
9
whatelyb
by: whatelyb | last post by:
I am having trouble related to the attached coding. I am trying to make the object "flight1pic" change depending on what is selected in the drop down menus "airline1" and "aircraft1". My...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.