SWT_AWT bridge ,jtextfield edit problem

SWT_AWT bridge ,jtextfield edit problem

View Answers

November 25, 2008 at 11:33 PM

Hi friend,

Code to solve the problem :

import java.awt.event.*;

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.awt.*;

public class SWT_AWT {

public static void main(String[] args) {
final Display display = new Display( );
final Shell shell = new Shell(display);
shell.setText("Using Swing and AWT");
shell.setSize(350, 280);

Composite composite = new Composite(shell, SWT.EMBEDDED);
composite.setBounds(20, 20, 300, 200);
composite.setLayout(new RowLayout( ));

java.awt.Frame frame = SWT_AWT.new_Frame(composite);
java.awt.Panel panel = new java.awt.Panel( );
frame.add(panel);

final javax.swing.JButton button = new javax.swing.JButton("Click Me");
final javax.swing.JTextField text = new javax.swing.JTextField(20);

panel.add(button);
panel.add(text);

button.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent event) {
text.setText("Yep, it works.");
}
});

shell.open( );
while(!shell.isDisposed( )) {
if (!display.readAndDispatch( )) display.sleep( );
}
display.dispose( );
}
}

For more information on Swing visit to :

http://www.roseindia.net/java/example/java/swing/

Thanks









Related Tutorials/Questions & Answers:
SWT_AWT bridge ,jtextfield edit problem - Swing AWT
SWT_AWT bridge ,jtextfield edit problem  Hi All, I am using SWT_AWT bridge in my code to embed swing components in to SWT Composite. I am using SWT_AWT bridge frame and adding JTextfield to it, My problem is that the JTextfield
jtextfield
jtextfield  hii..is it possible to make a jtextfield in login page in such a way that some text should already be inserted like username and it should be displayed light in color and when a user enters some text then it should
Advertisements
jTextField in swing
jTextField in swing  I am new to java and i am making a registration form.i just want to know if there is any code in which a string cannot be inserted in a jtextfield where a phone number has to be inserted.the jtextfield should
Jlist and JTextfield
Jlist and JTextfield  How can we filter values from jlist by adding only a single letter in jtextfield such that when letter S is pressed in jtextfield then jlist should diplay all the values starting from letter S.I am using
java jtextfield
java jtextfield  how to validate jTextField which accept only number or alphabets from keyboard....plez do help me
JTextField
tooltip problem - Swing AWT
tooltip problem  Hi All, I am using SWT_AWT bridge in my code to embed swing components into SWT Composite. I am using a Swing JButton in SWT Composite. My problem is that I am unable to see the tooltip for this button even
How to return a string from a JTextField
trying to get a string from a JTextField so that I can compare it with another.... The problem is i have no clue how to get the very string i need because i think...(); final JTextField text=new JTextField(20); JButton b=new JButton
float validation for jTextField
float validation for jTextField  Hi; I try that users enter only float number into jtextfield but I can not handle it. I try regex in keylistener but I couldn't be successful. Can you help me please
JtextField - Java Beginners
JtextField  Hi, How can I populate a jtextfield of another Jframe...; JLabel label1,label2; JTextField text1,text2; Form() { label1 = new JLabel(); label1.setText("First Name:"); text1 = new JTextField(20
Copy data from one JTextField to another JTextField
Copy data from one JTextField to another JTextField..., you will learn how to copy the data from one JTextField into another JTextField. When you run this program it starts with two JTextField. Enter some
edit data
edit data  sir i want to do edit a particular customers information after he logs in, i am also using sessions. thank you
Edit Distance
Edit Distance  I want java programming ask from user input two string and the program find the edit distance between two strings and find table and optimal solution using GUI
I have problem in my Project
I have problem in my Project  Dear Sir, i have problem in my project about Jtable i have EDIT JButton whenevery i was click on edit he is display all data from database but i want to select any row
Edit the record.
Edit the record.  sir, I have a table consist of huge data.I have displayed that data.side of them there is an edit button which will edit that particular record.after editing the data i want to edit another row which is next
Java JTextField Validation - Java Beginners
Java JTextField Validation  Hello Sir ,How I can Validate JTextField In Java,when I enter Any Character value in JTextField ,I want To Display MsgBox... Validation extends JFrame{ JTextField text; JLabel l1,l2; JPanel p
JTextField Validation in java swing
JTextField Validation in java swing In this tutorial, you will learn how to validate jtextfield in java swing. Here we have created a textfield on frame... extends JFrame{ JTextField text; JLabel label; JPanel p; TextValidation(){ text
ModuleNotFoundError: No module named 'edit'
ModuleNotFoundError: No module named 'edit'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'edit' How to remove the ModuleNotFoundError: No module named 'edit' error
ModuleNotFoundError: No module named 'edit'
ModuleNotFoundError: No module named 'edit'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'edit' How to remove the ModuleNotFoundError: No module named 'edit' error
ModuleNotFoundError: No module named 'edit'
ModuleNotFoundError: No module named 'edit'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'edit' How to remove the ModuleNotFoundError: No module named 'edit' error
Edit image - XML
Edit image  How to edit my Image Document Online?  Just visit http://www.onlinedocumentconversion.com/ and register there, upload and convert your image
validate jtextfield in two different class use keylistener
validate jtextfield in two different class use keylistener  validate jtextfield in java swing will use two class, design part in one class and method calling in one class will use Keylisteners or change listeners
how to edit a record in hibernate?
how to edit a record in hibernate?  how to edit a record in hibernate?   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 Hibernate Tutorials Thanks   Hi Friend,ADS_TO_REPLACE_2 Please visit
Edit cron entry
Edit cron entry   Hi, What is the command to Edit cron entry in linux? Regards Deepak Kumar   Hi, You can use the following command to open cron configuration in vi editor: crontab -e After editing just save
importing data and edit that data
importing data and edit that data   hello sir i have data in excel sheet which contain 2 rows and i want to import that data to ms access and edit that data like adding new columns and new rows and creating new tables
UINavigationBar Edit Button
UINavigationBar Edit Button  UINavigationBar Edit Button Given is the code that adds a edit button item as a nav bar item in your UINavigation Controller. -(void)viewDidLoad; { [super viewDidLoad]; UINavigationBar* navBar
easy way to make a JCombobox look like a JTextField?
easy way to make a JCombobox look like a JTextField?  Is there a good(and easy) way to make a JCombobox look like a JTextField? By this I mean there should not be a dropdown button, but when the user enters something it should
uitableview edit done button
uitableview edit done button  How to add Edit / Done button in UITableView with an action on click?   UITableview Edit done Button To add " Edit / Done button " in UITableView add the given code in UIView Controller
update data to mysql database through JTextField
update data to mysql database through JTextField  I am getting an error, when i am updating a data to mysql database through JTextField. Send me the code used to solve my error. public void update(){ try
ModuleNotFoundError: No module named 'config_edit'
ModuleNotFoundError: No module named 'config_edit'  Hi, My Python... 'config_edit' How to remove the ModuleNotFoundError: No module named 'config_edit' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'edit-distance'
ModuleNotFoundError: No module named 'edit-distance'  Hi, My... 'edit-distance' How to remove the ModuleNotFoundError: No module named 'edit-distance' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'edit-distance-lte1'
ModuleNotFoundError: No module named 'edit-distance-lte1'  Hi, My... named 'edit-distance-lte1' How to remove the ModuleNotFoundError: No module named 'edit-distance-lte1' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'mem-edit'
ModuleNotFoundError: No module named 'mem-edit'  Hi, My Python...-edit' How to remove the ModuleNotFoundError: No module named 'mem-edit... to install padas library. You can install mem-edit python with following
ModuleNotFoundError: No module named 'vim-edit'
ModuleNotFoundError: No module named 'vim-edit'  Hi, My Python...-edit' How to remove the ModuleNotFoundError: No module named 'vim-edit... to install padas library. You can install vim-edit python with following
ModuleNotFoundError: No module named 'apyref-edit'
ModuleNotFoundError: No module named 'apyref-edit'  Hi, My Python... 'apyref-edit' How to remove the ModuleNotFoundError: No module named 'apyref-edit' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'config_edit'
ModuleNotFoundError: No module named 'config_edit'  Hi, My Python... 'config_edit' How to remove the ModuleNotFoundError: No module named 'config_edit' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dir-edit'
ModuleNotFoundError: No module named 'dir-edit'  Hi, My Python...-edit' How to remove the ModuleNotFoundError: No module named 'dir-edit... to install padas library. You can install dir-edit python with following
ModuleNotFoundError: No module named 'dvha-edit'
ModuleNotFoundError: No module named 'dvha-edit'  Hi, My Python... 'dvha-edit' How to remove the ModuleNotFoundError: No module named 'dvha-edit' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'edit-distance'
ModuleNotFoundError: No module named 'edit-distance'  Hi, My... 'edit-distance' How to remove the ModuleNotFoundError: No module named 'edit-distance' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'edit-distance-lte1'
ModuleNotFoundError: No module named 'edit-distance-lte1'  Hi, My... named 'edit-distance-lte1' How to remove the ModuleNotFoundError: No module named 'edit-distance-lte1' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'hwit-edit'
ModuleNotFoundError: No module named 'hwit-edit'  Hi, My Python... 'hwit-edit' How to remove the ModuleNotFoundError: No module named 'hwit-edit' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'jaml-edit'
ModuleNotFoundError: No module named 'jaml-edit'  Hi, My Python... 'jaml-edit' How to remove the ModuleNotFoundError: No module named 'jaml-edit' error? Thanks   Hi, In your python environment you
Update / Edit data
Update / Edit data  Hello, i want to create a page to edit or update... consists of that particular id. When the user clicks the particular edit button...="button" name="edit" value="Edit" style="background-color:green;font-weight:bold
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
delete and edit options in struts
delete and edit options in struts   Hi, I am doing an web application... errors but the edit and delete operations were not working, so please modify my...;!-- end of Update Stock items --> <!-- get items to Edit -->
delete and edit options in struts
delete and edit options in struts  Hi, I am doing an web application using struts, jsp, tomcat server, oracle as a database in netbeans IDE 7.1.2, I... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
delete and edit options in struts  Hi, I am doing an web application using struts, jsp, tomcat server, oracle as a database in netbeans IDE 7.1.2, I... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
delete and edit options in struts  Hi, I am doing an web application using struts, jsp, tomcat server, oracle as a database in netbeans IDE 7.1.2, I... errors but the edit and delete operations were not working, so please modify my
delete and edit options in struts
delete and edit options in struts  Hi, I am doing an web application using struts, jsp, tomcat server, oracle as a database in netbeans IDE 7.1.2, I... errors but the edit and delete operations were not working, so please modify my

Ads