Solved

JText Fields - populated

Posted on 2011-09-23
2
205 Views
Last Modified: 2012-05-12
I have four JText fields in my dialog.  I am not sure that the right thing is to have them has JText fields.  When the dialog is being created, those fields will get values from a different place.  The fields should not be editable

Right now I have final

final JTextField curProject = new JTextField(20);
final JTextField cur3dTrans = new JTextField(20);
final JTextField cur2dTrans = new JTextField(20);
final JTextField curEmails = new JTextField(20);

example would be something like this (not exactly right, but the value will come from a differernt place)

ediProject.getProjectName() = curProject

So I need to have a field with a value and non editable by the user
What is the best way to do this?

0
Comment
Question by:jkteater
  • 2
2 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36589536
You dont need to have them final

JTextField cur2dTrans = new JTextField("your original text");
cur2dTrans.setEditable(false);


0
 
LVL 47

Accepted Solution

by:
for_yan earned 50 total points
ID: 36589579
better make them instance variables:

public calss YurMainClass {
 JTextField curProject;

public YourMainClass(){
cur2dTrans = new JTextField("your original tracl");
cur2dTrans.setEditable(false);





}


public void actionPerformed (ActionEvent ae){
//create your dialog
//get Project say from this dialog

curProject = getProject();

cur2dTrans.setEditable(false);




}


}
 
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question