Results 1 to 3 of 3
Thread: exception class
- 10-29-2009, 01:08 PM #1
Member
- Join Date
- Oct 2009
- Posts
- 7
- Rep Power
- 0
exception class
import Amain.CompanyDetails;
import Amain.process.ProcessClass;
import about.About;
import cablenew.Main;
import com.loginform.LoginForm;
import java.awt.Rectangle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.digitalmonks.automenu.ABarMenu;
import org.digitalmonks.automenu.control.events.AAutoMenu Event;
import org.digitalmonks.automenu.control.events.AAutoMenu Listener;
/**
*
* @author Aruna
*/
public class ExecuteMainFrame extends javax.swing.JFrame implements AAutoMenuListener {
@Override
public void receiveAutoMenuEvents(AAutoMenuEvent evt) {
String formname = ((JMenuItem) evt.getSource()).getText();
if (formname.equals("Login")) {
login();
} /*else if (formname.equals(("Company Details"))) {
Main.internalframe = new CompanyDetails();
Main.internalframe.show();
jDesktopPane1.add(Main.internalframe);
}*/ else if (formname.equals("Exit")) {
System.exit(0);
} else if (formname.equals("About")) {
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize ();
int width = screenSize.width;//your screen height
int height = screenSize.height;
About box = new About(this, true);
box.setBounds(new Rectangle((width / 2) - 475, (height / 2) - 275, 475, 275));
box.show();
} else {
try {
Main.internalframe = ProcessClass.Process(evt, this);
} catch (Exception ex) {
Main.error(ex);
// Logger.getLogger(ExecuteMainFrame.class.getName()) .log(Level.SEVERE, null, ex);
}
}
if (Main.internalframe != null) {
Main.internalframe.show();
// jDesktopPane1.setBounds(10, WIDTH, WIDTH, WIDTH)
jDesktopPane1.add(Main.internalframe);
}
}
/** Creates new form ExecuteMainFrame */
public ABarMenu abarmenu;
// private AToolBarMenu toolbarmenu;
public static Object actionTarget;
public ExecuteMainFrame() {
try {
initComponents();
actionTarget = this;
} catch (Exception ex) {
Logger.getLogger(ExecuteMainFrame.class.getName()) .log(Level.SEVERE, null, ex);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jDesktopPane1 = new javax.swing.JDesktopPane();
jMenu = new javax.swing.JMenuBar();
File = new javax.swing.JMenu();
loginMenuITem = new javax.swing.JMenuItem();
detailsMenuItem = new javax.swing.JMenuItem();
exitMenuItem = new javax.swing.JMenuItem();
About = new javax.swing.JMenu();
aboutMenuItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
setTitle("Cable Invertry");
setIconImages(null);
jDesktopPane1.setBackground(new java.awt.Color(255, 240, 255));
jMenu.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
File.setText("File");
File.setFont(new java.awt.Font("Arial", 1, 14));
File.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileActionPerformed(evt);
}
});
loginMenuITem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
loginMenuITem.setFont(new java.awt.Font("Arial", 1, 14));
loginMenuITem.setText("Login");
loginMenuITem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileActionPerformed(evt);
}
});
File.add(loginMenuITem);
detailsMenuItem.setFont(new java.awt.Font("Arial", 1, 14));
detailsMenuItem.setText("Company Details");
detailsMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileActionPerformed(evt);
}
});
File.add(detailsMenuItem);
exitMenuItem.setAccelerator(javax.swing.KeyStroke. getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
exitMenuItem.setFont(new java.awt.Font("Arial", 1, 14));
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FileActionPerformed(evt);
}
});
File.add(exitMenuItem);
jMenu.add(File);
About.setText("About");
About.setFont(new java.awt.Font("Arial", 1, 14));
aboutMenuItem.setFont(new java.awt.Font("Arial", 1, 14));
aboutMenuItem.setText("About");
aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aboutMenuItemActionPerformed(evt);
}
});
About.add(aboutMenuItem);
jMenu.add(About);
setJMenuBar(jMenu);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING).addGroup(layout.createSequenti alGroup().addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE).addContainerGap()));
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING).addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE));
pack();
}// </editor-fold>
private void FileActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (evt.getActionCommand().equals("Login")) {
login();
} else if (evt.getActionCommand().equals("Company Details")) {
companydetails();
} else if (evt.getActionCommand().equals("Exit")) {
System.exit(0);
}
}
private void aboutMenuItemActionPerformed(java.awt.event.Action Event evt) {
// TODO add your handling code here:
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize ();
int width = screenSize.width;//your screen height
int height = screenSize.height;
About box = new About(this, true);
box.setBounds(new Rectangle((width / 2) - 450, (height / 2) - 235, 450, 235));
box.show();
}
private void login() {
try {
String path = System.getProperty("user.home");
new LoginForm(this, true).show();
if (Main.accounttype.equalsIgnoreCase("Admin")) {
path = "\\xmlpath\\barmenu.xml";
} else if (Main.accounttype.equalsIgnoreCase("Demo")) {
path = "\\xmlpath\\demo.xml";
} else if (Main.accounttype.equalsIgnoreCase("User")) {
path = "\\xmlpath\\demo.xml";
} else if (Main.accounttype.equalsIgnoreCase("Work")) {
path = path + "\\work.xml";
} else if (Main.accounttype.equalsIgnoreCase("Master")) {
path = "\\xmlpath\\demo.xml";
}
Main.sql(path);
abarmenu = new ABarMenu(path, this, actionTarget);
} catch (Exception ex) {
ex.printStackTrace();
// log.error("Error while initializing look and feel --> " + ex);
}
}
private void companydetails() {
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
// UIManager.setLookAndFeel(new SubstanceMagmaLookAndFeel());
} catch (Exception ex) {
ex.printStackTrace();
}
new ExecuteMainFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JMenu About;
private javax.swing.JMenu File;
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JMenuItem detailsMenuItem;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JDesktopPane jDesktopPane1;
private javax.swing.JMenuBar jMenu;
private javax.swing.JMenuItem loginMenuITem;
// End of variables declaration
}
- 10-29-2009, 01:15 PM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Hey, don't create a new thread every time you want to post a response. Post in the same thread you started for this problem. And don't dump all your code on us either look at the stack trace and the line number reported and see what cast you are doing there.
- 10-29-2009, 02:18 PM #3
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 284
- Rep Power
- 4
Similar Threads
-
Need Help with Class Cast Exception
By soxfan714 in forum New To JavaReplies: 2Last Post: 11-03-2011, 04:33 PM -
Class not found Exception
By surendra in forum Java ServletReplies: 8Last Post: 06-09-2011, 12:52 PM -
Class.forName Exception
By Moncleared in forum Advanced JavaReplies: 5Last Post: 02-21-2009, 06:08 AM -
class cast exception
By venkatallu in forum New To JavaReplies: 2Last Post: 09-02-2008, 09:50 PM -
How to create your own Exception class
By Java Tip in forum java.langReplies: 0Last Post: 04-17-2008, 07:40 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks