answersLogoWhite

0

What do you mean by a bean in java?

Updated: 8/10/2023
User Avatar

Wiki User

11y ago

Best Answer

java beans provide business logic methods by which we manually call methods such as setter methods and getter methods in a encapsulated way of object oriented programming. Or even we can say these are model components in MVC architecture.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

If you know what the Java programming language and runtime are, then you can understand Java beans.

A bean is an ordinary Java class that fits certain simple guidelines about predictable operation:

1. the class has a zero argument constructor;

2. the class is serializable; and

3. each member variable in the class has a public setter and getter method.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Java bean is the class used to create the desired component in a seprate panel and use it when it is needed bejust "Clicking and Draging to Fream"

Here is the example for java bean for file browser

import javax.swing.*;

import java.io.*;

import java.awt.*;

import java.awt.event.*;

import java.io.Serializable;

public class MyBrowser extends JPanel implements ActionListener, Serializable

{

JTextField tfFile;

JButton btnBrowse,btnShow;

JFileChooser fcImage;

JLabel lblImage;

JPanel pnlInput,pnlImage;

File file;

public MyBrowser()

{

fcImage=new JFileChooser("D:/CURRENT/books/java/java/java/jai-applet/jai-applet/");

tfFile=new JTextField(25);

btnBrowse=new JButton("Browse");

btnBrowse.setActionCommand("Browse");

btnBrowse.addActionListener(this);

btnShow=new JButton("Show");

btnShow.setActionCommand("Show");

btnShow.addActionListener(this);

pnlInput=new JPanel(new FlowLayout());

pnlInput.add(tfFile);

pnlInput.add(btnBrowse);

pnlInput.add(btnShow);

lblImage=new JLabel();

pnlImage=new JPanel(new BorderLayout());

pnlImage.add(lblImage,"Center");

setLayout(new GridLayout(1,2));

add(pnlInput);

add(pnlImage);

setSize(400,500);

show();

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Browse"))

{

fcImage.showOpenDialog(this);

File file=fcImage.getSelectedFile();

tfFile.setText(file.getPath());

}

if(str.equals("Show"))

{

File file=new File(tfFile.getText());

if(file.exists())

{

JPanel f=new JPanel ();

JLabel lbl=new JLabel(new ImageIcon(file.getPath()));

f.setSize(700,800);

f.show();

}

}

}

}

Compile the above program and get the class file

Codeing for mft file

Name: MyBrowser.class

Java-Bean: True

create the jar file and add it to the ide

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

= JavaBean = (Redirected from JavaBeans)

Jump to: navigation, search

Not to be confused with Enterprise JavaBean.

JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects. A JavaBean is a "Plain Old Java Object" (POJO) that is serializable, has a no-argument constructor, and allows access to properties using getter and setter methods.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

A Java Bean is a reusable software component or we can say it as a component model for java. They are used to encapsulate many objects into a single object (the bean), so that they can be passed around as a single bean object instead of as multiple individual objects.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago
  1. No java syntax

-No semicolons or curly braces

-Can manipulate java objects using only XML-compatible syntax

2. Simpler object sharing

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

The purpose of Java Spring is to be used as an open source application framework. It is used for many purposes such as programming, data access, resource management and remote access.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What do you mean by a bean in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a java sack?

A Coffee Bean Sack


What is the difference between Java bean and bean?

JAVA beans and coffee beans are two very different things . JAVA beans are used to generate getters and setters. while coffee beans are use to make coffee.


What is the difference between Java and Java bean?

AnswerMostly the java class and the Bean class are similar one.In Bean class we have getter and setter methods.Its just a naming convention.RegardsSanthosh raoInhttp://forums.sun.com/thread.jspa?threadID=526214Java Beans follow the Bean conventions:(1) Default, no-arg ctor,(2) Serializable,(3) getX()/setX() or isX()/setX() naming convention for read/write access to private data member X,(4) Can use java.bean.PropertyChangeEvent to notify interested parties when values change.(5) Can use java.bean.PropertyChangeListener to register for notification when a particular property changes."Normal" Java classes aren't required to follow any of these conventions.There's a great [url=http://java.sun.com/docs/books/tutorial/javabeans/]tutorial[/url] on Java Beans from Sun.


What are Java beans?

In eclipse you can create java bean by generating getters and setters. Getters and setters are generated as ' alt + shift + s + r'.


When creating a Bean how do you make its properties available to all possible users?

Declare the Bean's fields "public."Java 2, Question 10 of 40


Differences between Java Applet and Java Beans?

Java applet is a program used to run java applications while beans is a compiler used to design java programs (IDE, GUI) :-) GilbertC


What is subroutine in java?

Subroutine mean what (in java)?


What does Systemout mean in java?

System.out refers to the Java console.


Which island is also the name of a popular programming language?

Java (an Indonesian island). However, the Java programming language was named after the Indonesian coffee bean (a favourite of one of its developers) rather than the island itself.


What does bean head mean?

They head look like a bean


What is the scientific name or taxonomic classification of the poisonous plant Java Bean?

The scientific or taxonomic name would be Phaseolus lunatus.


Which one of the following objects is passed to a java bean when one of its properties is set via a jsp action?

The following is the answer.