cannot access public method in main. (JFrame) [on hold]
$begingroup$
I have 2 classes:
- Main
- UI
UI has a button and text area.
Goal is to have Main print out text in text area when button was pressed.
HOW I'M TRYING TO DO IT(Sudo code):
UI extends JFrame{
boolean tf = false
TextArea ta = new TextArea();
JButton b(event e){
tf=true
}
public boolean getTF(){
return tf;
}
public String getTextArea(){
return ta.getText();
}
}
Main{
public static void Main(String args){
JFrame ui = new UI()
while(true){
if(ui.getTF() == true){
System.out.println(ui.getTextArea())
}
}
}
Problem is Main does not see the methods getTF() and getTextArea() in the UI class. I'm guessing this is because it extends JFrame.
Is there a better way to do this (without combining the UI Class and the Main class)?
java swing scope
$endgroup$
put on hold as off-topic by vnp, 200_success, Jamal♦ 53 mins ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – vnp, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I have 2 classes:
- Main
- UI
UI has a button and text area.
Goal is to have Main print out text in text area when button was pressed.
HOW I'M TRYING TO DO IT(Sudo code):
UI extends JFrame{
boolean tf = false
TextArea ta = new TextArea();
JButton b(event e){
tf=true
}
public boolean getTF(){
return tf;
}
public String getTextArea(){
return ta.getText();
}
}
Main{
public static void Main(String args){
JFrame ui = new UI()
while(true){
if(ui.getTF() == true){
System.out.println(ui.getTextArea())
}
}
}
Problem is Main does not see the methods getTF() and getTextArea() in the UI class. I'm guessing this is because it extends JFrame.
Is there a better way to do this (without combining the UI Class and the Main class)?
java swing scope
$endgroup$
put on hold as off-topic by vnp, 200_success, Jamal♦ 53 mins ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – vnp, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
I have 2 classes:
- Main
- UI
UI has a button and text area.
Goal is to have Main print out text in text area when button was pressed.
HOW I'M TRYING TO DO IT(Sudo code):
UI extends JFrame{
boolean tf = false
TextArea ta = new TextArea();
JButton b(event e){
tf=true
}
public boolean getTF(){
return tf;
}
public String getTextArea(){
return ta.getText();
}
}
Main{
public static void Main(String args){
JFrame ui = new UI()
while(true){
if(ui.getTF() == true){
System.out.println(ui.getTextArea())
}
}
}
Problem is Main does not see the methods getTF() and getTextArea() in the UI class. I'm guessing this is because it extends JFrame.
Is there a better way to do this (without combining the UI Class and the Main class)?
java swing scope
$endgroup$
I have 2 classes:
- Main
- UI
UI has a button and text area.
Goal is to have Main print out text in text area when button was pressed.
HOW I'M TRYING TO DO IT(Sudo code):
UI extends JFrame{
boolean tf = false
TextArea ta = new TextArea();
JButton b(event e){
tf=true
}
public boolean getTF(){
return tf;
}
public String getTextArea(){
return ta.getText();
}
}
Main{
public static void Main(String args){
JFrame ui = new UI()
while(true){
if(ui.getTF() == true){
System.out.println(ui.getTextArea())
}
}
}
Problem is Main does not see the methods getTF() and getTextArea() in the UI class. I'm guessing this is because it extends JFrame.
Is there a better way to do this (without combining the UI Class and the Main class)?
java swing scope
java swing scope
asked 3 hours ago
llamaCaraDarallamaCaraDara
1413
1413
put on hold as off-topic by vnp, 200_success, Jamal♦ 53 mins ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – vnp, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by vnp, 200_success, Jamal♦ 53 mins ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – vnp, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes