?
Solved

JText Fields - populated

Posted on 2011-09-23
2
Medium Priority
?
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses

650 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