Results 1 to 4 of 4
- 08-26-2011, 03:53 PM #1
Member
- Join Date
- Aug 2011
- Location
- Abu dhabi
- Posts
- 3
- Rep Power
- 0
plz ,, I Need help here : Exception in thread "main" java.lang.NullPointerException
hi ,,
I created a form by using JFormDesigner,,
and i waana add some codes in Jcretor,, but its doesn't work with me??.gif)
please anyone can help me in that?
Java Code:import java.awt.*; import javax.swing.*; import java.awt.event.*; /* * Created by JFormDesigner on Thu Aug 25 22:59:29 GST 2011 */ /** * @author ema */ public class project1part6 extends JFrame { public project1part6() { initComponents(); } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents label5 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label6 = new JLabel(); label7 = new JLabel(); button1 = new JButton(); label8 = new JLabel(); label9 = new JLabel(); radioButton1 = new JRadioButton(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(null); //---- label5 ---- label5.setText("Step 6:Logo"); label5.setFont(new Font("Aharoni", Font.BOLD, 36)); contentPane.add(label5); label5.setBounds(30, 20, 210, label5.getPreferredSize().height); //---- label3 ---- label3.setText("A logo is a graphical element (ideogram, symbol, emblem, icon, sign). It's one aspect "); label3.setHorizontalAlignment(SwingConstants.CENTER); label3.setFont(new Font("Aharoni", Font.ITALIC, 14)); label3.setForeground(new Color(0, 204, 102)); contentPane.add(label3); label3.setBounds(100, 68, 569, label3.getPreferredSize().height); //---- label4 ---- label4.setText("of a company's commercial brand, or economic or academic entity, and its shapes, colors, fonts, "); label4.setHorizontalAlignment(SwingConstants.CENTER); label4.setFont(new Font("Aharoni", Font.ITALIC, 14)); label4.setForeground(new Color(0, 204, 102)); contentPane.add(label4); label4.setBounds(45, 86, 655, label4.getPreferredSize().height); //---- label6 ---- label6.setText(" and images usually are different from others in a similar market."); label6.setHorizontalAlignment(SwingConstants.CENTER); label6.setFont(new Font("Aharoni", Font.ITALIC, 14)); label6.setForeground(new Color(0, 204, 102)); contentPane.add(label6); label6.setBounds(150, 103, 459, label6.getPreferredSize().height); //---- label7 ---- label7.setText("It\u2019s important to realize, when your are choosing a logo design, that your logo is more than just the "); label7.setHorizontalAlignment(SwingConstants.CENTER); label7.setFont(new Font("Aharoni", Font.ITALIC, 14)); label7.setForeground(new Color(255, 153, 0)); contentPane.add(label7); label7.setBounds(15, 128, 699, label7.getPreferredSize().height); //---- button1 ---- button1.setText("NEXT"); button1.setForeground(new Color(255, 153, 0)); button1.setFont(new Font("Tahoma", Font.BOLD, 22)); contentPane.add(button1); button1.setBounds(455, 465, 282, button1.getPreferredSize().height); //---- label8 ---- label8.setText("visual representation of your business name, it's will become one of your most valuable commercial assets. "); label8.setHorizontalAlignment(SwingConstants.CENTER); label8.setFont(new Font("Aharoni", Font.ITALIC, 14)); label8.setForeground(new Color(255, 153, 0)); contentPane.add(label8); label8.setBounds(10, 138, 719, label8.getPreferredSize().height); //---- label9 ---- label9.setText("Choose a logo: "); label9.setForeground(new Color(0, 153, 255)); label9.setFont(new Font("Aharoni", Font.BOLD, 22)); contentPane.add(label9); label9.setBounds(30, 185, 170, label9.getPreferredSize().height); contentPane.add(separator1); separator1.setBounds(110, 168, 569, 20); //---- radioButton1 ---- radioButton1.setText("text"); contentPane.add(radioButton1); radioButton1.setBounds(new Rectangle(new Point(100, 245), radioButton1.getPreferredSize())); { // compute preferred size Dimension preferredSize = new Dimension(); for(int i = 0; i < contentPane.getComponentCount(); i++) { Rectangle bounds = contentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPane.setMinimumSize(preferredSize); contentPane.setPreferredSize(preferredSize); } pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JLabel label5; private JLabel label3; private JLabel label4; private JLabel label6; private JLabel label7; private JButton button1; private JLabel label8; private JLabel label9; private JComponent separator1; private JRadioButton radioButton1; // JFormDesigner - End of variables declaration //GEN-END:variables public static void main (String[] args) { project1part6 frame = new project1part6(); frame.setVisible(true); } }
- 08-26-2011, 04:07 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
Some advice: show the exact error message you receive(copy/paste it in code tags here). Highlight the line which throws the exception. Try tracing the exception to the root, somewhere you have a variable which is not initialized and you are calling a method on it, which throws NullPointerException.
- 08-26-2011, 04:27 PM #3
Member
- Join Date
- Aug 2011
- Location
- Abu dhabi
- Posts
- 3
- Rep Power
- 0
this what i got
Java Code:Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl(Container.java:1041) at java.awt.Container.add(Container.java:365) at project1part6.initComponents(project1part6.java:96) at project1part6.<init>(project1part6.java:15) at project1part6.main(project1part6.java:136)
- 08-26-2011, 04:39 PM #4
Member
- Join Date
- Aug 2011
- Location
- Abu dhabi
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Exception in thread "main" java.lang.NullPointerException.. PLS HELP
By pacia007 in forum AWT / SwingReplies: 3Last Post: 04-05-2011, 11:07 PM -
Exception in thread "main" java.lang.NullPointerException
By Rohaan in forum New To JavaReplies: 2Last Post: 01-15-2010, 01:30 AM -
Exception in thread "main" java.lang.NullPointerException at LinkedList.main(Link
By kavitha_0821 in forum New To JavaReplies: 6Last Post: 07-16-2009, 03:30 PM -
Exception in thread "main" java.lang.NullPointerException at LinkedList.main(Link
By kavitha_0821 in forum New To JavaReplies: 1Last Post: 07-16-2009, 10:35 AM -
ArrayList: Exception in thread "main" java.lang.NullPointerException
By susan in forum New To JavaReplies: 1Last Post: 07-16-2007, 06:32 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks