0

I am new to Swing. I am using Swing from Netbeans pallete.

So my concerns is that I have 2 display:

  1. JLabel which is on JScrollpane in Frame Like - Frame -> JScrollPane -> JPanel -> JLabel
  2. JTable which is on a another frame Like Frame (second) -> JTable

When I clicked on the JLabel the JTable is opened

And I will pull data from table and pass it to the text area which is in panel.

I got the value but its not getting updated in text area.

I have tried:

public  void getJsonLD(JSONObject jobj){
    jTextArea1.setText(jobj.toString());
    jScrollPane1.revalidate();  
    jScrollPane1.repaint(); 
}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
pavan kumar
  • 89
  • 1
  • 2
  • 10
  • Have you tried revalidating/repainting the frame rather than the scrollpane? – Dinh Oct 26 '17 at 07:27
  • @Dinh *"Have you tried.."* .. **not** making random guesses? OP: 1) For better help sooner, post a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). 2) A single blank line of white space in source code is all that is *ever* needed. Blank lines after `{` or before `}` are also typically redundant. 3) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) 4) *"When I clicked on the `JLabel` the `JTable` is opened"* Change the label to a button. – Andrew Thompson Oct 26 '17 at 07:31
  • @AndrewThompson i just want to take input from a table and put that input inside a jTextArea , As I am very new to Swing So can you suggest me that what should i use instead of JFrame to open a JTable – pavan kumar Oct 26 '17 at 07:46
  • There are many options, *as outlined in the linked answer.* OTOH I would not use any of those options, and instead create and add the table (with an empty table model) at application start up. When the app. gets data to display in the table, change the model and it will appear! **How is that MCVE / SSCCE coming along?** – Andrew Thompson Oct 26 '17 at 08:48

0 Answers0