Solved

JText Fields - populated

Posted on 2011-09-23
2
202 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

706 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now