SWT_AWT bridge ,jtextfield edit problem
1 Answer(s)      8 years ago
Posted in : Swing AWT


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( );

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


button.addActionListener(new ActionListener( ) {
public void actionPerformed(ActionEvent event) {
text.setText("Yep, it works.");
}); );
while(!shell.isDisposed( )) {
if (!display.readAndDispatch( )) display.sleep( );
display.dispose( );

For more information on Swing visit to :


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 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
The JDBC-ODBC Bridge.
The JDBC-ODBC Bridge.  Are there any ODBC drivers that do not work with the JDBC-ODBC Bridge
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
JDBC-ODBC Bridge multi-threaded.
JDBC-ODBC Bridge multi-threaded.  Is the JDBC-ODBC Bridge multi-threaded
Bridge table in SQL
Bridge table in SQL  I have 2 tables: professors(professorid INT PK, name VARCHAR), courses(courseid INT PK, title). I also have a bridge table... for something like this: given the professor name, "x" Using the bridge table
Weigh Bridge integration using java
Weigh Bridge integration using java  Hi!! every one, my name is srihari, i am a java developer. now i need a solution for my project. How can i... from the weighing bridge, and save the data in database using java, after that i
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
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
FOP Bridge
FOP Bridge       The FOP bridge plugin provides eclipse users the ability to convert... a log of FOP's progress. FOP Bridge can also integrate rendering
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
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
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
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 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
Edit image - XML
Edit image  How to edit my Image Document Online?  Just visit 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
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
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
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: Hibernate Tutorials Thanks   Hi Friend, Please visit the following link: Hibernate
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
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
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
Connection using Jdbc-odbc bridge Driver
Connection using JDBC-ODBC bridge driver bridge driver create connection between java application and 'MSAccess...;); --In this program "forName()" function is used to load the JDBC-ODBC bridge driver
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