codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  need help with main()  minhas_amar at 06:45 on Monday, January 22, 2007
 

hello, i sort of new to java..

i need to know how and from where can i call the main method to an already exsisting class..
I used jformdesigner to make this..

------------

import java.awt.*;
import javax.swing.*;
import com.jgoodies.forms.factories.*;
import com.jgoodies.forms.layout.*;
import com.jgoodies.uif_lite.panel.*;
/*
* Created by JFormDesigner on Mon Jan 22 12:40:17 CST 2007
*/



/**
*
*/
public class usb extends JFrame {

public usb() {
initComponents();
}

private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license
dialogPane = new JPanel();
contentPanel = new JPanel();
simpleInternalFrame1 = new SimpleInternalFrame();
label1 = new JLabel();
buttonBar = new JPanel();
okButton = new JButton();
cancelButton = new JButton();
CellConstraints cc = new CellConstraints();

//======== this ========
setTitle("SAMPLE");
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());

//======== dialogPane ========
{
dialogPane.setBorder(Borders.DIALOG_BORDER);

// JFormDesigner evaluation mark
dialogPane.setBorder(new javax.swing.border.CompoundBorder(
new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
"JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog",

java.awt.Font.BOLD, 12),
java.awt.Color.red), dialogPane.getBorder()));

dialogPane.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange

(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});

dialogPane.setLayout(new BorderLayout());

//======== contentPanel ========
{
contentPanel.setLayout(new FormLayout(
ColumnSpec.decodeSpecs("default:grow"),
new RowSpec[] {
FormFactory.DEFAULT_ROWSPEC,
FormFactory.LINE_GAP_ROWSPEC,
FormFactory.DEFAULT_ROWSPEC,
FormFactory.LINE_GAP_ROWSPEC,
FormFactory.DEFAULT_ROWSPEC
}));

//======== simpleInternalFrame1 ========
{
simpleInternalFrame1.setTitle("RS Media");
Container simpleInternalFrame1ContentPane =

simpleInternalFrame1.getContentPane();
simpleInternalFrame1ContentPane.setLayout(new FormLayout(
new ColumnSpec[] {
new ColumnSpec("max(pref;5dlu)"),
new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT,

FormSpec.DEFAULT_GROW),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
FormFactory.PREF_COLSPEC
},
new RowSpec[] {
FormFactory.DEFAULT_ROWSPEC,
FormFactory.LINE_GAP_ROWSPEC,
FormFactory.DEFAULT_ROWSPEC,
FormFactory.LINE_GAP_ROWSPEC,
FormFactory.DEFAULT_ROWSPEC
}));

//---- label1 ----
label1.setText("No Robot Found");
label1.setIcon(UIManager.getIcon("OptionPane.warningIcon"));
simpleInternalFrame1ContentPane.add(label1, cc.xy(2, 3));
}
contentPanel.add(simpleInternalFrame1, cc.xy(1, 1));
}
dialogPane.add(contentPanel, BorderLayout.CENTER);

//======== buttonBar ========
{
buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
buttonBar.setLayout(new FormLayout(
new ColumnSpec[] {
FormFactory.GLUE_COLSPEC,
FormFactory.BUTTON_COLSPEC,
FormFactory.RELATED_GAP_COLSPEC,
FormFactory.BUTTON_COLSPEC
},
RowSpec.decodeSpecs("pref")));

//---- okButton ----
okButton.setText("OK");
buttonBar.add(okButton, cc.xy(2, 1));

//---- cancelButton ----
cancelButton.setText("Cancel");
buttonBar.add(cancelButton, cc.xy(4, 1));
}
dialogPane.add(buttonBar, BorderLayout.SOUTH);
}
contentPane.add(dialogPane, BorderLayout.CENTER);
setSize(400, 300);
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}




// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license
private JPanel dialogPane;
private JPanel contentPanel;
private SimpleInternalFrame simpleInternalFrame1;
private JLabel label1;
private JPanel buttonBar;
private JButton okButton;
private JButton cancelButton;
// JFormDesigner - End of variables declaration //GEN-END:variables


}


-------------

could someone please help with the class and call the above..


  Re: need help with main()  mmarab at 09:25 on Monday, January 22, 2007
 

Hi

Looking through your code i couldnt find a main() method, first i would create one. I.e.

public static void main(String args[]){
}

Then create an object of your class which should then allow it to run i.e.

public static void main(String args[]){
class demo = new class();
}

As your class extends JFrame, you dont have to bother with creating frames.

Hope this helps



  Re: need help with main()  minhas_amar at 03:39 on Tuesday, January 23, 2007
 

hey thanks for the answer..

I tried:

public static void main( String[] args ) {
usb frame = new usb();
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setVisible(true);
}


but i still get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: usb

any ideas?

<Added>

Environmental Var.

PATH=c:\j2sdk1.4.2_13\bin;

CLASSPATH=%CLASSPATH%;

  Re: need help with main()  mmarab at 12:27 on Tuesday, January 23, 2007
 

Ok i cant compile your code, as i do not have the jgoodies package. (just to added if you have designed this interface with software thats fine, but i would first recommend to code interface on your own, writing your own code. It will allow you to make it more effiecient, make the code flexible and maintaintable and you learn more).

Anyway i would add this main method:

public static void main(String args[]){
usb myusb = new usb();
}

to your code, just before the last } of the usb class. I dont see why that shouldnt work, although i have not used this jgoodies package before, i have always used swing(awt before).

Hope this helps.

  Re: need help with main()  Ming21 at 06:39 on Saturday, January 15, 2011
 

I anchored that problem-now i charge to put numbers 1-100 is account 1, again i charge to yield all the odd numbers out of account 1 and put them into account 2-i am putting them into account 2 i just charge to apperceive how to yield them out of account 1, pass4sure 642-504 and actuality is the new main. You're still adhering files. I'm not traveling to download them, so unless you POST CODE, pass4sure 642-165 I'm not traveling to advice you. Now do what I told you Break the cipher down as baby as accessible (thus allowance me to advice you) pass4sure 642-661 and again column it in the bulletin itself.

  Re: need help with main()  dabora100 at 09:27 on Friday, January 28, 2011
 

I donot want to waste your time. I just want to tell you that your experience and prediction is right. Thanks for sharing this information. I really like your way of expressing the opinions and sharing the information.
____________________________________________________________

pass 4 sure|| pass4sure ccda|| pass4sure network+|| pass4sure ccie|| pass4sure itil|| pass4sure ccsp || pass4sure ccvp|| pass4sure 640-802|| pass4sure SY0-201|| pass4sure 350-001||pass4sure 642-813|| pass4sure 642-902









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Web Designing Companies in Chennai
•  Re: Codefest`11
•  Re: refresh parent after closing pop up window
•  Re: The Dim appExcel As Excel.Application doesn`t work ????
•  Re: Plz its urgent:validation code
•  Re: c# .net Exception of type System.StackOverflowException was thrown.
•  Re: need help with main()
•  Re: onclick thumbnail images in gridview or datalist
•  Re: adding a querystring parameter in a button click event


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2011