Ir para conteúdo
Fórum CódigoFonte.net
Entre para seguir isso  
claudioramone

Um Help por acaso

Recommended Posts

Alguem pode me ajudar ta dando esse erro>>> No static method in Party with name 'main' accepts arguments (Strings[])

comprei u livro e mandou digitar esse cod mas ele da esse erro qdo compila eu to usando dr java para compilar se alguem puder agradeço...

import java.awt.*;

import java.awt.event.*;

class Party{

public void buildInvite(){

Frame f = new Frame ();

Label l = new

Label ("Festa do Claudio");

Button b = new

Button("Seu convite");

Button c = new

Button("avise me");

Panel p = new Panel();

p.add(l);

}

} ;) :unsure:

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá amigo acho que você está fazendo telas em swing em java?

para conpilar vc precisa do "main"

exeplos e um formulario em java swing

crie uma classe Tela

e copie isso

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

import javax.swing.SwingUtilities;

import javax.swing.UIManager;

import org.dyno.visual.swing.layouts.Constraints;

import org.dyno.visual.swing.layouts.GroupLayout;

import org.dyno.visual.swing.layouts.Leading;

//VS4E -- DO NOT REMOVE THIS LINE!

public class Tela extends JFrame {

private static final long serialVersionUID = 1L;

private JLabel jLabel0;

private JTextField jTextField0;

private JButton jButton0;

private static final String PREFERRED_LOOK_AND_FEEL = "javax.swing.plaf.metal.MetalLookAndFeel";

public Tela() {

initComponents();

}

private void initComponents() {

setLayout(new GroupLayout());

add(getJLabel0(), new Constraints(new Leading(29, 10, 10), new Leading(45, 10, 10)));

add(getCampo(), new Constraints(new Leading(72, 161, 10, 10), new Leading(43, 12, 12)));

add(getJButton0(), new Constraints(new Leading(182, 12, 12), new Leading(75, 12, 12)));

setSize(320, 240);

}

private JButton getJButton0() {

if (jButton0 == null) {

jButton0 = new JButton();

jButton0.setText("OK");

jButton0.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent event) {

jButton0ActionActionPerformed(event);

}

});

}

return jButton0;

}

private JTextField getCampo() {

if (jTextField0 == null) {

jTextField0 = new JTextField();

}

return jTextField0;

}

private JLabel getJLabel0() {

if (jLabel0 == null) {

jLabel0 = new JLabel();

jLabel0.setText("Nome:");

}

return jLabel0;

}

private static void installLnF() {

try {

String lnfClassname = PREFERRED_LOOK_AND_FEEL;

if (lnfClassname == null)

lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName();

UIManager.setLookAndFeel(lnfClassname);

} catch (Exception e) {

System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL

+ " on this platform:" + e.getMessage());

}

}

/**

* Main entry of the class.

* Note: This class is only created so that you can easily preview the result at runtime.

* It is not expected to be managed by the designer.

* You can modify it as you like.

*/

public static void main(String[] args) {

installLnF();

SwingUtilities.invokeLater(new Runnable() {

@Override

public void run() {

Tela frame = new Tela();

frame.setDefaultCloseOperation(Tela.EXIT_ON_CLOSE);

frame.setTitle("Tela");

frame.getContentPane().setPreferredSize(frame.getSize());

frame.pack();

frame.setLocationRelativeTo(null);

frame.setVisible(true);

}

});

}

private void jButton0ActionActionPerformed(ActionEvent event) {

String nome = getCampo().getText();

JOptionPane.showMessageDialog(null, nome);

}

}

usei o eclipce e pligis de formularios do eclipce foi bem facíl e em 1 segundo fiz sem da um erro ^^

Compartilhar este post


Link para o post
Compartilhar em outros sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Visitante
Responder

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Processando...
Entre para seguir isso  

×
×
  • Criar Novo...