Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


valarmathi
java swings
1 Answer(s)      4 years and 11 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 10, 2009 at 11:53 AM


Hi Friend,

Try the following code:

1)ClassA.java

import java.awt.event.*;


2)ClassB.java

import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;

class ClassB implements ActionListener
{
JFrame f;
JTextField text;
JButton jb;
ClassA m;
public static void main(String args[])
{
ClassB s=new ClassB();
s.form();
}
void form()
{
text=new JTextField(10);
jb=new JButton("Submit");
f=new JFrame("test");
JPanel cp=new JPanel();
cp.add(text);
cp.add(jb);

jb.addActionListener(this);

f.setSize(300,100);
f.setVisible(true);
f.add(cp);
}
public void actionPerformed(ActionEvent ae)
{
m=new ClassA();
m.form();
m.text1.setText(text.getText());
}
}

Thanks


Related Tutorials/Questions & Answers:
java swings - Java Beginners
java swings   Hi, I need the code for click the refresh button then list values will be refresh.Please send the code ........... Thanks, Valarmathi
java swings - Swing AWT
write the code for bar charts using java swings.  Hi friend, I am...java swings  I am doing a project for my company. I need a to show.... http://www.roseindia.net/java/example/java/swing/draw-simple-bar
Advertisements
java swings - Java Beginners
java swings   Hi, I already posted the question for three times.... I have two listboxes.If i select first value in the first listbox and moved to second listbox.The next time the same value will not able to move the first
java swings - Java Beginners
java swings   Hi, This is my code. How can i set the jtextfield...", Font.BOLD, 12)); javapathname = new JLabel("Java Path"); javatextpath = new JTextField(33); javatextpath.setToolTipText("Java Installation Path
java swings - Java Beginners
java swings  Hi, I need simple code for JButton JOptionPane.Please send the code. Thanks, Valarmathi
java swings - Java Beginners
java swings  Hi, I already send the question. But i didnt get the reply. I can't able to set the jfiledialog directory selection in the textbox. Please send the code urgently. Thanks, Valarmathi
Java-Swings - Java Beginners
Java-Swings  How to set the size of a JButton,JLabel depending on it's caption?  Hi, import javax.swing.*; import java.awt....://www.roseindia.net/java/example/java/swing/ Thanks
java swings - Java Beginners
java swings  Hi, How can i set the color in joptionpane. Please send the code as soon as possible. Thanks, valarmathi  Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; public
java swings - Java Beginners
java swings  how to send the data in database using java swing. Example : how to design the registration page using java swing, and how to write the coding to store the data into data base. Plz help........ 
java swings - Java Beginners
java swings  Hi, I have two listboxes.I need to move the lisstbox values from one list to another one(ie first listbox to second listbox).I wnat the code for duplicate value no need to move the first listbox into second
java swings - Java Beginners
java swings  Hi, I have two listboxes.If i select first value in the first listbox and moved to second listbox.The next time the same value will not able to move the first list box to second listbox. (duplicate value
java swings - Java Beginners
java swings  Hi, I have two listboxes.If i select first value in the first listbox and moved to second listbox.The next time the same value will not able to move the first list box to second listbox. (duplicate value
java swings - Java Beginners
java swings  Hi, I need to Pass the two arguments from the joptionpane message dialog . JOptionPane.showMessageDialog(listTransferButton, "Succesfully Migrated the +listvalue Active MQ to IBM MQ", "Migration
java swings - Java Beginners
java swings  Hi, I already send the same question.Please help me. I cant able to add the directory path in the textbox. This is the code import java.awt.*; import java.io.*; import javax.swing.*; import java.awt.event.
java swings - Java Beginners
java swings  Hi, I need the listbox example. I have two listboxes first one have data then move the data from first listbox to second listbox using add button.This is my code .... package com.zsl.test; import
java swings - Java Beginners
java swings  Hi, I have two list boxes.From the first listbox i have some value ,i can select the value from the first listbox and it is moved to the second listbox using add button and the value is moved into one by one
java swings - Java Beginners
java swings  Hi, I have two list boxes.From the first listbox i have some value ,i can select the value from the first listbox and it is moved.... This is my code...... THis is my java code... package com.zsl.swing.mq
java swings - Java Beginners
java swings  Hi, I need the sample code for Jtext box validation. I have the text box,if i enter the wrong input the validation error message is display the textbox right side. Please send the sample code for this... very
java swings - Java Beginners
java swings  Hi, I already send the question for two times. I have two list boxes.From the first listbox i have some value ,i can select the value from the first listbox and it is moved to the second listbox using add button
java swings - Java Beginners
java swings  if i design the more than two menu on the frame, if i click on the menu than another frame open which contain the some data like as item,price,name of item,color,id etc. plz help  Hi Friend, Try
java swings - Java Beginners
java swings  Hi, I have two listboxes.If i select first listbox first value moved to second listbox. Second time i select the same value means,i can't able select the value ie., the value is already moved. Please send
java swings - Java Beginners
java swings  hi, This is my code. I need the code for disable the listbox value. I have two listboxes,if i select first listbox value and moved to second listbox,then the first listbox first value is disabled option
java swings - Java Beginners
java swings  When we click on the button , than open a frame, How to create a link on button to frame , example : Suppose I Have to create a login page and on login page there are three button like login
swings - Java Beginners
swings  how to add different patterns in java
swings - Java Beginners
swings  how can i use the inbuilt color palette in java
swings - Java Beginners
swings  i want to display a texture in a particular polygon.........  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/swing/graphics2D/gradient.shtml Hope
swings - Java Beginners
:\Program Files\Java\jdk1.6.0_14\jre\lib\sunrsasign.jar Have no FileObject for C:\Program Files\Java\jdk1.6.0_14\jre\classes what
swings - Java Beginners
swings  i want to fill a polygon with a image pattern,how can i do this , is there any inbuilt image pattern available in java
swings - Java Beginners
are there in java please send me the information
swings - Java Beginners
swings  i want to display a background pattern in mappannel, which we can change the color . i dont have background patterns too.how can i get the background patterns, is there any inbuilt background patterns in java and how can
swings - Java Beginners
swings  hi i am using jcolorchooser in my application, in that there are no palettes and it have swatches,hsb,rgb options, just i want to add some palettes in my application. If any inbuilt palettes are there in java please send
java-swings - Swing AWT
java-swings  How to move JLabel using Mouse? Here the problem is i have a set of labels in a panel. I want to arrange them in a customized order...://www.roseindia.net/java/example/java/swing/ Thanks. Amardeep
Swings - Java Beginners
("java-swing-tutorial.JPG","My Website"); If the above is not correcet.. Can...){} } } For more information on Swing visit to : http://www.roseindia.net/java/example/java/swing/ Thanks
swings - Java Beginners
(ImageInComboBox.java:28) at comboboximage.ImageInComboBox.main(ImageInComboBox.java:53) Java
swings - Java Beginners
) at comboboximage.ImageInComboBox.main(ImageInComboBox.java:53) Java Result: 1 BUILD SUCCESSFUL (total time: 4
Java Swings problem - Swing AWT
Java Swings problem  Sir, I am facing a problem in JSplitPane. I want the divider in the splitpane to be customized. I have a splitpane with Horizontal orientation and here, there lies the divider between left component and right
Swings Menu Bar - Java Beginners
Swings Menu Bar  Hello, I created a menu bar using Java Swings... n New Record, Edit Record etc are the menu items. Now, I want to display the appropriate fields according the menu Item selected..below it.. i.e. If we
how can i close particular frame in swings - Java Beginners
in swings and three frames are having their own close buttons and when i click on second frame close button, it should only get close....iam trying this in swings
Swings JTable
Swings JTable  add values to JTable with four coloums,two of them are comboboxes
Advertisements
 

 

 

DMCA.com